Skip to content

Commit

Permalink
Ignore cert annotation in rollout test
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
  • Loading branch information
killianmuldoon committed May 27, 2023
1 parent bb287a1 commit ed51fb9
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/e2e/clusterclass_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func assertClusterObjects(ctx context.Context, clusterProxy framework.ClusterPro
assertMachineSetsMachines(g, clusterObjects, cluster)

By("All cluster objects have the right labels, annotations and selectors")
}, 30*time.Second, 1*time.Second).Should(Succeed())
}, 10*time.Second, 1*time.Second).Should(Succeed())
}

func assertInfrastructureCluster(g Gomega, clusterClassObjects clusterClassObjects, clusterObjects clusterObjects, cluster *clusterv1.Cluster, clusterClass *clusterv1.ClusterClass) {
Expand Down Expand Up @@ -443,7 +443,7 @@ func assertControlPlaneMachines(g Gomega, clusterObjects clusterObjects, cluster
g.Expect(
union(
bootstrapConfig.GetAnnotations(),
).without(clusterv1.MachineCertificatesExpiryDateAnnotation),
).ignore(clusterv1.MachineCertificatesExpiryDateAnnotation),
).To(BeEquivalentTo(
controlPlaneMachineTemplateMetadata.Annotations,
))
Expand Down Expand Up @@ -820,6 +820,16 @@ func (m unionMap) without(keys ...string) unionMap {
return m
}

// ignore removes keys from a unionMap only if they exist.
// Note: This allows ignoring specific keys while comparing maps and is a more tolerant version of `without()`.
func (m unionMap) ignore(keys ...string) unionMap {
for _, key := range keys {
// Only remove the item from the map if it exists.
delete(m, key)
}
return m
}

// getManagedLabels gets a map[string]string and returns another map[string]string
// filtering out labels not managed by CAPI.
// Note: This is replicated from machine_controller_noderef.go.
Expand Down
84 changes: 84 additions & 0 deletions test/infrastructure/docker/templates/cluster-template-goofy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
labels:
cni: calico
spec:
clusterNetwork:
services:
cidrBlocks: ${POD_CIDR:=["192.168.0.0/16"]}
pods:
cidrBlocks: ${SERVICE_CIDR:=["10.128.0.0/12"]}
serviceDomain: "cluster.local"
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: GoofyCluster
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: GoofyCluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: GoofyMachineTemplate
metadata:
name: ${CLUSTER_NAME}-controlplane
namespace: ${NAMESPACE}
spec:
template:
spec: {}
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
annotations:
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
controlplane.cluster.x-k8s.io/skip-coredns: ""
spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
version: ${KUBERNETES_VERSION}
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: GoofyMachineTemplate
name: ${CLUSTER_NAME}-controlplane
namespace: ${NAMESPACE}
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
- 0.0.0.0
- host.docker.internal # host.docker.internal is required by kubetest when running on MacOS because of the way ports are proxied.
controllerManager:
extraArgs:
enable-hostpath-provisioner: "true"
dns:
imageTag: ""
initConfiguration:
nodeRegistration:
kubeletExtraArgs:
# We have to pin the cgroupDriver to cgroupfs as kubeadm >=1.21 defaults to systemd
# kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726
# cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
# We have to pin the cgroupDriver to cgroupfs as kubeadm >=1.21 defaults to systemd
# kind will implement systemd support in: https://github.com/kubernetes-sigs/kind/issues/1726
# cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%

0 comments on commit ed51fb9

Please sign in to comment.