Skip to content

Commit

Permalink
Added e2e for cluster-class feature and CC docker templates
Browse files Browse the repository at this point in the history
  • Loading branch information
shivi28 committed Jun 24, 2022
1 parent f691bcf commit e9ca5a4
Show file tree
Hide file tree
Showing 8 changed files with 715 additions and 201 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ jobs:
- name: Set netfilter conntrack max
run: sudo sysctl -w net.netfilter.nf_conntrack_max=131072

- name: Run Cluster Class e2e tests
run: yes | GINKGO_FOCUS="\[Cluster-Class\]" make test-e2e

- name: Run PR-Blocking e2e tests
run: yes | GINKGO_FOCUS="\[PR-Blocking\]" make test-e2e
3 changes: 3 additions & 0 deletions test/e2e/config/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ providers:
files:
# Add a cluster template
- sourcePath: "../data/infrastructure-provider-byoh/v1beta1/templates/e2e/cluster-template.yaml"
- sourcePath: "../data/infrastructure-provider-byoh/v1beta1/templates/e2e/clusterclass-quickstart.yaml"
- sourcePath: "../data/infrastructure-provider-byoh/v1beta1/templates/e2e/cluster-template-topology.yaml"
- sourcePath: "../../../metadata.yaml"
variables:
# default variables for the e2e test; those values could be overridden via env variables, thus
Expand All @@ -91,6 +93,7 @@ variables:
CNI: "./data/cni/kindnet/kindnet.yaml"
EXP_CLUSTER_RESOURCE_SET: "true"
EXP_MACHINE_POOL: "true"
CLUSTER_TOPOLOGY: "true"
KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml"
NODE_DRAIN_TIMEOUT: "60s"
# NOTE: INIT_WITH_BINARY is used only by the clusterctl upgrade test to initialize the management cluster to be upgraded
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
namespace: ${NAMESPACE}
spec:
clusterNetwork:
services:
cidrBlocks:
- 10.128.0.0/12
pods:
cidrBlocks:
- 192.168.0.0/16
serviceDomain: cluster.local
topology:
class: quickstart
version: ${KUBERNETES_VERSION}
controlPlane:
metadata: {}
replicas: 1
variables:
- name: bundleLookupBaseRegistry
value: "projects.registry.vmware.com/cluster_api_provider_bringyourownhost"
- name: controlPlaneIpAddr
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: kubeVipPodManifest
value: |
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- args:
- manager
env:
- name: cp_enable
value: "true"
- name: vip_arp
value: "true"
- name: vip_leaderelection
value: "true"
- name: vip_address
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: vip_interface
value: "{{ .DefaultNetworkInterfaceName }}"
- name: vip_leaseduration
value: "15"
- name: vip_renewdeadline
value: "10"
- name: vip_retryperiod
value: "2"
image: ghcr.io/kube-vip/kube-vip:v0.4.1
imagePullPolicy: IfNotPresent
name: kube-vip
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
name: kubeconfig
hostNetwork: true
hostAliases:
- hostnames:
- kubernetes
ip: 127.0.0.1
volumes:
- hostPath:
path: /etc/kubernetes/admin.conf
type: FileOrCreate
name: kubeconfig
status: {}
workers:
machineDeployments:
- class: quickstart-worker
metadata: {}
name: md-0
replicas: 1
---
kind: KubeadmControlPlaneTemplate
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
labels:
nodepool: pool0
name: quickstart-control-plane
namespace: ${NAMESPACE}
spec:
template:
spec:
kubeadmConfigSpec:
clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
- 0.0.0.0
- host.docker.internal
controllerManager:
extraArgs:
enable-hostpath-provisioner: "true"
files:
- owner: root:root
path: /etc/kubernetes/manifests/kube-vip.yaml
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
ignorePreflightErrors:
- Swap
- DirAvailable--etc-kubernetes-manifests
- FileAvailable--etc-kubernetes-kubelet.conf
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
joinConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
ignorePreflightErrors:
- Swap
- DirAvailable--etc-kubernetes-manifests
- FileAvailable--etc-kubernetes-kubelet.conf
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoMachineTemplate
metadata:
name: quickstart-control-plane-machine
namespace: ${NAMESPACE}
spec:
template:
spec:
installerRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: K8sInstallerConfigTemplate
name: quickstart-control-plane-machine
namespace: "${NAMESPACE}"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: K8sInstallerConfigTemplate
metadata:
name: quickstart-control-plane-machine
namespace: ${NAMESPACE}
spec:
template:
spec:
bundleRepo: projects.registry.vmware.com/cluster_api_provider_bringyourownhost
bundleType: k8s
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoClusterTemplate
metadata:
name: quickstart-cluster
namespace: ${NAMESPACE}
spec:
template:
spec: {}

---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoMachineTemplate
metadata:
name: quickstart-worker-machinetemplate
namespace: ${NAMESPACE}
spec:
template:
spec:
installerRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: K8sInstallerConfigTemplate
name: ${CLUSTER_NAME}-md-0
namespace: ${NAMESPACE}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: K8sInstallerConfigTemplate
metadata:
name: ${CLUSTER_NAME}-md-0
spec:
template:
spec:
bundleRepo: projects.registry.vmware.com/cluster_api_provider_bringyourownhost
bundleType: k8s
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: quickstart-worker-bootstrap-template
namespace: ${NAMESPACE}
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: quickstart
namespace: ${NAMESPACE}
spec:
controlPlane:
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
name: quickstart-control-plane
machineInfrastructure:
ref:
kind: ByoMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: quickstart-control-plane-machine
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoClusterTemplate
name: quickstart-cluster
workers:
machineDeployments:
- class: quickstart-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: quickstart-worker-bootstrap-template
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoMachineTemplate
name: quickstart-worker-machinetemplate
variables:
- name: bundleLookupBaseRegistry
required: true
schema:
openAPIV3Schema:
type: string
default: "https://projects.registry.vmware.com/cluster_api_provider_bringyourownhost"
- name: controlPlaneIpAddr
required: true
schema:
openAPIV3Schema:
type: string
- name: kubeVipPodManifest
required: true
schema:
openAPIV3Schema:
description: kube-vip manifest for the control plane.
type: string
patches:
- name: bundleLookupBaseRegistry
description: "Sets the bundleLookupBaseRegistry used for the BYOCluster."
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/bundleLookupBaseRegistry"
valueFrom:
variable: bundleLookupBaseRegistry
- name: controlPlaneEndpoint
description: "Sets control plane endpoint"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ByoClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/controlPlaneEndpoint"
valueFrom:
template: |
host: '{{ .controlPlaneIpAddr }}'
port: 6443
- name: kubeVipEnabled
definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/kubeadmConfigSpec/files/0/content
valueFrom:
variable: kubeVipPodManifest
selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
Loading

0 comments on commit e9ca5a4

Please sign in to comment.