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 @@ -25,6 +25,7 @@ var (

bootstrapOpts struct {
etcdCAFile string
etcdMetricCAFile string
rootCAFile string
kubeCAFile string
pullSecretFile string
Expand All @@ -47,6 +48,7 @@ var (
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.etcdMetricCAFile, "etcd-metric-ca", "/assets/tls/etcd-metric-ca-bundle.crt", "path to etcd metric 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", "", "path to kube CA certificate")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.pullSecretFile, "pull-secret", "/assets/manifests/pull.json", "path to secret manifest that contains pull secret.")
Expand Down Expand Up @@ -95,7 +97,7 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) {
if err := operator.RenderBootstrap(
bootstrapOpts.configFile,
bootstrapOpts.infraConfigFile, bootstrapOpts.networkConfigFile,
bootstrapOpts.etcdCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.kubeCAFile, bootstrapOpts.pullSecretFile,
bootstrapOpts.etcdCAFile, bootstrapOpts.etcdMetricCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.kubeCAFile, bootstrapOpts.pullSecretFile,
imgs,
bootstrapOpts.destinationDir,
); err != nil {
Expand Down
1 change: 1 addition & 0 deletions lib/resourcemerge/machineconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func ensureControllerConfigSpec(modified *bool, existing *mcfgv1.ControllerConfi
setStringIfSet(modified, &existing.OSImageURL, required.OSImageURL)

setBytesIfSet(modified, &existing.EtcdCAData, required.EtcdCAData)
setBytesIfSet(modified, &existing.EtcdMetricCAData, required.EtcdMetricCAData)
setBytesIfSet(modified, &existing.RootCAData, required.RootCAData)

if required.PullSecret != nil && !equality.Semantic.DeepEqual(existing.PullSecret, required.PullSecret) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/machineconfiguration.openshift.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ type ControllerConfigSpec struct {
EtcdDiscoveryDomain string `json:"etcdDiscoveryDomain"`

// CAs
EtcdCAData []byte `json:"etcdCAData"`
RootCAData []byte `json:"rootCAData"`
EtcdCAData []byte `json:"etcdCAData"`
EtcdMetricCAData []byte `json:"etcdMetricCAData"`
RootCAData []byte `json:"rootCAData"`

// PullSecret is the default pull secret that needs to be installed
// on all machines.
Expand Down
3 changes: 2 additions & 1 deletion 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, kubeCAFile string, pullSecretFile string,
etcdCAFile, etcdMetricCAFile string, rootCAFile string, kubeCAFile string, pullSecretFile string,
imgs Images,
destinationDir string,
) error {
Expand Down Expand Up @@ -79,6 +79,7 @@ func RenderBootstrap(
}

spec.EtcdCAData = filesData[etcdCAFile]
spec.EtcdMetricCAData = filesData[etcdMetricCAFile]
spec.RootCAData = bundle
spec.PullSecret = nil
spec.SSHKey = ic.SSHKey
Expand Down
5 changes: 5 additions & 0 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ func (optr *Operator) sync(key string) error {
if err != nil {
return err
}
etcdMetricCA, err := optr.getCAsFromConfigMap("openshift-config", "etcd-metric-serving-ca", "ca-bundle.crt")
if err != nil {
return err
}
rootCA, err := optr.getCAsFromConfigMap("kube-system", "root-ca", "ca.crt")
if err != nil {
return err
Expand Down Expand Up @@ -318,6 +322,7 @@ func (optr *Operator) sync(key string) error {
}

spec.EtcdCAData = etcdCA
spec.EtcdMetricCAData = etcdMetricCA
spec.RootCAData = bundle
spec.PullSecret = &v1.ObjectReference{Namespace: "kube-system", Name: "coreos-pull-secret"}
spec.SSHKey = ic.SSHKey
Expand Down