Comment 5 for bug 1877692

Revision history for this message
Samuel Allan (samuelallan) wrote :

Here is a dump of my notes from reading code to discover where this value can be updated. May or may not be accurate, but this is my understanding of the system right now.

This is where the openstack cloud.conf lives:

```
juju ssh kuberenets-master/0
cat /var/snap/cdk-addons/current/config/openstack-cloud-conf | base64 -d
```

the live value applied to k8s can be retrieved with:

```
kubectl -n kube-system describe secret cloud-config
# to actually get the contents of cloud.conf:
kubectl -n kube-system get secret cloud-config -o jsonpath='{.data}' | jq -r '."cloud.conf"' | base64 -d
```

Data flow:
layer-k8s-common:generate_openstack_cloud_config() ->
charm-kubernetes-control-plane:configure_cdk_addons() ->
snap set cdk-addons <args>

Then cdk-addons uses this value when creating templates out for k8s.
The value passed to the template context is under the key `cloud_conf`.
I think the templates come from cloud-provider-openstack.
None of these templates reference `cloud_conf` though.

The template that uses `cloud_conf` is in the cdk-addons repo:
https://github.com/charmed-kubernetes/cdk-addons/blob/63a7eaff01da0718c3c19e012cc089948263b764/bundled-templates/cloud-config-secret-openstack.yaml#L12
(cloud-config-secret-openstack.yaml)
This creates the secret that contains the `cloud.conf` key,
that is consumed by the cloud-provider-openstack

To update `internal-lb` conditionally,
it would seem that the place is layer-k8s-common:generate_openstack_cloud_config()
https://github.com/charmed-kubernetes/layer-kubernetes-common/blob/4b91682011a33aee3c20acbb5870f59ad8f8b0c2/lib/charms/layer/kubernetes_common.py#L550