diff --git a/charts/etcd-copy-backups/templates/etcd-copy-backups-job.yaml b/charts/etcd-copy-backups/templates/etcd-copy-backups-job.yaml index ec39644ba..c629f6262 100644 --- a/charts/etcd-copy-backups/templates/etcd-copy-backups-job.yaml +++ b/charts/etcd-copy-backups/templates/etcd-copy-backups-job.yaml @@ -87,6 +87,9 @@ spec: {{- else if eq .Values.targetStore.storageProvider "Swift" }} - name: OPENSTACK_APPLICATION_CREDENTIALS value: "/root/etcd-backup" +{{- else if eq .Values.targetStore.storageProvider "OCS" }} + - name: OPENSHIFT_APPLICATION_CREDENTIALS + value: "/root/etcd-backup" {{- else if eq .Values.targetStore.storageProvider "OSS" }} - name: ALICLOUD_APPLICATION_CREDENTIALS value: "/root/etcd-backup" @@ -103,6 +106,9 @@ spec: {{- else if eq .Values.sourceStore.storageProvider "Swift" }} - name: SOURCE_OPENSTACK_APPLICATION_CREDENTIALS value: "/root/source-etcd-backup" +{{- else if eq .Values.sourceStore.storageProvider "OCS" }} + - name: SOURCE_OPENSHIFT_APPLICATION_CREDENTIALS + value: "/root/source-etcd-backup" {{- else if eq .Values.sourceStore.storageProvider "OSS" }} - name: SOURCE_ALICLOUD_APPLICATION_CREDENTIALS value: "/root/source-etcd-backup" @@ -155,6 +161,14 @@ spec: {{- if eq .Values.sourceStore.storageProvider "Swift" }} - name: source-etcd-backup mountPath: "/root/source-etcd-backup" +{{- end }} +{{- if eq .Values.targetStore.storageProvider "OCS" }} + - name: etcd-backup + mountPath: "/root/etcd-backup" +{{- end }} +{{- if eq .Values.sourceStore.storageProvider "OCS" }} + - name: source-etcd-backup + mountPath: "/root/source-etcd-backup" {{- end }} volumes: {{- if eq .Values.targetStore.storageProvider "Local" }} @@ -218,4 +232,14 @@ spec: - name: source-etcd-backup secret: secretName: {{ .Values.sourceStore.storeSecret }} +{{- end }} +{{- if eq .Values.targetStore.storageProvider "OCS" }} + - name: etcd-backup + secret: + secretName: {{ .Values.targetStore.storeSecret }} +{{- end }} +{{- if eq .Values.sourceStore.storageProvider "OCS" }} + - name: source-etcd-backup + secret: + secretName: {{ .Values.sourceStore.storeSecret }} {{- end }} \ No newline at end of file diff --git a/charts/etcd/templates/etcd-statefulset.yaml b/charts/etcd/templates/etcd-statefulset.yaml index f6f23d8cc..dfa0b90d6 100644 --- a/charts/etcd/templates/etcd-statefulset.yaml +++ b/charts/etcd/templates/etcd-statefulset.yaml @@ -278,6 +278,9 @@ spec: {{- else if eq .Values.store.storageProvider "OSS" }} - name: "ALICLOUD_APPLICATION_CREDENTIALS" value: "/root/etcd-backup" +{{- else if eq .Values.store.storageProvider "OCS" }} + - name: OPENSHIFT_APPLICATION_CREDENTIALS + value: "/root/etcd-backup" {{- else if eq .Values.store.storageProvider "ECS" }} - name: "ECS_ENDPOINT" valueFrom: @@ -294,39 +297,6 @@ spec: secretKeyRef: name: {{ .Values.store.storeSecret }} key: "secretAccessKey" -{{- else if eq .Values.store.storageProvider "OCS" }} - - name: "OCS_ENDPOINT" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "endpoint" - - name: "OCS_ACCESS_KEY_ID" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "accessKeyID" - - name: "OCS_SECRET_ACCESS_KEY" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "secretAccessKey" - - name: "OCS_REGION" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "region" - - name: "OCS_DISABLE_SSL" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "disableSSL" - optional: true - - name: "OCS_INSECURE_SKIP_VERIFY" - valueFrom: - secretKeyRef: - name: {{ .Values.store.storeSecret }} - key: "insecureSkipVerify" - optional: true {{- end }} volumeMounts: {{- if eq .Values.store.storageProvider "Local" }} @@ -367,6 +337,10 @@ spec: - name: etcd-backup mountPath: "/root/etcd-backup" {{- end }} +{{- if eq .Values.store.storageProvider "OCS" }} + - name: etcd-backup + mountPath: "/root/etcd-backup" +{{- end }} {{- if eq .Values.store.storageProvider "Swift" }} - name: etcd-backup mountPath: "/root/etcd-backup" @@ -429,6 +403,11 @@ spec: secret: secretName: {{ .Values.store.storeSecret }} {{- end }} +{{- if eq .Values.store.storageProvider "OCS" }} + - name: etcd-backup + secret: + secretName: {{ .Values.store.storeSecret }} +{{- end }} {{- if eq .Values.store.storageProvider "Swift" }} - name: etcd-backup secret: diff --git a/controllers/compaction_lease_controller.go b/controllers/compaction_lease_controller.go index 563912947..66aa48039 100644 --- a/controllers/compaction_lease_controller.go +++ b/controllers/compaction_lease_controller.go @@ -358,7 +358,7 @@ func getCmpctJobVolumeMounts(etcd *druidv1alpha1.Etcd, logger logr.Logger) []v1. Name: "etcd-backup", MountPath: "/root/.gcp/", }) - } else if provider == "S3" || provider == "ABS" || provider == "OSS" || provider == "Swift" { + } else if provider == "S3" || provider == "ABS" || provider == "OSS" || provider == "Swift" || provider == "OCS" { vms = append(vms, v1.VolumeMount{ Name: "etcd-backup", MountPath: "/root/etcd-backup/", @@ -389,7 +389,7 @@ func getCmpctJobVolumes(etcd *druidv1alpha1.Etcd, logger logr.Logger) []v1.Volum return vs } - if provider == "GCS" || provider == "S3" || provider == "OSS" || provider == "ABS" || provider == "Swift" { + if provider == "GCS" || provider == "S3" || provider == "OSS" || provider == "ABS" || provider == "Swift" || provider == "OCS" { vs = append(vs, v1.Volume{ Name: "etcd-backup", VolumeSource: v1.VolumeSource{ @@ -447,12 +447,7 @@ func getCmpctJobEnvVar(etcd *druidv1alpha1.Etcd, logger logr.Logger) []v1.EnvVar } if provider == "OCS" { - env = append(env, getEnvVarFromSecrets("OCS_ENDPOINT", storeValues.SecretRef.Name, "endpoint")) - env = append(env, getEnvVarFromSecrets("OCS_ACCESS_KEY_ID", storeValues.SecretRef.Name, "accessKeyID")) - env = append(env, getEnvVarFromSecrets("OCS_SECRET_ACCESS_KEY", storeValues.SecretRef.Name, "secretAccessKey")) - env = append(env, getEnvVarFromSecrets("OCS_REGION", storeValues.SecretRef.Name, "region")) - env = append(env, getEnvVarFromSecrets("OCS_DISABLE_SSL", storeValues.SecretRef.Name, "disableSSL")) - env = append(env, getEnvVarFromSecrets("OCS_INSECURE_SKIP_VERIFY", storeValues.SecretRef.Name, "insecureSkipVerify")) + env = append(env, getEnvVarFromValues("OPENSHIFT_APPLICATION_CREDENTIALS", "/root/etcd-backup")) } return env diff --git a/controllers/etcdcopybackupstask_controller_test.go b/controllers/etcdcopybackupstask_controller_test.go index ca4d7c0fc..faadc219b 100644 --- a/controllers/etcdcopybackupstask_controller_test.go +++ b/controllers/etcdcopybackupstask_controller_test.go @@ -364,6 +364,13 @@ func getProviderEnvElements(storeProvider, prefix, volumePrefix string, store *d "Value": Equal(fmt.Sprintf("/root/%setcd-backup", volumePrefix)), }), } + case "OCS": + return Elements{ + prefix + "OPENSHIFT_APPLICATION_CREDENTIALS": MatchFields(IgnoreExtras, Fields{ + "Name": Equal(prefix + "OPENSHIFT_APPLICATION_CREDENTIALS"), + "Value": Equal(fmt.Sprintf("/root/%setcd-backup", volumePrefix)), + }), + } default: return nil }