From 15515e155ff084b7d512debe8c9ba8f54f38f964 Mon Sep 17 00:00:00 2001 From: shirady <57721533+shirady@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:08:54 +0300 Subject: [PATCH 1/3] add flag app-namespace to command obc regenerate 1. add flag app-namespace to command obc regenerate 2. rename ob name to ob-%s-%s instead of obs-%s-%s 3. fix a couple of typos Signed-off-by: shirady <57721533+shirady@users.noreply.github.com> (cherry picked from commit 1338f0c29ad4cc5e7d4821741277ff7aced68a48) Signed-off-by: Danny Zaken --- pkg/noobaaaccount/noobaaaccount.go | 4 ++-- pkg/obc/obc.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/noobaaaccount/noobaaaccount.go b/pkg/noobaaaccount/noobaaaccount.go index f05d7b6e7..2f8db4d12 100644 --- a/pkg/noobaaaccount/noobaaaccount.go +++ b/pkg/noobaaaccount/noobaaaccount.go @@ -551,7 +551,7 @@ func GenerateAccountKeys(name string) error { secret.StringData["AWS_ACCESS_KEY_ID"] = accessKeys.AccessKey secret.StringData["AWS_SECRET_ACCESS_KEY"] = accessKeys.SecretKey - //If we will not be able to update the secret we will print the credentials as they allready been changed by the RPC + // If we will not be able to update the secret we will print the credentials as they already been changed by the RPC if !util.KubeUpdate(secret) { log.Printf(`❌ Please write the new credentials for account %s:`, name) fmt.Printf("\nAWS_ACCESS_KEY_ID : %s\n", accessKeys.AccessKey) @@ -559,7 +559,7 @@ func GenerateAccountKeys(name string) error { log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name) } - log.Printf("✅ Successfully reganerate s3 credentials for the account %q", name) + log.Printf("✅ Successfully regenerate s3 credentials for the account %q", name) return nil } diff --git a/pkg/obc/obc.go b/pkg/obc/obc.go index 6651b8715..25fa8ab56 100644 --- a/pkg/obc/obc.go +++ b/pkg/obc/obc.go @@ -66,6 +66,8 @@ func CmdRegenerate() *cobra.Command { Short: "Regenerate OBC S3 Credentials", Run: RunRegenerate, } + cmd.Flags().String("app-namespace", "", + "Set the namespace of the application where the OBC should be regenerated") return cmd } @@ -77,7 +79,7 @@ func CmdDelete() *cobra.Command { Run: RunDelete, } cmd.Flags().String("app-namespace", "", - "Set the namespace of the application where the OBC should be created") + "Set the namespace of the application where the OBC should be deleted") return cmd } @@ -247,7 +249,7 @@ func RunRegenerate(cmd *cobra.Command, args []string) { if obc.Spec.ObjectBucketName != "" { ob.Name = obc.Spec.ObjectBucketName } else { - ob.Name = fmt.Sprintf("obc-%s-%s", appNamespace, name) + ob.Name = fmt.Sprintf("ob-%s-%s", appNamespace, name) } if !util.KubeCheck(ob) { @@ -564,6 +566,6 @@ func GenerateAccountKeys(name string, accountName string) error { log.Fatalf(`❌ Failed to update the secret %s with the new accessKeys`, secret.Name) } - log.Printf("✅ Successfully reganerate s3 credentials for the OBC %q", name) + log.Printf("✅ Successfully regenerate s3 credentials for the OBC %q", name) return nil } From ceaba804bddbf82b2d00ed5feaf13b8e050dd4ef Mon Sep 17 00:00:00 2001 From: shirady <57721533+shirady@users.noreply.github.com> Date: Sun, 22 Oct 2023 10:16:42 +0300 Subject: [PATCH 2/3] use appNamespace instead of options.Namespace for secret namespace (obc regenerate) Signed-off-by: shirady <57721533+shirady@users.noreply.github.com> (cherry picked from commit 560a17c655ddd32360cd7fd54a8c68f91d3d7f36) Signed-off-by: Danny Zaken --- pkg/obc/obc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/obc/obc.go b/pkg/obc/obc.go index 25fa8ab56..81d2e9a77 100644 --- a/pkg/obc/obc.go +++ b/pkg/obc/obc.go @@ -258,7 +258,7 @@ func RunRegenerate(cmd *cobra.Command, args []string) { accountName := ob.Spec.AdditionalState["account"] - err := GenerateAccountKeys(name, accountName) + err := GenerateAccountKeys(name, accountName, appNamespace) if err != nil { log.Fatalf(`❌ Could not regenerate credentials for %q: %v`, name, err) } @@ -515,7 +515,7 @@ func CheckPhase(obc *nbv1.ObjectBucketClaim) { } // GenerateAccountKeys regenerate noobaa OBC account S3 keys -func GenerateAccountKeys(name string, accountName string) error { +func GenerateAccountKeys(name, accountName, appNamespace string) error { log := util.Logger() if accountName == "" { @@ -531,7 +531,7 @@ func GenerateAccountKeys(name string, accountName string) error { // Checking that we can find the secret before we are calling the RPC to change the credentials. secret := util.KubeObject(bundle.File_deploy_internal_secret_empty_yaml).(*corev1.Secret) - secret.Namespace = options.Namespace + secret.Namespace = appNamespace secret.Name = name if !util.KubeCheckQuiet(secret) { log.Fatalf(`❌ Could not find secret: %s, will not regenerate keys.`, secret.Name) From a44227968e35968ff8ec7b06c9d5a8f2e5f8c004 Mon Sep 17 00:00:00 2001 From: Danny Zaken Date: Tue, 26 Dec 2023 14:45:10 +0200 Subject: [PATCH 3/3] use go1.18 in and update lint in ci workflows Signed-off-by: Danny Zaken --- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/run_ci.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 19ccee824..23bf4f2a6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,7 +12,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.52.2 + version: v1.55.2 # Optional: if set to true then the all caching functionality will be complete disabled, # takes precedence over all other caching options. diff --git a/.github/workflows/run_ci.yml b/.github/workflows/run_ci.yml index 7fe2b1e2c..fe32a2d13 100644 --- a/.github/workflows/run_ci.yml +++ b/.github/workflows/run_ci.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.18" - name: Deploy Dependencies id: deploy @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.18" - name: Deploy Dependencies id: deploy @@ -77,7 +77,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.18" - name: Deploy Dependencies id: deploy