-
Notifications
You must be signed in to change notification settings - Fork 61
manila: set os-certAuthorityPath in csi-manila-secrets for CA discovery #615
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,22 @@ const ( | |
| openshiftDefaultCloudConfigNamespace = "openshift-config" | ||
| metricsCertSecretName = "manila-csi-driver-controller-metrics-serving-cert" | ||
| nfsImageEnvName = "NFS_DRIVER_IMAGE" | ||
|
|
||
| // caCertMountPath is the path where the cloud provider CA certificate is | ||
| // mounted in the controller Deployment and node DaemonSet. This must match | ||
| // the mountPath of the "cacert" volume in the deployment/daemonset | ||
| // templates. | ||
| caCertMountPath = "/etc/kubernetes/static-pod-resources/configmaps/cloud-config/ca-bundle.pem" | ||
| // caCertKey is the key in the cloud config ConfigMap that holds the CA | ||
| // certificate. | ||
| caCertKey = "ca-bundle.pem" | ||
|
|
||
| // cloudConfigStandalone is the name of the cloud-provider ConfigMap in | ||
| // standalone deployments. | ||
| cloudConfigStandalone = "cloud-provider-config" | ||
| // cloudConfigHyperShift is the name of the cloud-provider ConfigMap in | ||
| // HyperShift deployments (the HyperShift operator uses a different name). | ||
| cloudConfigHyperShift = "openstack-cloud-config" | ||
| ) | ||
|
|
||
| // GetOpenStackManilaGeneratorConfig returns configuration for generating assets of Manila CSI driver operator. | ||
|
|
@@ -134,6 +150,14 @@ func GetOpenStackManilaOperatorControllerConfig(ctx context.Context, flavour gen | |
| cfg.AddDeploymentHookBuilders(c, withCABundleDeploymentHook) | ||
| cfg.AddDaemonSetHookBuilders(c, withCABundleDaemonSetHook, withClusterWideProxyDaemonSetHook) | ||
|
|
||
| // Determine the cloud config ConfigMap name based on the cluster flavour. | ||
| // This ConfigMap holds the cloud provider CA cert used by the operator | ||
| // and the CSI driver. | ||
| cloudConfigName := cloudConfigStandalone | ||
| if flavour == generator.FlavourHyperShift { | ||
| cloudConfigName = cloudConfigHyperShift | ||
| } | ||
|
Comment on lines
+158
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable repository conventions ---'
head -5 /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7/*/*.md 2>/dev/null || true
printf '%s\n' '--- changed hunk ---'
git diff -- pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- driver context ---'
sed -n '110,190p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- referenced overlay patches ---'
for f in assets/overlays/openstack-manila/patches/controller_add_driver.yaml \
assets/overlays/openstack-manila/patches/node_add_driver.yaml; do
printf '\n### %s\n' "$f"
cat -n "$f"
done
printf '%s\n' '--- HyperShift/openstack-manila references ---'
rg -n -C 3 'cloudConfigHyperShift|openstack-cloud-config|cloud-provider-config|os-certAuthorityPath|cacert|guest sync|guest-sync|HyperShift' \
pkg assets config deploy 2>/dev/null || trueRepository: openshift/csi-operator Length of output: 50379 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- generator configuration and runtime flow ---'
sed -n '70,110p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '145,245p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- all openstack-manila patch files ---'
find assets/overlays/openstack-manila -maxdepth 3 -type f -path '*/patches/*' -print -exec sh -c 'echo "--- $1"; cat -n "$1"' _ {} \;
printf '%s\n' '--- generated HyperShift and standalone manifests ---'
find assets/overlays/openstack-manila -type f \( -path '*/generated/hypershift/*' -o -path '*/generated/standalone/*' \) -print | sort
rg -n -C 4 'name: (cloud-provider-config|openstack-cloud-config)|name: cacert|ca-bundle.pem|os-certAuthorityPath' \
assets/overlays/openstack-manila/generated pkg/driver/openstack-manilaRepository: openshift/csi-operator Length of output: 36756 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- complete CA-path replacement flow ---'
sed -n '230,290p' pkg/driver/openstack-manila/openstack_manila.go
rg -n -C 8 'func createConfigMapSyncer|createConfigMapSyncer\\(|NewConfigSyncController|ConfigMapSync|cloudConfigName|MANILA_CA_CERT_PATH' \
pkg/driver/openstack-manila pkg/driver/common pkg 2>/dev/null
printf '%s\n' '--- HyperShift config-sync implementation ---'
rg -n -C 6 'type .*ConfigSync|func .*ConfigSync|openstack-cloud-config|cloud-provider-config|ca-bundle.pem' \
pkg/ 2>/dev/null | head -300Repository: openshift/csi-operator Length of output: 2708 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- openstack-manila syncer references ---'
rg -n -C 10 'createConfigMapSyncer|configsync|NewConfigSyncController' pkg/driver/openstack-manila || true
printf '%s\n' '--- config-sync definitions ---'
rg -n -C 8 'NewConfigSyncController|type ConfigSync|func .*ConfigSync|cloudConfig' pkg | head -400 || true
printf '%s\n' '--- generated config-secret placement and replacements ---'
rg -n -C 5 'MANILA_CA_CERT_PATH|config_secret.yaml|csi-manila-secrets|ExtraReplacementsFunc' \
pkg/driver/openstack-manila pkg/driver/common assets/overlays/openstack-manila/generated/hypershift \
assets/overlays/openstack-manila/generated/standalone || trueRepository: openshift/csi-operator Length of output: 43986 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- exact Manila syncer implementation and imports ---'
sed -n '1,75p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '375,420p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- resolved util cloud-config constants ---'
rg -n -C 5 'CloudConfigNamespace|CloudConfigName|CloudName' pkg/openstack-manila vendor | head -160
printf '%s\n' '--- resource sync controller contract ---'
rg -n -C 8 'func \\(.*\\) SyncConfigMap|type ResourceLocation|NewResourceSyncController' pkg vendor | head -240Repository: openshift/csi-operator Length of output: 31179 Align the HyperShift node volume and ConfigMap sync.
🤖 Prompt for AI Agents |
||
|
|
||
| cfg.DeploymentWatchedSecretNames = append(cfg.DeploymentWatchedSecretNames, metricsCertSecretName) | ||
| cfg.StaleConditionsName = []string{ | ||
| "ManilaDriverConditionalStaticResourcesController", | ||
|
|
@@ -208,6 +232,26 @@ func GetOpenStackManilaOperatorControllerConfig(ctx context.Context, flavour gen | |
| if nfsImage != "" { | ||
| pairs = append(pairs, []string{"${NFS_DRIVER_IMAGE}", nfsImage}...) | ||
| } | ||
|
|
||
| // Set the CA cert path for the Manila CSI driver when the cloud | ||
| // provider CA certificate is available. The upstream Manila CSI | ||
| // driver reads os-certAuthorityPath from the CSI secret to find | ||
| // the CA bundle. We set it to the mounted cacert volume path | ||
| // when the cloud config ConfigMap has a ca-bundle.pem entry. | ||
| // When absent (e.g. public CA), we leave it empty so the driver | ||
| // skips the CA file and uses the system trust store. | ||
| caCertPath := "" | ||
| cm, err := c.ControlPlaneKubeClient.CoreV1().ConfigMaps(c.ControlPlaneNamespace).Get(ctx, cloudConfigName, metav1.GetOptions{}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository conventions and learnings relevant to driver/OpenStack ---'
find /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7 -type f -name '*.md' -print \
| sort
printf '%s\n' '--- target file and nearby definitions ---'
sed -n '110,155p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '220,260p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '360,400p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- direct references ---'
rg -n -C 3 'CloudConfigNamespace|createConfigMapSyncer|GetOpenStackManilaOperatorConfig|cloud-provider-config|ControlPlaneNamespace' \
pkg/driver/openstack-manila pkg/driverRepository: openshift/csi-operator Length of output: 44794 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- scoped repository guidance ---'
for f in /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7/*/*.md; do
case "$f" in
*driver*|*openstack*|*manila*) printf '\n### %s\n' "$f"; cat "$f" ;;
esac
done
printf '%s\n' '--- target source ---'
sed -n '120,145p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '235,250p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '375,392p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- namespace/client construction and callers ---'
rg -n -C 5 'ControlPlaneKubeClient|ControlPlaneNamespace|CloudConfigNamespace|ConfigMap.*cloudConfigName|cloudConfigName' \
pkg/driver/openstack-manilaRepository: openshift/csi-operator Length of output: 31785 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- complete controller setup and imports ---'
sed -n '1,75p' pkg/driver/openstack-manila/openstack_manila.go
sed -n '145,235p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- bound util constants and client namespace semantics ---'
rg -n -C 4 'CloudConfigNamespace|CloudConfigName' --glob '*.go' .
rg -n -C 4 'type Clients struct|ControlPlaneNamespace|ControlPlaneKubeClient' pkg/driver pkg/clients 2>/dev/null || true
printf '%s\n' '--- related config-sync implementation ---'
rg -n -C 5 'NewConfigSyncController|openstack-cloud-config|cloud-provider-config|FlavourHyperShift' pkg/driver/openstack-cinder pkg/driver/openstack-manilaRepository: openshift/csi-operator Length of output: 50378 Read the cloud ConfigMap from its owning namespace. On standalone clusters, 🤖 Prompt for AI Agents |
||
| if err == nil { | ||
| if val, ok := cm.Data[caCertKey]; ok && len(val) > 0 { | ||
| caCertPath = caCertMountPath | ||
| klog.V(4).Infof("Cloud config ConfigMap %s/%s has %s, setting CA cert path to %s", c.ControlPlaneNamespace, cloudConfigName, caCertKey, caCertPath) | ||
| } | ||
| } else { | ||
| klog.V(4).Infof("Could not read cloud config ConfigMap %s/%s: %v", c.ControlPlaneNamespace, cloudConfigName, err) | ||
| } | ||
| pairs = append(pairs, []string{"${MANILA_CA_CERT_PATH}", caCertPath}...) | ||
|
Comment on lines
+250
to
+253
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- target symbols and hunk ---'
rg -n -C 12 'cloudConfigName|MANILA_CA_CERT_PATH|Could not read cloud config|caCertPath' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- target file outline ---'
ast-grep outline pkg/driver/openstack-manila/openstack_manila.go --lang goRepository: openshift/csi-operator Length of output: 8876 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable conventions ---'
cat /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7/conventions/pkg-driver.md
cat /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7/conventions/assets.md
cat /tmp/coderabbit-repo-knowledge/openshift-csi-operator-620425b7/conventions/repo-wide.md
printf '%s\n' '--- controller configuration flow ---'
sed -n '140,260p' pkg/driver/openstack-manila/openstack_manila.go
printf '%s\n' '--- relevant declarations and callers ---'
rg -n -C 8 'Asset|AssetHook|DeploymentHook|DaemonSetHook|AddDeploymentHookBuilders|assetWithNFSDriver|MANILA_CA_CERT_PATH' pkg vendor go.modRepository: openshift/csi-operator Length of output: 50379 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target flow and asset use ---'
rg -n -C 10 'ExtraReplacementsFunc|MANILA_CA_CERT_PATH|os-certAuthorityPath|ca-bundle.pem' pkg/driver/openstack-manila assets overlays
printf '%s\n' '--- controller config contract ---'
rg -n -C 12 'type OperatorControllerConfig|ExtraReplacementsFunc' pkg/operator pkg/clients
printf '%s\n' '--- generated Manila assets containing the replacement ---'
rg -n -C 8 'MANILA_CA_CERT_PATH|os-certAuthorityPath' --glob '*.yaml' --glob '*.go' .Repository: openshift/csi-operator Length of output: 37081 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- exact replacement contract and invocation ---'
rg -l 'type OperatorControllerConfig|ExtraReplacementsFunc' pkg/operator vendor | head -20
rg -n -C 8 'ExtraReplacementsFunc' pkg/operator
printf '%s\n' '--- asset replacement path ---'
sed -n '35,80p' pkg/generated-assets/generated_assets.go
sed -n '78,108p' pkg/operator/starter.go
printf '%s\n' '--- Manila secret template and relevant volume definitions ---'
cat assets/overlays/openstack-manila/base/config_secret.yaml
sed -n '120,145p' assets/overlays/openstack-manila/patches/controller_add_driver.yaml
sed -n '130,147p' assets/overlays/openstack-manila/patches/node_add_driver.yamlRepository: openshift/csi-operator Length of output: 7551 Propagate ConfigMap read errors instead of using an empty CA path. When Keep an absent or empty 🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| return pairs | ||
| } | ||
| return cfg, nil | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Select
FlavourStandaloneexplicitly.Any value other than
generator.FlavourHyperShiftusescloudConfigStandalone. Matchgenerator.FlavourStandaloneexplicitly, and return an error for unsupported values. This prevents an unsupported cluster flavour from silently selecting the standalone ConfigMap.As per coding guidelines, use
FlavourStandalonefor regular OpenShift clusters andFlavourHyperShiftfor hosted control plane clusters in ClusterFlavour configuration.🤖 Prompt for AI Agents
Source: Coding guidelines