-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration test for disable default cni flag #113
Merged
maci3jka
merged 7 commits into
main
from
KU-1226/integration-test-for-disableDefaultCNI-flag
Sep 9, 2024
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a05ba9c
Add CI test for disabling the default CNI in Microk8s CAPI provider
6389bd9
typo fix
7914508
remove environment variables from integration tests
6a3bd0e
description fix
57eb747
refactor retryable command exec
966c0c8
added context to retry
f313dcc
Apply suggestions from code review
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,40 +4,10 @@ | |||||||
|
||||||||
The integration/e2e tests have the following prerequisites: | ||||||||
|
||||||||
* an environment variable `CLUSTER_MANIFEST_FILE` pointing to the cluster manifest. Cluster manifests can be produced with the help of the templates found under `templates`. For example: | ||||||||
``` | ||||||||
export AWS_REGION=us-east-1 | ||||||||
export AWS_SSH_KEY_NAME=capi | ||||||||
export CONTROL_PLANE_MACHINE_COUNT=3 | ||||||||
export WORKER_MACHINE_COUNT=3 | ||||||||
export AWS_CREATE_BASTION=false | ||||||||
export AWS_PUBLIC_IP=false | ||||||||
export AWS_CONTROL_PLANE_MACHINE_FLAVOR=t3.large | ||||||||
export AWS_NODE_MACHINE_FLAVOR=t3.large | ||||||||
export CLUSTER_NAME=test-ci-cluster | ||||||||
clusterctl generate cluster ${CLUSTER_NAME} --from "templates/cluster-template-aws.yaml" --kubernetes-version 1.25.0 > cluster.yaml | ||||||||
export CLUSTER_MANIFEST_FILE=$PWD/cluster.yaml | ||||||||
``` | ||||||||
|
||||||||
* Additional environment variables when testing cluster upgrades: | ||||||||
``` | ||||||||
export CAPI_UPGRADE_VERSION=v1.26.0 | ||||||||
export CAPI_UPGRADE_MD_NAME=${CLUSTER_NAME}-md-0 | ||||||||
export CAPI_UPGRADE_MD_TYPE=machinedeployments.cluster.x-k8s.io | ||||||||
export CAPI_UPGRADE_CP_NAME=${CLUSTER_NAME}-control-plane | ||||||||
export CAPI_UPGRADE_CP_TYPE=microk8scontrolplanes.controlplane.cluster.x-k8s.io | ||||||||
|
||||||||
# Change the control plane and worker machine count to desired values for in-place upgrades tests and create a new cluster manifest. | ||||||||
CONTROL_PLANE_MACHINE_COUNT=1 | ||||||||
WORKER_MACHINE_COUNT=1 | ||||||||
clusterctl generate cluster ${CLUSTER_NAME} --from "templates/cluster-template-aws.yaml" --kubernetes-version 1.25.0 > cluster-inplace.yaml | ||||||||
export CLUSTER_INPLACE_MANIFEST_FILE=$PWD/cluster-inplace.yaml | ||||||||
|
||||||||
``` | ||||||||
|
||||||||
* `clusterctl` available in the PATH | ||||||||
|
||||||||
* `kubectl` available in the PATH | ||||||||
* make sure to have ssh key in aws `capi`in `us-east-1 region` if you do not have key refer | ||||||||
to CAPI on [AWS prerequisites documentation](https://cluster-api-aws.sigs.k8s.io/topics/using-clusterawsadm-to-fulfill-prerequisites#ssh-key-pair) | ||||||||
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
* to run tests locally you will need to have on path fallowing programs `clusterctl`, `kubectl`, `helm` | ||||||||
maci3jka marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
* a management cluster initialised via `clusterctl` with the infrastructure targeted as well as the version of the MicroK8s providers we want to be tested | ||||||||
|
||||||||
|
@@ -67,7 +37,7 @@ microk8s config > ~/.kube/config | |||||||
|
||||||||
#### Initialize infrastructure provider | ||||||||
|
||||||||
Visit [here](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers) for a list of common infrasturture providers. | ||||||||
Visit [here](https://cluster-api.sigs.k8s.io/user/quick-start.html#initialization-for-common-providers) for a list of common infrastructure providers. | ||||||||
|
||||||||
```bash | ||||||||
clusterctl init --infrastructure <infra> --bootstrap - --control-plane - | ||||||||
|
@@ -83,7 +53,7 @@ docker push <username>/capi-bootstrap-provider-microk8s:<tag> | |||||||
sed "s,docker.io/cdkbot/capi-bootstrap-provider-microk8s:latest,docker.io/<username>/capi-bootstrap-provider-microk8s:<tag>," -i bootstrap-components.yaml | ||||||||
``` | ||||||||
|
||||||||
Similarly for control-plane provider | ||||||||
Similarly, for control-plane provider | ||||||||
```bash | ||||||||
cd control-plane | ||||||||
docker build -t <username>/capi-control-plane-provider-microk8s:<tag> . | ||||||||
|
@@ -96,6 +66,9 @@ sed "s,docker.io/cdkbot/capi-control-plane-provider-microk8s:latest,docker.io/<u | |||||||
```bash | ||||||||
kubectl apply -f bootstrap/bootstrap-components.yaml -f control-plane/control-plane-components.yaml | ||||||||
``` | ||||||||
### Cluster definitions for e2e | ||||||||
|
||||||||
Cluster definition are stored in [`manifests`](./cluster-manifests) directory. | ||||||||
maci3jka marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
#### Trigger the e2e tests | ||||||||
|
||||||||
|
117 changes: 117 additions & 0 deletions
117
integration/cluster-manifests/cluster-disable-default-cni.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: test-ci-cluster | ||
namespace: default | ||
spec: | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sControlPlane | ||
name: test-ci-cluster-control-plane | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
name: test-ci-cluster | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
metadata: | ||
name: test-ci-cluster | ||
namespace: default | ||
spec: | ||
bastion: | ||
enabled: false | ||
region: us-east-1 | ||
sshKeyName: capi | ||
--- | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sControlPlane | ||
metadata: | ||
name: test-ci-cluster-control-plane | ||
namespace: default | ||
spec: | ||
controlPlaneConfig: | ||
clusterConfiguration: | ||
portCompatibilityRemap: true | ||
initConfiguration: | ||
IPinIP: true | ||
addons: | ||
- dns | ||
- ingress | ||
confinement: classic | ||
disableDefaultCNI: true | ||
joinTokenTTLInSecs: 900000 | ||
riskLevel: stable | ||
machineTemplate: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: test-ci-cluster-control-plane | ||
replicas: 1 | ||
upgradeStrategy: SmartUpgrade | ||
version: v1.27.0 | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: test-ci-cluster-control-plane | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: t3.large | ||
publicIP: false | ||
sshKeyName: capi | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: MachineDeployment | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
clusterName: test-ci-cluster | ||
replicas: 1 | ||
selector: | ||
matchLabels: null | ||
template: | ||
spec: | ||
bootstrap: | ||
configRef: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
name: test-ci-cluster-md-0 | ||
clusterName: test-ci-cluster | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: test-ci-cluster-md-0 | ||
version: 1.27.0 | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: t3.large | ||
publicIP: false | ||
sshKeyName: capi | ||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
clusterConfiguration: | ||
portCompatibilityRemap: true | ||
initConfiguration: | ||
confinement: classic | ||
disableDefaultCNI: true | ||
riskLevel: stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: test-ci-cluster | ||
namespace: default | ||
spec: | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sControlPlane | ||
name: test-ci-cluster-control-plane | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
name: test-ci-cluster | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSCluster | ||
metadata: | ||
name: test-ci-cluster | ||
namespace: default | ||
spec: | ||
bastion: | ||
enabled: false | ||
region: us-east-1 | ||
sshKeyName: capi | ||
--- | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sControlPlane | ||
metadata: | ||
name: test-ci-cluster-control-plane | ||
namespace: default | ||
spec: | ||
controlPlaneConfig: | ||
clusterConfiguration: | ||
portCompatibilityRemap: true | ||
initConfiguration: | ||
IPinIP: true | ||
addons: | ||
- dns | ||
- ingress | ||
confinement: classic | ||
joinTokenTTLInSecs: 900000 | ||
riskLevel: stable | ||
machineTemplate: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: test-ci-cluster-control-plane | ||
replicas: 1 | ||
upgradeStrategy: SmartUpgrade | ||
version: v1.27.0 | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: test-ci-cluster-control-plane | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: t3.large | ||
publicIP: false | ||
sshKeyName: capi | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: MachineDeployment | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
clusterName: test-ci-cluster | ||
replicas: 1 | ||
selector: | ||
matchLabels: null | ||
template: | ||
spec: | ||
bootstrap: | ||
configRef: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
name: test-ci-cluster-md-0 | ||
clusterName: test-ci-cluster | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
name: test-ci-cluster-md-0 | ||
version: 1.27.0 | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 | ||
kind: AWSMachineTemplate | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io | ||
instanceType: t3.large | ||
publicIP: false | ||
sshKeyName: capi | ||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
metadata: | ||
name: test-ci-cluster-md-0 | ||
namespace: default | ||
spec: | ||
template: | ||
spec: | ||
clusterConfiguration: | ||
portCompatibilityRemap: true | ||
initConfiguration: | ||
confinement: classic | ||
riskLevel: stable |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those prerequisites not required anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes those are not required they are hardcoded in cluster manifest dir