canonical / cluster-api-bootstrap-provider-microk8s

This project offers a cluster API bootstrap provider controller that manages the node provision of a MicroK8s cluster.
https://microk8s.io
21 stars 15 forks source link

Allow HTTPS for Snap Store Proxy Configuration in CAPI MicroK8s Bootstrap Script #108

Closed mateofloreza closed 3 months ago

mateofloreza commented 4 months ago

Currently, in the preruncmd script for configuring the Snap Store proxy within the Cluster API MicroK8s Bootstrap Provider, the Snap Store proxy domain is hardcoded to use HTTP. I propose that this should be configurable to allow the use of HTTPS as well.

Steps to Reproduce

Deploy a Kubernetes cluster using Cluster API with MicroK8s.
Configure the Snap Store proxy using the snapstoreProxyDomain and snapstoreProxyId parameters.
Observe the preruncmd script attempting to use HTTP to configure the Snap Store proxy.

Expected Behavior

The preruncmd script should allow the Snap Store proxy to be configured using HTTPS. The URL should be fully configurable as part of the CRD. Actual Behavior

The preruncmd script currently hardcodes the use of HTTP when configuring the Snap Store proxy:

while ! curl -sL http://"${1}"/v2/auth/store/assertions | snap ack /dev/stdin ; do
  echo "Failed to ACK store assertions, will retry"
  sleep 5
done

Proposed Change

Modify the preruncmd script to allow the full URL to be specified as part of the CRD, enabling the use of HTTPS if desired. For example, the script could be updated to:

while ! curl -sL "${1}"/v2/auth/store/assertions | snap ack /dev/stdin ; do
  echo "Failed to ACK store assertions, will retry"
  sleep 5
done

This change allows users to specify either HTTP or HTTPS in the snapstoreProxyDomain parameter.

eaudetcobello commented 3 months ago

Hi @mateofloreza ,

Thanks for reporting this issue!

I've implemented the fix in v6.0.10