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

How to override JCasC per environment using Kustomize - difficult due to one big jcasc string #1025

Open
HariSekhon opened this issue Feb 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@HariSekhon
Copy link

Is your feature request related to a problem? Please describe

I need to override the NFS server volume to be different in 3 environments: dev, staging and production

I used Kustomize in a standard base vs overlays layout where each of the dev / staging / production directories inherits from base which contains the helm chart and values.yaml and then just overrides specific bits of the generated yaml

This works well for many applications, I've been doing this for years, as you can see here:

https://github.com/HariSekhon/Kubernetes-configs

Unfortunately the Jenkins JCasC configuration doesn't lend itself to standard Kustomize patching because it's one huge ugly string with embedded literal newlines as described in #1024

This means that it cannot be traversed in Kustomize yaml patch overrides to replace individual JCasC fields

Describe the solution you'd like

I'm not sure if I'm missing something obvious here but I think the problem is that Kustomize cannot traverse a big string field

I'm not sure if this could be rewritten to be actual subfields and recomposed into the yaml file the kiwi sidecar is expecting or if that would require changing or replacing the kiwi sidecar

Tbh I'd like some feedback on this as a more granular alternative to the workaround I've done as shown below:

Describe alternatives you've considered

I've considered just having a separate values.yaml, but this would be duplicating hundreds of lines of values.yaml for the same of 4 lines of NFS config and would be more prone to errors and configuration drift over time, which is why I put it in base and only override a few lines here and there.

I've taken the lesser of two evils and forked the JCasC config to its own configmap patch which is much fewer lines of dupliction between environments

I've ended up wholesale patch replacing the jcasc-default-config.yaml field like this:

https://github.com/HariSekhon/Kubernetes-configs/blob/master/jenkins/overlay/kustomization.yaml

https://github.com/HariSekhon/Kubernetes-configs/blob/master/jenkins/overlay/jcasc-cm.patch.yaml

Additional context

No response

@HariSekhon HariSekhon added the enhancement New feature or request label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant