-
Notifications
You must be signed in to change notification settings - Fork 7
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 set __META_APP_NAME, META_ENV_TYPE_NAME and META_CLUSTER_NAME in Konfig? #16
Comments
The definitions of the variables are as follows: __META_APP_NAME = option("app") or "sampleapp"
__META_ENV_TYPE_NAME = option("env") or "prod"
__META_CLUSTER_NAME = option("cluster") or Undefined Thus you can use -D app=override_app -D env=override_env -D cluster=override_cluster in KCL CLI to set them. |
thank you @Peefy ! sadly this dosen't work for my kpm run command (env, app stay default for the -D overwrites) is there a way to overwrite those values as code for an env e.g. directly in the dev main.k ?
my structure is: ls k8s/base/
base.k
ls k8s/dev/
kcl.mod kcl.mod.lock main.k I'm using the oci packages (did not clone the whole konfig repo). my kcl.mod does look like this:
|
Besides, If you want to read these configurations from a file, you can write code like the following code in the konfig server backend. https://github.com/kcl-lang/modules/blob/main/konfig/models/kube/backend/server_backend.k name = file.read("name.txt") or matadata.__META_APP_NAME |
Or you can use a KCL CLI will read the file automaticly. |
I see. If you want to set it up in the Server model and |
General Question
How to set __META_APP_NAME, META_ENV_TYPE_NAME and META_CLUSTER_NAME?
i have a structure of base and dev folders which are rendering fine (kpm run k8s/dev/) for my defined server (deployment, configMaps ...),. Sadly i cannot overwrite the namespace or env (for the deployment, for e.g. configmaps it can be refrenced by the imported packages). i did some research for those variables but do not know how to set them. (i read sth about project.yaml and stack.yaml - but i could not find information about the structure of it or references).
rendered deployment (server)
could you maybe help with a hint? :-)
The text was updated successfully, but these errors were encountered: