Skip to content

Commit

Permalink
pass region in analyze resource
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Aug 22, 2023
1 parent 020baa4 commit c4f9690
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions deploy/job_analyze_resource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
- name: RESOURCE_NAME
- name: BUCKET
- name: ENDPOINT
- name: REGION
- name: S3_SIGNATURE_VERSION
- name: HTTP_PROXY
- name: HTTPS_PROXY
Expand Down
3 changes: 2 additions & 1 deletion pkg/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5051,7 +5051,7 @@ const File_deploy_internal_text_system_status_readme_rejected_tmpl = `
NooBaa Operator Version: {{.OperatorVersion}}
`

const Sha256_deploy_job_analyze_resource_yml = "a171cf51d8c8561de04d921fbccb43b87f25daadd86211900765a4cf1ae080a5"
const Sha256_deploy_job_analyze_resource_yml = "c80810baeda94fd9dd97a6c62241be5c582e08009bdbb1f2a13992c99d90ea33"

const File_deploy_job_analyze_resource_yml = `apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -5080,6 +5080,7 @@ spec:
- name: RESOURCE_NAME
- name: BUCKET
- name: ENDPOINT
- name: REGION
- name: S3_SIGNATURE_VERSION
- name: HTTP_PROXY
- name: HTTPS_PROXY
Expand Down
20 changes: 20 additions & 0 deletions pkg/diagnostics/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ func setBackingStoreDetailsInJob(backingStore *nbv1.BackingStore, cmd *cobra.Com
backingStore.Kind, backingStore.Name, backingStore.Namespace)
}

// in case it is aws endpoint, we would pass the region
if backingStore.Spec.Type == nbv1.StoreTypeAWSS3 {
region := util.GetEnvVariable(&analyzeResourceJob.Spec.Template.Spec.Containers[0].Env, "REGION")
if region == nil {
log.Fatalf("❌ Could not get region in %s %q in Namespace %q",
analyzeResourceJob.Kind, analyzeResourceJob.Name, analyzeResourceJob.Namespace)
}
region.Value = backingStore.Spec.AWSS3.Region
}

// signature version
signatureVersion := util.GetEnvVariable(&analyzeResourceJob.Spec.Template.Spec.Containers[0].Env, "S3_SIGNATURE_VERSION")
if signatureVersion == nil {
Expand Down Expand Up @@ -338,6 +348,16 @@ func setNamespacetoreDetailsInJob(namespaceStore *nbv1.NamespaceStore, cmd *cobr
namespaceStore.Kind, namespaceStore.Name, namespaceStore.Namespace)
}

// in case it is aws endpoint, we would pass the region
if namespaceStore.Spec.Type == nbv1.NSStoreTypeAWSS3 {
region := util.GetEnvVariable(&analyzeResourceJob.Spec.Template.Spec.Containers[0].Env, "REGION")
if region == nil {
log.Fatalf("❌ Could not get region in %s %q in Namespace %q",
analyzeResourceJob.Kind, analyzeResourceJob.Name, analyzeResourceJob.Namespace)
}
region.Value = namespaceStore.Spec.AWSS3.Region
}

// signature version
signatureVersion := util.GetEnvVariable(&analyzeResourceJob.Spec.Template.Spec.Containers[0].Env, "S3_SIGNATURE_VERSION")
if signatureVersion == nil {
Expand Down

0 comments on commit c4f9690

Please sign in to comment.