For CI/CD purposes, the project is maintaining 2 kustomization.yaml files
Regular deployments - kustomization_deploy.yaml
Rollback deployment - kustomization_rollback.yaml
To run kustomize build, a file with the name "kustomization.yaml" is required in the current directory.
If the project wants to use kustomization_rollback.yaml and NOT kustomization.yaml, how is this possible? Does kustomize accept file name as an argument? Docs do not specify anything on this.
Currently there is no possibility to change the behavior of kustomize to support other file names (by using precompiled binaries) than:
kustomization.yaml
kustomization.yml
Kustomization
All of the below cases will produce the same error output:
kubectl kustomize dir/
kubectl apply -k dir/
kustomize build dir/
Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'FULL_PATH/dir'
Depending on the CI/CD platform/solution/tool you should try other way around like for example:
split the Deployment into 2 directories kustomization_deploy/kustomization_rollback with kustomization.yaml
As a side note!
File names that kustomize uses are placed in the:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/constants/constants.go
// Package constants holds global constants for the kustomize tool.
package constants
// KustomizationFileNames is a list of filenames that can be recognized and consumbed
// by Kustomize.
// In each directory, Kustomize searches for file with the name in this list.
// Only one match is allowed.
var KustomizationFileNames = []string{
"kustomization.yaml",
"kustomization.yml",
"Kustomization",
}
The logic behind choosing the Kustomization file is placed in:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go
Additional reference:
Github.com: Kubernetes-sigs: Kustomize
Kubernetes.io: Docs: Tasks: Manage kubernetes objects: Kustomization
Related
how do I source this file which is in another repo. here is the GitHub action workflow example which is used in another project. I used the same code, its complaining that "file is not found"
run: |
# Setting up cluster configurations, config files are in the kubectl image
# https://github.com /kube-apps/tree/master/kubectl
source /gke/gke-clusters.config
source /aks/aks-clusters.config
Just add the full path to the source lines.
run: |
# Setting up cluster configurations, config files are in the kubectl image
# https://github.com/kube-apps/tree/master/kubectl
source https://github.com/ /kube-apps/tree/master/kubectl/gke-clusters.config
source https://github.com /kube-apps/tree/master/kubectl/aks-clusters.config
I try to my custom chart's values.yaml change with overridevalue.yaml to override values. However when I install the chart with helm repo add command and try to reach values yaml it throws me "values.yaml does not exist in ".".
Helm automatically uses values.yaml file from chart's root directory.
you can pass additional values or override existing ones by passing the file during installation:
$ helm install -f override_values.yaml app ./app
you can pass multiple -f <values_yaml> .. ... The priority will be given to the last (right-most) file specified for overriding existing values.
Currently I do this:
configMapGenerator:
- name: sql-config-map
files:
- "someDirectory/one.sql"
- "someDirectory/two.sql"
- "someDirectory/three.sql"
and I would like to do sth. like this:
configMapGenerator:
- name: sql-config-map
files:
- "someDirectory/*.sql"
Is this somehow possible?
Nope.
See discussion around that feature in comment on "configMapGenerator should allow directories as input"
The main reason:
To move towards explicit dependency declaration, we're moving away from allowing globs in the kustomization file
This command works fine and will edit your kustomization.yaml:
kustomize edit add configmap my-configmap --from-file="$PWD/my-files/*"
The my-files directory has to be in the same folder that the kustomization.yaml file.
I have ~20 yamls in my helm chart + tons of dependencies and I want to check the rendered output of the specific one. helm template renders all yamls and produces a hundred lines of code. Is there a way (it would be nice to have even a regex) to render only selected template (by a file or eg. a name).
From helm template documentation
-s, --show-only stringArray only show manifests rendered from the given templates
For rendering only one resource use helm template -s templates/deployment.yaml .
If you have multiple charts in one directory:
|helm-charts
|-chart1
|--templates
|---deployment.yaml
|--values.yaml
|--Chart.yaml
|...
|- chart2
If you want to generate only one file e.g. chart1/deployment.yaml using values from file chart1/values.yaml follow these steps:
Enter to the chart folder:
cd chart1
Run this command:
helm template . --values values.yaml -s templates/deployment.yaml --name-template myReleaseName > chart1-deployment.yaml
Generated manifest will be inside file chart1-deployment.yaml.
I want to ignore specifics files in subchart folder (because some objects, like secrets, are created by all my subchart, so duplicated...). I don't know the depth of these objects. So I want to use this syntax in .helmignore :
charts/**/myfile.yaml
But I got this error :
Error: double-star (**) syntax is not supported
How can I do that in helm 3 ?
Unfortunately, this feature doesn't supported nether in helm2 nor helm3.
helm2 source code: link
helm3 source code: link
Try to ignore it explicitly:
$ cat .helmignore
secrets
# or
./secrets/my-secret.yaml