Closed toffer closed 3 years ago
Correct, that's what should happen at https://github.com/Orange-OpenSource/casskop/blob/master/docker/bootstrap/files/run.sh#L182-L207
In general, I don't see any reason why the env vars in the bootstrap and cassandra containers should differ. Is there a reason why they shouldn't be the same?
Yes, I made that change. The reason is that the configuration is generated by the bootstrap init-container. The cassandra container just uses it so need a few if not no variables. I think even https://github.com/Orange-OpenSource/casskop/blob/master/pkg/controller/cassandracluster/generator.go#L382-L406 is not needed as you can see at https://github.com/Orange-OpenSource/casskop/blob/master/docker/bootstrap/bootstrap.sh.
If the authentication is not set I need to take a look at it.
In the case of JOLOKIA_USER and JOLOKIA_PASSWORD, it would definitely be helpful to have the env vars set in both the bootstrap container and in the cassandra container. As discussed above, the bootstrap container needs the env vars so that it can update the jolokia jvm option in run.sh
.
But, the JOLOKIA env vars are also helpful in the cassandra container. For example, the readiness-probe.sh
script hits the jolokia endpoint. Since we're using auth, I've updated our readiness-probe.sh
to work both with and without credentials. It starts like:
# Add Jolokia credentials, if defined in environment.
if [[ -z $JOLOKIA_USER ]] || [[ -z $JOLOKIA_PASSWORD ]]; then
USER_OPT=""
else
USER_OPT="--user $JOLOKIA_USER:$JOLOKIA_PASSWORD"
fi
# We check when the node is up and in normal state
CURL="/opt/bin/curl $USER_OPT -s --connect-timeout 0.5"
BASE_CMD="http://$POD_IP:8778/jolokia/read/org.apache.cassandra.db:type=StorageService"
If you like, I can put together a PR that moves where the JOLOKIA env vars get added, so that the addition happens in bootstrapContainerEnvVar()
. That way, the JOLOKIA env vars will be present on both the bootstrap and cassandra containers.
And, I can update readiness-probe.sh
as above to read the credentials from the env vars and use them.
Let me know if you'd like me to proceed.
@toffer yeah I forgot about the readiness probe that uses those variables.
And, I can update readiness-probe.sh as above to read the credentials from the env vars and use them.
Wwhat you mean ? it already uses env vars as shown in the script you pasted
The current version doesn't use those env vars: https://github.com/Orange-OpenSource/casskop/blob/master/docker/bootstrap/files/readiness-probe.sh#L17-L24
I was suggesting that I would update the current version of readiness-probe.sh to work like the example I pasted above.
Oh I see, I thought it did. Then 👍
What did you do? I configured
imageJolokiaSecret
, but Jolokia started up without auth.This issue was previously reported in #211, but it was closed before confirming whether or not this was really a problem. I can confirm that this is a bug in need of fixing.
Secret
CassandraCluster
What did you expect to see?
I expected to see Cassandra start up with this jvm option:
What did you see instead? Under which circumstances?
Cassandra started up with this jvm option:
You can see that the Jolokia env vars are set in the cassandra container:
However, these env vars are not set in the bootstrap container, which is where
run.sh
looks for them in order to update the jolokia jvm option. If you add asleep 3600
topost_run.sh
and exec into the bootstrap pod, you can see that the JOLOKIA env vars are missing:Bootstrap env vars are set in
cassandracluster.bootstrapContainerEnvVar()
, but the Jolokia env vars are not included in the list of env vars set. https://github.com/Orange-OpenSource/casskop/blob/9253cd6115accbd715007817cc4b78b0c2865866/pkg/controller/cassandracluster/generator.go#L577The Jolokia env vars are added to the cassandra container (and only the cassandra container) here: https://github.com/Orange-OpenSource/casskop/blob/9253cd6115accbd715007817cc4b78b0c2865866/pkg/controller/cassandracluster/generator.go#L381-L408
Environment
Possible Solution
For the Jolokia credentials in particular, I'd like the JOLOKIA_USER and JOLOKIA_PASSWORD env vars to be set in both the bootstrap and cassandra containers.
In general, I don't see any reason why the env vars in the bootstrap and cassandra containers should differ. Is there a reason why they shouldn't be the same?