Sonobuoy plugin that runs some tests as a sonobuoy plugin.
The tests that will be executed by the plugin need kubeconfigs to access the Control Plane Cluster, and the Tenant Cluster. So these cluster need to exist before running the tests.
The required kubeconfigs are passed as environment variables. We can generate them from our local kubeconfig file. For example, if our kubeconfig points to the Control Plane cluster, we can generate the Control Plane kubeconfig
kubectl config view --flatten=true --minify > cp_kubeconfig.yaml
We just need to do the same for the Tenant Cluster kubeconfig.
Then we are ready to run the tests.
sonobuoy run \
--kubeconfig "cp_kubeconfig.yaml" \
--namespace "4zxet-sonobuoy" \
--plugin https://raw.githubusercontent.com/giantswarm/sonobuoy-plugin/master/giantswarm-plugin.yaml \
--plugin-env giantswarm.TC_KUBECONFIG="$(cat "tc_kubeconfig.yaml")" \
--plugin-env giantswarm.CP_KUBECONFIG="$(cat "cp_kubeconfig.yaml")" \
--plugin-env giantswarm.CLUSTER_ID="4zxet" \
--mode=certified-conformance \
--wait
When this command finishes, we can see the results
sonobuoy status --namespace 4zxet-sonobuoy
Or retrieve the logs
outfile=$(sonobuoy retrieve) && \
mkdir results && tar -xf $outfile -C results &&
cat results/plugins/giantswarm/results/global/out
Custom Resource tests are checking values from following Cluster API and Cluster API Azure CRs:
- Cluster
- MachinePool
- AzureCluster
- AzureMachinePool
Metadata checks:
release.giantswarm.io/version
label is setazure-operator.giantswarm.io/version
label is setrelease.giantswarm.io/last-deployed-version
annotation is setrelease.giantswarm.io/version
label matchesrelease.giantswarm.io/last-deployed-version
annotation
Status checks:
Cluster.Status.ControlPlaneInitialized
is set totrue
Cluster.Status.ControlPlaneReady
is set totrue
Cluster.Status.InfrastructureReady
is set totrue
- Waiting for
Cluster.Status.Conditions[Ready]
to have statusTrue
- Waiting for
Cluster.Status.Conditions[Creating]
to have StatusFalse
Cluster.Status.Conditions[Creating]
have ReasonCreationCompleted
- Waiting for
Cluster.Status.Conditions[Upgrading]
to have StatusFalse
Cluster.Status.Conditions[ControlPlaneReady]
have StatusTrue
Cluster.Status.Conditions[InfrastructureReady]
have StatusTrue
Cluster.Status.Conditions[NodePoolsReady]
have StatusTrue
Metadata checks:
giantswarm.io/machine-pool
label is setrelease.giantswarm.io/version
label is set- Cluster and MachinePool have matching
release.giantswarm.io/version
labels azure-operator.giantswarm.io/version
label is set- Cluster and MachinePool have matching
azure-operator.giantswarm.io/version
labels release.giantswarm.io/last-deployed-version
annotation is set- Cluster and MachinePool have matching
release.giantswarm.io/last-deployed-version
annotations cluster.k8s.io/cluster-api-autoscaler-node-group-min-size
annotation is setcluster.k8s.io/cluster-api-autoscaler-node-group-max-size
annotation is set- Owner reference is set to Cluster object
Status checks:
Status.Replicas
is withing defined cluster autoscaler min and max valuesStatus.Replicas
equal toStatus.ReadyReplicas
- Waiting for
Cluster.Status.Conditions[Ready]
to have statusTrue
- Waiting for
Cluster.Status.Conditions[Creating]
to have StatusFalse
- Waiting for
Cluster.Status.Conditions[Upgrading]
to have StatusFalse
Cluster.Status.Conditions[InfrastructureReady]
have StatusTrue
Cluster.Status.Conditions[ReplicasReady]
have StatusTrue
Metadata checks:
release.giantswarm.io/version
label is setazure-operator.giantswarm.io/version
label is set- AzureCluster and Cluster have matching
release.giantswarm.io/version
labels - AzureCluster and Cluster have matching
azure-operator.giantswarm.io/version
labels - Owner reference is set to Cluster object
Spec checks:
- Exactly 1 CIDR block is allocated in
AzureCluster.Spec.NetworkSpec.Vnet.CIDRBlocks
- Number of subnets allocated in
AzureCluster.Spec.NetworkSpec.Subnets
is equal to the number of MachinePool objects for the cluster - Every subnet in
AzureCluster.Spec.NetworkSpec.Subnets
has a name equal to MachinePool object name - For every subnet in
AzureCluster.Spec.NetworkSpec.Subnets
, exactly 1 CIDR block is allocated
Status checks:
- Waiting for
Cluster.Status.Conditions[Ready]
to have statusTrue
AzureCluster.Status.Ready
is set totrue
Metadata checks:
giantswarm.io/machine-pool
label is setrelease.giantswarm.io/version
label is setazure-operator.giantswarm.io/version
label is set- AzureMachinePool and Cluster have matching
release.giantswarm.io/version
labels - AzureMachinePool and Cluster have matching
azure-operator.giantswarm.io/version
labels - AzureMachinePool and MachinePool have matching
giantswarm.io/machine-pool
labels - Owner reference is set to MachinePool object
Spec checks:
AzureMachinePool.Spec.ProviderID
is setAzureMachinePool.Spec.ProviderIDList
has number of IDs equal to the number of discovered replicas inMachinePool.Status.Replicas
Status checks:
- Waiting for
Cluster.Status.Conditions[Ready]
to have statusTrue
AzureMachinePool.Status.Replicas
is equal toMachinePool.Status.Replicas
AzureMachinePool.Status.ProvisioningState
is set toSucceeded
AzureMachinePool.Status.Ready
is set totrue