Browse Source

update example for ECR token generator (#4773)

With this templating, it will generate an actually usable secret that is of type dockerconfig and in the proper expected format

Signed-off-by: Moulick Aggarwal <15780903+Moulick@users.noreply.github.com>
Co-authored-by: Gustavo Fernandes de Carvalho <17139678+gusfcarvalho@users.noreply.github.com>
Co-authored-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Moulick Aggarwal 11 months ago
parent
commit
5130dcb258
1 changed files with 21 additions and 5 deletions
  1. 21 5
      docs/snippets/generator-ecr-example.yaml

+ 21 - 5
docs/snippets/generator-ecr-example.yaml

@@ -6,9 +6,25 @@ spec:
   refreshInterval: "1h"
   target:
     name: ecr-secret
+    template:
+      type: kubernetes.io/dockerconfigjson
+      metadata:
+        annotations:
+          expiresAt: "{{ .expires_at }}"
+      data:
+        .dockerconfigjson: |
+          {
+            "auths": {
+              "{{ .proxy_endpoint | replace "https://" "" }}": {
+                "username": "{{ .username }}",
+                "password": "{{ .password }}",
+                "auth": "{{ printf "%s:%s" .username .password | b64enc }}"
+              }
+            }
+          }
   dataFrom:
-  - sourceRef:
-      generatorRef:
-        apiVersion: generators.external-secrets.io/v1alpha1
-        kind: ECRAuthorizationToken
-        name: "ecr-gen"
+    - sourceRef:
+        generatorRef:
+          apiVersion: generators.external-secrets.io/v1alpha1
+          kind: ECRAuthorizationToken
+          name: "ecr-gen"