1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-15 17:51:01 +00:00
external-secrets/docs/provider-gitlab-project-variables.md
Gustavo Carvalho 696a9e9c92 Adding notes on configuring ClusterSecretStores for every provider
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
2022-02-03 08:39:46 -03:00

1.9 KiB

Gitlab Project Variables

External Secrets Operator integrates with Gitlab API to sync Gitlab project variables to secrets held on the Kubernetes cluster.

Authentication

The API requires an access token and project ID. To create a new access token, go to your user settings and select 'access tokens'. Give your token a name, expiration date, and select the permissions required (Note 'api' is required).

token-details

Click 'Create personal access token', and your token will be generated and displayed on screen. Copy or save this token since you can't access it again. token-created

Access Token secret

Create a secret containing your access token:

{% include 'gitlab-credentials-secret.yaml' %}

Update secret store

Be sure the gitlab provider is listed in the Kind=SecretStore and the ProjectID is set. If you are not using https://gitlab.com, you must set the url field as well.

{% include 'gitlab-secret-store.yaml' %}

NOTE: In case of a ClusterSecretStore, Be sure to provide namespace in accessToken with the namespace where the secret resides.

Your project ID can be found on your project's page. projectID

Creating external secret

To sync a Gitlab variable to a secret on the Kubernetes cluster, a Kind=ExternalSecret is needed.

{% include 'gitlab-external-secret.yaml' %}

Using DataFrom

DataFrom can be used to get a variable as a JSON string and attempt to parse it.

{% include 'gitlab-external-secret-json.yaml' %}

Getting the Kubernetes secret

The operator will fetch the project variable and inject it as a Kind=Secret.

kubectl get secret gitlab-secret-to-create -o jsonpath='{.data.secretKey}' | base64 -d