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
4 changes: 3 additions & 1 deletion cmd/machine-config-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var (
bootstrapOpts struct {
etcdCAFile string
rootCAFile string
kubeCAFile string
pullSecretFile string
configFile string
oscontentImage string
Expand All @@ -45,6 +46,7 @@ func init() {
rootCmd.AddCommand(bootstrapCmd)
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.etcdCAFile, "etcd-ca", "/etc/ssl/etcd/ca.crt", "path to etcd CA certificate")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.rootCAFile, "root-ca", "/etc/ssl/kubernetes/ca.crt", "path to root CA certificate")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.kubeCAFile, "kube-ca", "/assets/tls/kube-ca.crt", "path to kube CA certificate")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.pullSecretFile, "pull-secret", "/assets/manifests/pull.json", "path to secret manifest that contains pull secret.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.destinationDir, "dest-dir", "", "The destination directory where MCO writes the manifests.")
bootstrapCmd.MarkFlagRequired("dest-dir")
Expand Down Expand Up @@ -85,7 +87,7 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) {
if err := operator.RenderBootstrap(
bootstrapOpts.configFile,
bootstrapOpts.infraConfigFile, bootstrapOpts.networkConfigFile,
bootstrapOpts.etcdCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.pullSecretFile,
bootstrapOpts.etcdCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.kubeCAFile, bootstrapOpts.pullSecretFile,
imgs,
bootstrapOpts.destinationDir,
); err != nil {
Expand Down
15 changes: 13 additions & 2 deletions pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
func RenderBootstrap(
clusterConfigConfigMapFile string,
infraFile, networkFile string,
etcdCAFile, rootCAFile string, pullSecretFile string,
etcdCAFile, rootCAFile string, kubeCAFile string, pullSecretFile string,
imgs Images,
destinationDir string,
) error {
Expand All @@ -33,6 +33,9 @@ func RenderBootstrap(
infraFile, networkFile,
rootCAFile, etcdCAFile, pullSecretFile,
}
if kubeCAFile != "" {
files = append(files, kubeCAFile)
}
for _, file := range files {
data, err := ioutil.ReadFile(file)
if err != nil {
Expand Down Expand Up @@ -67,8 +70,16 @@ func RenderBootstrap(
if err != nil {
return err
}

bundle := make([]byte, 0)
bundle = append(bundle, filesData[rootCAFile]...)
// Append the kube-ca if given.
if _, ok := filesData[kubeCAFile]; ok {
bundle = append(bundle, filesData[kubeCAFile]...)
}

spec.EtcdCAData = filesData[etcdCAFile]
spec.RootCAData = filesData[rootCAFile]
spec.RootCAData = bundle
spec.PullSecret = nil
spec.SSHKey = ic.SSHKey
spec.OSImageURL = imgs.MachineOSContent
Expand Down
9 changes: 8 additions & 1 deletion pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ func (optr *Operator) sync(key string) error {
if err != nil {
return err
}
kubeCA, err := optr.getCAsFromConfigMap("openshift-config", "initial-client-ca", "ca-bundle.crt")
if err != nil {
return err
}
bundle := make([]byte, 0)
bundle = append(bundle, rootCA...)
bundle = append(bundle, kubeCA...)

// sync up os image url
// TODO: this should probably be part of the imgs
Expand All @@ -311,7 +318,7 @@ func (optr *Operator) sync(key string) error {
return err
}
spec.EtcdCAData = etcdCA
spec.RootCAData = rootCA
spec.RootCAData = bundle
spec.PullSecret = &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}
spec.SSHKey = ic.SSHKey
spec.OSImageURL = imgs.MachineOSContent
Expand Down