Skip to content

Commit 6d17824

Browse files
committed
openstack: Sync CA cert to new key
cloud-credential-operator now supports syncing CA certs from the root credential secret to the generated credentials secrets. If necessary, CCO expects the CA cert to be provided in the `cacert` key and will place it in the same location in the generated secrets. Start doing the same in control-plane-operator, which allows us to significantly simplify the assets used in cluster-storage-operator and csi-operator. Note that we are intentionally *not* changing how CA certs are managed for cluster-cloud-controller-manager-operator. There's a good reason for this, and a note is left inline to that effect. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent 1f7a67f commit 6d17824

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

  • control-plane-operator

control-plane-operator/controllers/hostedcontrolplane/cloud/openstack/providerconfig.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,17 @@ func ReconcileCloudConfigSecret(platformSpec *hyperv1.OpenStackPlatformSpec, sec
2828
}
2929
config := getCloudConfig(platformSpec, credentialsSecret, caCertData, machineNetwork)
3030
if caCertData != nil {
31+
secret.Data[CASecretKey] = caCertData
32+
// TODO(stephenfin): Both csi-operator (for Manila and Cinder CSI) and
33+
// cluster-storage-operatpr now uses the certs from 'cacert', meaning
34+
// this is no longer necessary. It is only kept here temporarily to
35+
// ease upgrades. Remove in 4.20+
3136
secret.Data[CABundleKey] = caCertData
3237
}
38+
// TODO(stephenfin): Neither cinder nor manila CSI drivers (as deployed by
39+
// csi-operator) consume configuration from this secret: cinder sources it
40+
// from the config map, and manila does its own special thing. Remove in
41+
// 4.20+
3342
secret.Data[CloudConfigKey] = []byte(config)
3443

3544
return nil

control-plane-operator/controllers/hostedcontrolplane/v2/cloud_controller_manager/openstack/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ func adaptConfig(cpContext component.WorkloadContext, cm *corev1.ConfigMap) erro
4545

4646
caCertData := GetCACertFromCredentialsSecret(credentialsSecret)
4747
if caCertData != nil {
48+
// NOTE(stephenfin): While we (OpenStack) would prefer that this used
49+
// 'cacert' like everything else, CCCMO expects the CA cert to be found
50+
// at 'ca-bundle.pem' since it will combine this cert with an optional
51+
// cert bundle. This is done for more platforms that OpenStack so we
52+
// don't want to change that. See the below for more information.
53+
//
54+
// https://github.com/openshift/cluster-cloud-controller-manager-operator/blob/master/docs/dev/trusted_ca_bundle_sync.md
4855
cm.Data[CABundleKey] = string(caCertData)
4956
}
5057

control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,9 +1541,9 @@ func (r *reconciler) reconcileCloudCredentialSecrets(ctx context.Context, hcp *h
15411541
caCertData := openstack.GetCACertFromCredentialsSecret(credentialsSecret)
15421542
errs = append(errs,
15431543
r.reconcileOpenStackCredentialsSecret(ctx, hcp.Spec.Platform.OpenStack, "openshift-cluster-csi-drivers", "openstack-cloud-credentials", credentialsSecret, caCertData, hcp.Spec.Networking.MachineNetwork),
1544+
r.reconcileOpenStackCredentialsSecret(ctx, hcp.Spec.Platform.OpenStack, "openshift-cluster-csi-drivers", "manila-cloud-credentials", credentialsSecret, caCertData, hcp.Spec.Networking.MachineNetwork),
15441545
r.reconcileOpenStackCredentialsSecret(ctx, hcp.Spec.Platform.OpenStack, "openshift-image-registry", "installer-cloud-credentials", credentialsSecret, caCertData, hcp.Spec.Networking.MachineNetwork),
15451546
r.reconcileOpenStackCredentialsSecret(ctx, hcp.Spec.Platform.OpenStack, "openshift-cloud-network-config-controller", "cloud-credentials", credentialsSecret, caCertData, hcp.Spec.Networking.MachineNetwork),
1546-
r.reconcileOpenStackCredentialsSecret(ctx, hcp.Spec.Platform.OpenStack, "openshift-cluster-csi-drivers", "manila-cloud-credentials", credentialsSecret, caCertData, hcp.Spec.Networking.MachineNetwork),
15471547
)
15481548
case hyperv1.PowerVSPlatform:
15491549
createPowerVSSecret := func(srcSecret, destSecret *corev1.Secret) error {
@@ -1619,7 +1619,7 @@ func (r *reconciler) reconcileCloudCredentialSecrets(ctx context.Context, hcp *h
16191619
return errs
16201620
}
16211621

1622-
// reconcileOpenStackCredentialsSecret is a wrapper used to reconcile the OpenStack cloud config secrets.
1622+
// reconcileOpenStackCredentialsSecret is a wrapper used to reconcile the OpenStack credentials secrets.
16231623
func (r *reconciler) reconcileOpenStackCredentialsSecret(ctx context.Context, platformSpec *hyperv1.OpenStackPlatformSpec, namespace, name string, credentialsSecret *corev1.Secret, caCertData []byte, machineNetwork []hyperv1.MachineNetworkEntry) error {
16241624
secret := &corev1.Secret{
16251625
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)