Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func initCerts(cfg *config.MicroshiftConfig) error {
// ocp
if err := util.GenCerts("openshift-apiserver", cfg.DataDir+"/resources/ocp-apiserver/secrets",
"tls.crt", "tls.key",
[]string{"openshift-apiserver", cfg.NodeIP, "127.0.0.1", "kubernetes.default.svc", "kubernetes.default", "kubernetes", "localhost"}); err != nil {
[]string{"openshift-apiserver", cfg.NodeIP, "openshift-apiserver.default.svc", "openshift-apiserver.default", "127.0.0.1", "kubernetes.default.svc", "kubernetes.default", "kubernetes", "localhost"}); err != nil {
return err
}
if err := util.GenCerts("openshift-controller-manager", cfg.DataDir+"/resources/ocp-controller-manager/secrets",
Expand Down
18 changes: 11 additions & 7 deletions pkg/controllers/apiservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package controllers

import (
"context"
"io/ioutil"
"strings"

"github.com/sirupsen/logrus"

"github.com/openshift/microshift/pkg/assets"
"github.com/openshift/microshift/pkg/config"
"github.com/sirupsen/logrus"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -119,6 +119,10 @@ func createAPIRegistration(cfg *config.MicroshiftConfig) error {
if err != nil {
return err
}
caFile, err := ioutil.ReadFile(cfg.DataDir + "/certs/ca-bundle/ca-bundle.crt")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of caFile, caBytes or caData

if err != nil {
logrus.Errorf("Error loading CA bundle certificate: %v", err)
}
client := apiregistrationclientv1.NewForConfigOrDie(rest.AddUserAgent(restConfig, "apiregistration-agent"))
for _, apiSvc := range []string{
"v1.apps.openshift.io",
Expand Down Expand Up @@ -146,11 +150,11 @@ func createAPIRegistration(cfg *config.MicroshiftConfig) error {
Name: "openshift-apiserver",
Namespace: "default",
},
Group: trimFirst(apiSvc, "."),
GroupPriorityMinimum: 9900,
Version: "v1",
InsecureSkipTLSVerify: true,
VersionPriority: 15,
Group: trimFirst(apiSvc, "."),
GroupPriorityMinimum: 9900,
Version: "v1",
CABundle: caFile,
VersionPriority: 15,
},
}
_, err = client.APIServices().Get(context.TODO(), api.Name, metav1.GetOptions{})
Expand Down
6 changes: 0 additions & 6 deletions pkg/controllers/ocp-controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ func OCPAPIServer(cfg *config.MicroshiftConfig) error {
"--config=" + cfg.DataDir + "/resources/openshift-apiserver/config/config.yaml",
"--authorization-kubeconfig=" + cfg.DataDir + "/resources/kubeadmin/kubeconfig",
"--authentication-kubeconfig=" + cfg.DataDir + "/resources/kubeadmin/kubeconfig",
"--requestheader-client-ca-file=" + cfg.DataDir + "/certs/ca-bundle/ca-bundle.crt",
"--requestheader-allowed-names=kube-apiserver-proxy,system:kube-apiserver-proxy,system:openshift-aggregator",
"--requestheader-username-headers=X-Remote-User",
"--requestheader-group-headers=X-Remote-Group",
"--requestheader-extra-headers-prefix=X-Remote-Extra-",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the request headers, did you compare notes with OpenShift whether they are not needed? I’ve noticed we’re still configuring them in kube-apiserver via command line args (incl. CA certs) and (due to the analogy between both API servers) I’m wondering whether we’d want our approach to configuring kube-api and openshift-api in sync?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use the bare minimum number of flags in order to use the config file as much as possible.

"--client-ca-file=" + cfg.DataDir + "/certs/ca-bundle/ca-bundle.crt",
"--logtostderr=" + strconv.FormatBool(cfg.LogDir == "" || cfg.LogAlsotostderr),
"--alsologtostderr=" + strconv.FormatBool(cfg.LogAlsotostderr),
"--v=" + strconv.Itoa(cfg.LogVLevel),
Expand Down