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 14 forks source link

Introduce two snapstore proxy configuration options #68

Closed ktsakalozos closed 1 year ago

ktsakalozos commented 1 year ago

If the user sets the two SnapstoreProxyDomain SnapstoreProxyId configuration options the snapd registers to the designated snapstore proxy.

Testing

Tested manually based on the instructions in https://docs.ubuntu.com/snap-store-proxy/en/install. In short, in a VM next to the CAPI cluster do:

sudo snap install snap-store-proxy
sudo apt install postgresql

Get the IP or host endpoint and put it in:

sudo snap-proxy config proxy.domain=<IP or host domain>

Configure postgress with something like:

$ cat ./ps.sql 
CREATE ROLE "snapproxy-user" LOGIN CREATEROLE PASSWORD 'snapproxy-password';

CREATE DATABASE "snapproxy-db" OWNER "snapproxy-user";

\connect "snapproxy-db"

CREATE EXTENSION "btree_gist";

and

sudo -u postgres psql < ps.sql 
sudo snap-proxy config proxy.db.connection="postgresql://snapproxy-user@localhost:5432/snapproxy-db"

Register the proxy:

sudo snap-proxy register

Get the store proxy ID and endpoint with:

snap-proxy status

Do not forget

After merging this work we need to create a tag and have the MicroK8s controlplane provider use the tag so it gets updated with the new spec.

ktsakalozos commented 1 year ago

Can we also add a test case for the snapstore proxy configuration?

Added some tests, thanks for bringing it up.