Skip to content

Commit

Permalink
Patch for azure file control plane image
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Feb 8, 2024
1 parent 7083062 commit dc11a17
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
2 changes: 2 additions & 0 deletions manifests/10_deployment-hypershift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ spec:
value: quay.io/openshift/origin-azure-disk-csi-driver-operator:latest
- name: LIVENESS_PROBE_CONTROL_PLANE_IMAGE
value: quay.io/openshift/origin-csi-livenessprobe:latest
- name: AZURE_FILE_DRIVER_CONTROL_PLANE_IMAGE
value: quay.io/openshift/origin-azure-file-csi-driver-operator:latest
image: quay.io/openshift/origin-cluster-storage-operator:latest
imagePullPolicy: IfNotPresent
name: cluster-storage-operator
Expand Down
49 changes: 35 additions & 14 deletions pkg/operator/csidriveroperator/csioperatorclient/azure-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
)

const (
AzureFileDriverName = "file.csi.azure.com"
envAzureFileDriverOperatorImage = "AZURE_FILE_DRIVER_OPERATOR_IMAGE"
envAzureFileDriverImage = "AZURE_FILE_DRIVER_IMAGE"
AzureFileDriverName = "file.csi.azure.com"
envAzureFileDriverOperatorImage = "AZURE_FILE_DRIVER_OPERATOR_IMAGE"
envAzureFileDriverImage = "AZURE_FILE_DRIVER_IMAGE"
envAzureFileDriverControlPlangeImage = "AZURE_FILE_DRIVER_CONTROL_PLANE_IMAGE"
)

func IsNotAzueStackCloud(status *configv1.InfrastructureStatus, isInstalled bool) bool {
Expand All @@ -26,29 +27,49 @@ func IsNotAzueStackCloud(status *configv1.InfrastructureStatus, isInstalled bool
return true
}

func GetAzureFileCSIOperatorConfig() CSIOperatorConfig {
func GetAzureFileCSIOperatorConfig(isHyperShift bool) CSIOperatorConfig {
pairs := []string{
"${OPERATOR_IMAGE}", os.Getenv(envAzureFileDriverOperatorImage),
"${DRIVER_IMAGE}", os.Getenv(envAzureFileDriverImage),
"${CLUSTER_CLOUD_CONTROLLER_MANAGER_OPERATOR_IMAGE}", os.Getenv(envCCMOperatorImage),
"${OPERATOR_IMAGE_VERSION}", os.Getenv(envOperatorImageVersion),
"${DRIVER_CONTROL_PLANE_IMAGE}", os.Getenv(envAzureFileDriverControlPlangeImage),
}

return CSIOperatorConfig{
csiDriverConfig := CSIOperatorConfig{
CSIDriverName: AzureFileDriverName,
ConditionPrefix: "AzureFile",
Platform: configv1.AzurePlatformType,
StatusFilter: IsNotAzueStackCloud,
StaticAssets: []string{
"csidriveroperators/azure-file/03_sa.yaml",
"csidriveroperators/azure-file/04_role.yaml",
"csidriveroperators/azure-file/05_rolebinding.yaml",
"csidriveroperators/azure-file/06_clusterrole.yaml",
"csidriveroperators/azure-file/07_clusterrolebinding.yaml",
},
CRAsset: "csidriveroperators/azure-file/09_cr.yaml",
DeploymentAsset: "csidriveroperators/azure-file/08_deployment.yaml",
ImageReplacer: strings.NewReplacer(pairs...),
AllowDisabled: false,
}

if !isHyperShift {
csiDriverConfig.StaticAssets = []string{
"csidriveroperators/azure-file/standalone/generated/v1_serviceaccount_azure-file-csi-driver-operator.yaml",
"csidriveroperators/azure-file/standalone/generated/rbac.authorization.k8s.io_v1_role_azure-file-csi-driver-operator-role.yaml",
"csidriveroperators/azure-file/standalone/generated/rbac.authorization.k8s.io_v1_rolebinding_azure-file-csi-driver-operator-rolebinding.yaml",
"csidriveroperators/azure-file/standalone/generated/rbac.authorization.k8s.io_v1_clusterrole_azure-file-csi-driver-operator-clusterrole.yaml",
"csidriveroperators/azure-file/standalone/generated/rbac.authorization.k8s.io_v1_clusterrolebinding_azure-file-csi-driver-operator-clusterrolebinding.yaml",
}
csiDriverConfig.DeploymentAsset = "csidriveroperators/azure-file/standalone/generated/apps_v1_deployment_azure-file-csi-driver-operator.yaml"
csiDriverConfig.CRAsset = "csidriveroperators/azure-file/standalone/generated/operator.openshift.io_v1_clustercsidriver_file.csi.azure.com.yaml"
} else {
csiDriverConfig.StaticAssets = []string{
"csidriveroperators/azure-file/hypershift/guest/generated/rbac.authorization.k8s.io_v1_clusterrole_azure-file-csi-driver-operator-clusterrole.yaml",
"csidriveroperators/azure-file/hypershift/guest/generated/rbac.authorization.k8s.io_v1_clusterrolebinding_azure-file-csi-driver-operator-clusterrolebinding.yaml",
"csidriveroperators/azure-file/hypershift/guest/generated/rbac.authorization.k8s.io_v1_role_azure-file-csi-driver-operator-role.yaml",
"csidriveroperators/azure-file/hypershift/guest/generated/rbac.authorization.k8s.io_v1_rolebinding_azure-file-csi-driver-operator-rolebinding.yaml",
"csidriveroperators/azure-file/hypershift/guest/generated/v1_serviceaccount_azure-file-csi-driver-operator.yaml",
}
csiDriverConfig.MgmtStaticAssets = []string{
"csidriveroperators/azure-file/hypershift/mgmt/generated/rbac.authorization.k8s.io_v1_role_azure-file-csi-driver-operator-role.yaml",
"csidriveroperators/azure-file/hypershift/mgmt/generated/rbac.authorization.k8s.io_v1_rolebinding_azure-file-csi-driver-operator-rolebinding.yaml",
"csidriveroperators/azure-file/hypershift/mgmt/generated/v1_serviceaccount_azure-file-csi-driver-operator.yaml",
}
csiDriverConfig.DeploymentAsset = "csidriveroperators/azure-file/hypershift/mgmt/generated/apps_v1_deployment_azure-file-csi-driver-operator.yaml"
csiDriverConfig.CRAsset = "csidriveroperators/azure-file/hypershift/guest/generated/operator.openshift.io_v1_clustercsidriver_file.csi.azure.com.yaml"
}
return csiDriverConfig
}
5 changes: 5 additions & 0 deletions profile-patches/hypershift/10_deployment.yaml-patch
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
value:
name: LIVENESS_PROBE_CONTROL_PLANE_IMAGE
value: quay.io/openshift/origin-csi-livenessprobe:latest
- op: add
path: /spec/template/spec/containers/0/env/40
value:
name: AZURE_FILE_DRIVER_CONTROL_PLANE_IMAGE
value: quay.io/openshift/origin-azure-file-csi-driver-operator:latest
# Add cmdline args
- op: add
path: /spec/template/spec/containers/0/args/-
Expand Down

0 comments on commit dc11a17

Please sign in to comment.