Skip to content

Commit

Permalink
Install k0smotron using clusterctl for CAPI tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Makhov <[email protected]>
  • Loading branch information
makhov committed Apr 26, 2024
1 parent cfa8ae5 commit 3a48ff6
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,9 @@ jobs:
run: |
kind create cluster --config config/samples/capi/docker/kind.yaml
- name: Load k0smotron image to KinD and install k0smotron controllers
- name: Load k0smotron image to KinD
run: |
kind load image-archive k0smotron-image-bundle.tar
kubectl apply -f install.yaml
- name: Download clusterctl
uses: supplypike/setup-bin@v4
Expand All @@ -183,9 +181,24 @@ jobs:
version: v1.4.3
uri: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.3/clusterctl-linux-amd64

- name: Prepare cluster api components
run: |
make bootstrap-components.yaml control-plane-components.yaml infrastructure-components.yaml
mkdir -p v0.0.0 k0sproject-k0smotron/control-plane-k0sproject-k0smotron/ k0sproject-k0smotron/bootstrap-k0sproject-k0smotron/ k0sproject-k0smotron/infrastructure-k0sproject-k0smotron/
mv bootstrap-components.yaml v0.0.0
mv control-plane-components.yaml v0.0.0
mv infrastructure-components.yaml v0.0.0
mv ./hack/capi-ci/metadata.yaml v0.0.0
cp -r v0.0.0 k0sproject-k0smotron/bootstrap-k0sproject-k0smotron/
cp -r v0.0.0 k0sproject-k0smotron/control-plane-k0sproject-k0smotron/
cp -r v0.0.0 k0sproject-k0smotron/infrastructure-k0sproject-k0smotron/
sed -e 's#%pwd%#'`pwd`'#g' ./hack/capi-ci/config.yaml > config.yaml
- name: Install cluster api components
run: |
clusterctl init --infrastructure docker
clusterctl init --control-plane k0sproject-k0smotron --bootstrap k0sproject-k0smotron --infrastructure k0sproject-k0smotron,docker --config config.yaml
kubectl patch -n capi-system deployment/capi-controller-manager -p \
'{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["--leader-elect", "--metrics-bind-addr=localhost:8080", "--feature-gates=ClusterTopology=true"]}]}}}}'
kubectl patch -n capd-system deployment/capd-controller-manager -p \
Expand Down
1 change: 1 addition & 0 deletions config/clusterapi/bootstrap/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_config_patch.yaml
- manager_auth_proxy_patch.yaml

configurations:
Expand Down
2 changes: 2 additions & 0 deletions config/clusterapi/bootstrap/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: controller-manager
namespace: k0smotron
labels:
k0smotron-provider: bootstrap
spec:
template:
spec:
Expand Down
1 change: 1 addition & 0 deletions config/clusterapi/controlplane/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_config_patch.yaml
- manager_auth_proxy_patch.yaml

configurations:
Expand Down
2 changes: 2 additions & 0 deletions config/clusterapi/controlplane/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: controller-manager
namespace: k0smotron
labels:
k0smotron-provider: control-plane
spec:
template:
spec:
Expand Down
1 change: 1 addition & 0 deletions config/clusterapi/infrastructure/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_config_patch.yaml
- manager_auth_proxy_patch.yaml

configurations:
Expand Down
2 changes: 2 additions & 0 deletions config/clusterapi/infrastructure/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: controller-manager
namespace: k0smotron
labels:
k0smotron-provider: infrastructure
spec:
template:
spec:
Expand Down
10 changes: 10 additions & 0 deletions hack/capi-ci/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
providers:
- name: "k0sproject-k0smotron"
url: "file://%pwd%/k0sproject-k0smotron/bootstrap-k0sproject-k0smotron/v0.0.0/bootstrap-components.yaml"
type: "BootstrapProvider"
- name: "k0sproject-k0smotron"
url: "file://%pwd%/k0sproject-k0smotron/control-plane-k0sproject-k0smotron/v0.0.0/control-plane-components.yaml"
type: "ControlPlaneProvider"
- name: "k0sproject-k0smotron"
url: "file://%pwd%/k0sproject-k0smotron/infrastructure-k0sproject-k0smotron/v0.0.0/infrastructure-components.yaml"
type: "InfrastructureProvider"
10 changes: 10 additions & 0 deletions hack/capi-ci/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# maps release series of major.minor to cluster-api contract version
# the contract version may change between minor or major versions, but *not*
# between patch versions.
#
# update this file only when a new major or minor version is released
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
releaseSeries:
- major: 0
minor: 0
contract: v1beta1

0 comments on commit 3a48ff6

Please sign in to comment.