Comments (6)
A lifecycle hook would work for me. Thanks for the clarification.
from charts.
Hi @ahmsay,
The default config we mount in the container already includes the usage of env variables, did you take a look at that? As you can see here, we are exporting the APISIX_ADMIN_API_TOKEN env var in the init container that takes care of rendering the configuration. That env var is not used later in the apisix container.
https://github.com/bitnami/charts/blob/main/bitnami/apisix/templates/_helpers.tpl#L357
https://github.com/bitnami/charts/blob/main/bitnami/apisix/values.yaml#L1104
You will need to modify the extraEnvVars parameter to be able to mount that env var during that step so the configuration is updated.
from charts.
Hello @jotamartos,
What step are you referring to?
I am following this page: https://artifacthub.io/packages/helm/bitnami/apisix#additional-environment-variables
Neither extraEnvVars nor extraEnvVarsSecret are working as expected. This time i tried on my local device. I can see the environment variables inside the container when i type env
. And I have an environment variable called CLIENT_SECRET that is meant to be injected in my apisix.yaml file. But i have an error and it says that the environment variable is not found (as mentioned above).
Please note that I don't have an error when i use the official image with the same configuration.
from charts.
Hi @ahmsay
What step are you referring to?
I did a quick test to include a new parameter in the configuration based on the env var and everything worked as expected. I made these changes in the dataPlane object
diff --git a/bitnami/apisix/values.yaml b/bitnami/apisix/values.yaml
index 6918ae517b..0fb56c4e65 100644
--- a/bitnami/apisix/values.yaml
+++ b/bitnami/apisix/values.yaml
@@ -343,6 +343,8 @@ dataPlane:
token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
default_weight: 50 # weight assigned to each discovered endpoint. default 50, minimum 0
+ # Testing line
+ # new-parameter: "{{ print "{{NEW_APISIX_ENV_VAR}}" }}"
## @param dataPlane.extraConfig [object] extra configuration parameters to add to the config.yaml file in APISIX Data plane
##
extraConfig: {}
@@ -468,7 +470,9 @@ dataPlane:
## - name: FOO
## value: "bar"
##
- extraEnvVars: []
+ extraEnvVars:
+ - name: NEW_APISIX_ENV_VAR
+ value: "new-value"
## @param dataPlane.extraEnvVarsCM Name of existing ConfigMap containing extra env vars for APISIX nodes
##
extraEnvVarsCM: ""
and deployed the chart. Once all pods were running, I confirmed that the new parameter was added to the configuration and it used the env var value I configured
➜ apisix git:(main) k exec -it apisix-data-plane-79d784b689-cbxz5 -- env | grep -i new
Defaulted container "apisix" out of: apisix, wait-for-control-plane (init), prepare-apisix (init)
NEW_APISIX_ENV_VAR=new-value
➜ apisix git:(main) k exec -it apisix-data-plane-79d784b689-cbxz5 -- tail /usr/local/apisix/conf/config.yaml
Defaulted container "apisix" out of: apisix, wait-for-control-plane (init), prepare-apisix (init)
# apiserver host, options [ipv4, ipv6, domain, environment variable]
host: ${KUBERNETES_SERVICE_HOST} #default ${KUBERNETES_SERVICE_HOST}
# apiserver port, options [port number, environment variable]
port: ${KUBERNETES_SERVICE_PORT} #default ${KUBERNETES_SERVICE_PORT}
client:
# serviceaccount token or token_file
token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
default_weight: 50 # weight assigned to each discovered endpoint. default 50, minimum 0
# Testing line
# new-parameter: "new-value"
As you can see, I modified the configuration using the dataPlane.defaultConfig parameter, but you can also mount your own config map and the prepare-apisix init container will take care of evaluating the configuration and creating the necessary files in the system.
from charts.
Hello @jotamartos ,
In your example you modified the config.yaml file. I am trying to modify the apisix.yaml file. I also noticed that after I run apisix reload
command inside the container the error is gone.
Is there a way to automate this in the helm chart definition, like a post-start lifecycle hook?
from charts.
You can mount your apisix.yaml file and make any necessary change in a new initContainer, similar to the changes that I mentioned above. That way, once the container is running, the configuration is the one you expect and do not need to run that extra command. Would that work for you?
As you mention, you can also try setting a lifecycle hook
https://github.com/bitnami/charts/blob/main/bitnami/apisix/templates/control-plane/dep-ds.yaml#L170
from charts.
Related Issues (20)
- common.compatibility.renderSecurityContext function does not work for arrays HOT 1
- [bitnami/nginx] deployement blocked by vault HOT 2
- [bitnami/wordpress] Better custom image/CI-CD instructions HOT 1
- [bitnami/keycloak] remove proxy parameter (breaking) HOT 1
- [bitnami/apache] cloneHtdocsFromGit causes CrashLoopBackOff in git-repo-syncer HOT 3
- [bitnami/airflow] Worker logs can't be viewed/reached from the UI HOT 1
- [bitnami/discourse] Allow configuration of POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS for specific plugins HOT 1
- [bitnami/discourse] Plugins are not installed when added in the helm-release HOT 7
- [bitnami/mlflow] password authentication failed for user "bn_mlflow" HOT 2
- [bitnami/redis-cluster] Tekton Sidecars redis-cluster change port HOT 1
- Thanos Receive not mapping StorageClass to PVC
- [bitnami/etcd] Upgrading from older chart version of etcd such as 8.5.8 to the latest 10.2.11 with no downtime/data loss. HOT 2
- [bitnami/redis] openssl not found in redis chart HOT 1
- Bitnami helm chart for dragonflydb HOT 1
- [bitnami/keycloak] Not able to reuse pvc/pv from previous deploy HOT 1
- [bitnami/postgresql] Add support for setting custom podantiaffinity (or alternative) HOT 2
- [bitnami/grafana] Is grafana helm error? HOT 2
- [bitnami/postgresql-ha] pgpool can't be restored to health HOT 5
- [bitnami/mlflow] GCS storage for MLFow HOT 2
- [bitnami/postgresql-ha] Existing secret enforces key "postgres-password" even if user is postgres HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from charts.