Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement var substitution from ConfigMaps and Secrets #275

Merged
merged 2 commits into from
Feb 16, 2021

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Feb 16, 2021

This PR adds an array field called substituteFrom to the post build API. SubstituteFrom holds references to ConfigMaps and Secrets containing the variables (data keys) and their values (data values) to be substituted in the YAML manifests.

You can disable the variable substitution for certain resources by either labeling or annotating them with:

kustomize.toolkit.fluxcd.io/substitute: disabled

Example:

apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
  name: apps
spec:
  interval: 5m
  path: "./apps/"
  postBuild:
    substitute:
      cluster_env: "prod"
      cluster_region: "eu-central-1"
    substituteFrom:
      - kind: ConfigMap
        name: cluster-vars
      - kind: Secret
        name: cluster-secret-vars

Fix: #274
Followup: #253

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan added the area/varsub Post-build variable substitution related issues and pull requests label Feb 16, 2021
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan merged commit 5f966d0 into main Feb 16, 2021
@stefanprodan stefanprodan deleted the substitute-from branch February 16, 2021 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/varsub Post-build variable substitution related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add substituteFrom from ConfigMap or Secret
2 participants