Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootkube: override control-plane configs – fix kubectl logs #9

Merged
merged 1 commit into from
Oct 18, 2018
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
7 changes: 7 additions & 0 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (a *Bootstrap) addBootstrapFiles(dependencies asset.Parents) {
}

func (a *Bootstrap) addBootkubeFiles(dependencies asset.Parents, templateData *bootstrapTemplateData) {
bootkubeConfigOverridesDir := filepath.Join(rootDir, "bootkube-config-overrides")
adminKubeconfig := &kubeconfig.Admin{}
manifests := &manifests.Manifests{}
dependencies.Get(adminKubeconfig, manifests)
Expand All @@ -191,6 +192,12 @@ func (a *Bootstrap) addBootkubeFiles(dependencies asset.Parents, templateData *b
a.Config.Storage.Files,
ignition.FileFromString("/opt/tectonic/bootkube.sh", 0555, applyTemplateData(content.BootkubeShFileTemplate, templateData)),
)
for _, o := range content.BootkubeConfigOverrides {
a.Config.Storage.Files = append(
a.Config.Storage.Files,
ignition.FileFromString(filepath.Join(bootkubeConfigOverridesDir, o.Name()), 0600, applyTemplateData(o, templateData)),
)
}
a.Config.Storage.Files = append(
a.Config.Storage.Files,
ignition.FilesFromAsset(rootDir, 0600, adminKubeconfig)...,
Expand Down
33 changes: 31 additions & 2 deletions pkg/asset/ignition/bootstrap/content/bootkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ then
--manifest-image=${OPENSHIFT_HYPERSHIFT_IMAGE} \
--asset-input-dir=/assets/tls \
--asset-output-dir=/assets/kube-apiserver-bootstrap \
--config-output-file=/assets/kube-apiserver-bootstrap/config
--config-output-file=/assets/kube-apiserver-bootstrap/config \
--config-override-files=/assets/bootkube-config-overrides/kube-apiserver-config-overrides.yaml

cp kube-apiserver-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-apiserver-config.yaml
cp kube-apiserver-bootstrap/bootstrap-manifests/* bootstrap-manifests/
Expand All @@ -95,7 +96,8 @@ then
--manifest-image=${OPENSHIFT_HYPERKUBE_IMAGE} \
--asset-input-dir=/assets/tls \
--asset-output-dir=/assets/kube-controller-manager-bootstrap \
--config-output-file=/assets/kube-controller-manager-bootstrap/config
--config-output-file=/assets/kube-controller-manager-bootstrap/config \
--config-override-files=/assets/bootkube-config-overrides/kube-controller-manager-config-overrides.yaml

cp kube-controller-manager-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-controller-manager-config.yaml
cp kube-controller-manager-bootstrap/bootstrap-manifests/* bootstrap-manifests/
Expand Down Expand Up @@ -229,3 +231,30 @@ podman run \
start --asset-dir=/assets
`))
)

var (
// BootkubeConfigOverrides contains the configuration override files passed to the render commands of the components.
// These are supposed to be customized by the installer where the config differs from the operator render default.
BootkubeConfigOverrides = []*template.Template{
KubeApiserverConfigOverridesTemplate,
KubeControllerManagerConfigOverridesTemplate,
}
)

var (
// KubeApiserverConfigOverridesTemplate are overrides that the installer passes to the default config of the
// kube-apiserver rendered by the cluster-kube-apiserver-operator.
KubeApiserverConfigOverridesTemplate = template.Must(template.New("kube-apiserver-config-overrides.yaml").Parse(`
apiVersion: kubecontrolplane.config.openshift.io/v1
kind: KubeAPIServerConfig
kubeletClientInfo:
ca: "" # kubelet uses self-signed serving certs. TODO: fix kubelet pki
`))

// KubeControllerManagerConfigOverridesTemplate are overrides that the installer passes to the default config of the
// kube-controller-manager rendered by the cluster-kube-controller-manager-operator.
KubeControllerManagerConfigOverridesTemplate = template.Must(template.New("kube-controller-manager-config-overrides.yaml").Parse(`
apiVersion: kubecontrolplane.config.openshift.io/v1
kind: KubeControllerManagerConfig
`))
)