Browse Source

Fix typo privatKey in multiple files (#3578)

* Update generators.external-secrets.io_githubaccesstokens.yaml

Fixes https://github.com/external-secrets/external-secrets/issues/3556

Signed-off-by: Idan Adar <iadar@il.ibm.com>

* Update generator_github.go

Signed-off-by: Idan Adar <iadar@il.ibm.com>

* Update github.go

Signed-off-by: Idan Adar <iadar@il.ibm.com>

* Update generator-github.yaml

Signed-off-by: Idan Adar <iadar@il.ibm.com>

* Update github_test.go

Signed-off-by: Idan Adar <iadar@il.ibm.com>

* fix: rename property

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>

---------

Signed-off-by: Idan Adar <iadar@il.ibm.com>
Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
Co-authored-by: Moritz Johner <beller.moritz@googlemail.com>
Idan Adar 1 year ago
parent
commit
e13e09413e

+ 1 - 1
apis/generators/v1alpha1/generator_github.go

@@ -30,7 +30,7 @@ type GithubAccessTokenSpec struct {
 }
 
 type GithubAuth struct {
-	PrivatKey GithubSecretRef `json:"privatKey"`
+	PrivateKey GithubSecretRef `json:"privateKey"`
 }
 
 type GithubSecretRef struct {

+ 1 - 1
apis/generators/v1alpha1/zz_generated.deepcopy.go

@@ -643,7 +643,7 @@ func (in *GithubAccessTokenSpec) DeepCopy() *GithubAccessTokenSpec {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *GithubAuth) DeepCopyInto(out *GithubAuth) {
 	*out = *in
-	in.PrivatKey.DeepCopyInto(&out.PrivatKey)
+	in.PrivateKey.DeepCopyInto(&out.PrivateKey)
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GithubAuth.

+ 2 - 2
config/crds/bases/generators.external-secrets.io_githubaccesstokens.yaml

@@ -48,7 +48,7 @@ spec:
               auth:
                 description: Auth configures how ESO authenticates with a Github instance.
                 properties:
-                  privatKey:
+                  privateKey:
                     properties:
                       secretRef:
                         description: |-
@@ -74,7 +74,7 @@ spec:
                     - secretRef
                     type: object
                 required:
-                - privatKey
+                - privateKey
                 type: object
               installID:
                 type: string

+ 2 - 2
deploy/crds/bundle.yaml

@@ -11066,7 +11066,7 @@ spec:
                 auth:
                   description: Auth configures how ESO authenticates with a Github instance.
                   properties:
-                    privatKey:
+                    privateKey:
                       properties:
                         secretRef:
                           description: |-
@@ -11091,7 +11091,7 @@ spec:
                         - secretRef
                       type: object
                   required:
-                    - privatKey
+                    - privateKey
                   type: object
                 installID:
                   type: string

+ 1 - 1
docs/snippets/generator-github.yaml

@@ -14,7 +14,7 @@ spec:
   installID: "00000000" # (5)
   url: "" # (Default https://api.github.com.)
   auth:
-    privatKey:
+    privateKey:
       secretRef:
         name: github-app-pem # (2)
         key: key

+ 2 - 2
pkg/generator/github/github.go

@@ -127,11 +127,11 @@ func newGHClient(ctx context.Context, k client.Client, n string, hc *http.Client
 		gh.URL = res.Spec.URL + ghPath
 	}
 	secret := &corev1.Secret{}
-	if err := gh.Kube.Get(ctx, client.ObjectKey{Name: res.Spec.Auth.PrivatKey.SecretRef.Name, Namespace: n}, secret); err != nil {
+	if err := gh.Kube.Get(ctx, client.ObjectKey{Name: res.Spec.Auth.PrivateKey.SecretRef.Name, Namespace: n}, secret); err != nil {
 		return nil, fmt.Errorf("error getting GH pem from secret:%w", err)
 	}
 
-	pk, err := jwt.ParseRSAPrivateKeyFromPEM(secret.Data[res.Spec.Auth.PrivatKey.SecretRef.Key])
+	pk, err := jwt.ParseRSAPrivateKeyFromPEM(secret.Data[res.Spec.Auth.PrivateKey.SecretRef.Key])
 	if err != nil {
 		return nil, fmt.Errorf("error parsing RSA private key: %w", err)
 	}

+ 4 - 4
pkg/generator/github/github_test.go

@@ -54,7 +54,7 @@ func TestGenerate(t *testing.T) {
 		namespace string
 	}
 	pem, err := os.ReadFile(tstCrtName)
-	assert.NoError(t, err, "Should not error when reading privatKey")
+	assert.NoError(t, err, "Should not error when reading privateKey")
 
 	validResponce := []byte(`{
 		"token": "ghs_16C7e42F292c6912E7710c838347Ae178B4a",
@@ -93,7 +93,7 @@ func TestGenerate(t *testing.T) {
 						Namespace: "foo",
 					},
 					Data: map[string][]byte{
-						"privatKey": pem,
+						"privateKey": pem,
 					},
 				}).Build(),
 				jsonSpec: &apiextensions.JSON{
@@ -104,11 +104,11 @@ spec:
   installID: "00000000"
   URL: %q
   auth:
-    privatKey:
+    privateKey:
       secretRef:
         name: "testName"
         namespace: "foo"
-        key: "privatKey"`, server.URL)),
+        key: "privateKey"`, server.URL)),
 				},
 			},
 			want: map[string][]byte{