Browse Source

Merge pull request #264 from external-secrets/docs/all-keys-one-secret

docs: adding docs for dataFrom example
paul-the-alien[bot] 4 years ago
parent
commit
083c7feeec

+ 27 - 0
docs/guides-all-keys-one-secret.md

@@ -0,0 +1,27 @@
+# All Keys, One Secret
+
+To get multiple key-values from an external secret, not having to worry about how many, or what these keys are, we have to use the dataFrom field of the ExternalSecret resource, instead of the data field. We will give an example here with the gcp provider (should work with other providers in the same way).
+
+Please follow the authentication and SecretStore steps of the [Google Cloud Secrets Manager guide](provider-google-secrets-manager.md) to setup access to your google cloud account first.
+
+Then create a secret in Google Cloud Secret Manager that contains a JSON string with multiple key values like this:
+
+![secret-value](./pictures/screenshot_json_string_gcp_secret_value.png)
+
+Let's call this secret all-keys-example-secret on Google Cloud.
+
+
+### Creating dataFrom external secret
+
+Now, when creating our ExternalSecret resource, instead of using the data field, we use the dataFrom field:
+
+```yaml
+{% include 'gcpsm-data-from-external-secret.yaml' %}
+```
+
+To check both values we can run:
+
+```
+kubectl get secret secret-to-be-created -n <namespace> | -o jsonpath='{.data.username}' | base64 -d
+kubectl get secret secret-to-be-created -n <namespace> | -o jsonpath='{.data.surname}' | base64 -d
+```

BIN
docs/pictures/screenshot_json_string_gcp_secret_value.png


+ 14 - 0
docs/snippets/gcpsm-data-from-external-secret.yaml

@@ -0,0 +1,14 @@
+apiVersion: external-secrets.io/v1alpha1
+kind: ExternalSecret
+metadata:
+  name: example
+spec:
+  refreshInterval: 1h           # rate SecretManager pulls GCPSM
+  secretStoreRef:
+    kind: SecretStore
+    name: example               # name of the SecretStore (or kind specified)
+  target:
+    name: secret-to-be-created  # name of the k8s Secret to be created
+    creationPolicy: Owner
+  dataFrom:
+  - key: all-keys-example-secret  # name of the GCPSM secret

+ 1 - 0
hack/api-docs/mkdocs.yml

@@ -31,6 +31,7 @@ nav:
     - Introduction: guides-introduction.md
     - Getting started: guides-getting-started.md
     - Advanced Templating: guides-templating.md
+    - All keys, One secret: guides-all-keys-one-secret.md
     - Multi Tenancy: guides-multi-tenancy.md
     - Metrics: guides-metrics.md
   - Provider: