Skip to content

Commit

Permalink
Merge pull request #654 from Danil-Grigorev/caapf-host-network-e2e
Browse files Browse the repository at this point in the history
🌱 Perform e2e on CAAPF with hostNetwork: true
  • Loading branch information
alexander-demicev committed Aug 13, 2024
2 parents 18a0de1 + 86589b1 commit c7850e2
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 156 deletions.
2 changes: 1 addition & 1 deletion test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The config is located in `test/e2e/config/operator.yaml`.
Most notable ones:
```yaml
variables:
RANCHER_VERSION: "v2.7.5" # Default rancher version to install
RANCHER_VERSION: "v2.9.0" # Default rancher version to install
RANCHER_HOSTNAME: "localhost" # Your ngrok domain
NGROK_API_KEY: "" # Key and token values for establishing ingress
NGROK_AUTHTOKEN: ""
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/config/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ intervals:
variables:
MANAGEMENT_CLUSTER_INFRASTRUCTURE: "isolated-kind" # supported options are eks, isolated-kind, kind
RANCHER_VERSION: "v2.8.1"
RANCHER_ALPHA_VERSION: "v2.9.1-alpha1"
KUBERNETES_VERSION: "v1.28.6"
KUBERNETES_MANAGEMENT_VERSION: "v1.27.0"
KUBERNETES_MANAGEMENT_AWS_REGION: "eu-west-2"
RANCHER_HOSTNAME: "localhost"
RANCHER_FEATURES: ""
RANCHER_PATH: "rancher-latest/rancher"
RANCHER_ALPHA_PATH: "rancher-alpha/rancher"
CPI_IMAGE_K8S_VERSION: "v1.27.0"
RKE2_VERSION: "v1.28.1+rke2r1"
RANCHER_REPO_NAME: "rancher-latest"
RANCHER_ALPHA_REPO_NAME: "rancher-alpha"
RANCHER_URL: "https://releases.rancher.com/server-charts/latest"
RANCHER_ALPHA_URL: "https://releases.rancher.com/server-charts/alpha"
CERT_MANAGER_URL: "https://charts.jetstack.io"
CERT_MANAGER_REPO_NAME: "jetstack"
CERT_MANAGER_PATH: "jetstack/cert-manager"
Expand Down
31 changes: 19 additions & 12 deletions test/e2e/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ var (
//go:embed data/cluster-templates/vsphere-rke2.yaml
CAPIvSphereRKE2 []byte

//go:embed data/cluster-api-addon-provider-fleet/host-network-patch.yaml
AddonProviderFleetHostNetworkPatch []byte

//go:embed data/gitea/ingress.yaml
GiteaIngress []byte
)
Expand All @@ -108,18 +111,22 @@ const (

KubernetesManagementVersionVar = "KUBERNETES_MANAGEMENT_VERSION"

KubernetesVersionVar = "KUBERNETES_VERSION"
RancherFeaturesVar = "RANCHER_FEATURES"
RancherHostnameVar = "RANCHER_HOSTNAME"
RancherVersionVar = "RANCHER_VERSION"
RancherPathVar = "RANCHER_PATH"
RancherUrlVar = "RANCHER_URL"
RancherRepoNameVar = "RANCHER_REPO_NAME"
RancherPasswordVar = "RANCHER_PASSWORD"
CertManagerUrlVar = "CERT_MANAGER_URL"
CertManagerRepoNameVar = "CERT_MANAGER_REPO_NAME"
CertManagerPathVar = "CERT_MANAGER_PATH"
CapiInfrastructureVar = "CAPI_INFRASTRUCTURE"
KubernetesVersionVar = "KUBERNETES_VERSION"
RancherFeaturesVar = "RANCHER_FEATURES"
RancherHostnameVar = "RANCHER_HOSTNAME"
RancherVersionVar = "RANCHER_VERSION"
RancherAlphaVersionVar = "RANCHER_ALPHA_VERSION"
RancherPathVar = "RANCHER_PATH"
RancherAlphaPathVar = "RANCHER_ALPHA_PATH"
RancherUrlVar = "RANCHER_URL"
RancherAlphaUrlVar = "RANCHER_ALPHA_URL"
RancherRepoNameVar = "RANCHER_REPO_NAME"
RancherAlphaRepoNameVar = "RANCHER_ALPHA_REPO_NAME"
RancherPasswordVar = "RANCHER_PASSWORD"
CertManagerUrlVar = "CERT_MANAGER_URL"
CertManagerRepoNameVar = "CERT_MANAGER_REPO_NAME"
CertManagerPathVar = "CERT_MANAGER_PATH"
CapiInfrastructureVar = "CAPI_INFRASTRUCTURE"

NgrokRepoNameVar = "NGROK_REPO_NAME"
NgrokUrlVar = "NGROK_URL"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: FleetAddonConfig
metadata:
name: fleet-addon-config
spec:
cluster:
hostNetwork: true
248 changes: 121 additions & 127 deletions test/e2e/data/cluster-templates/docker-kubeadm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,138 +146,132 @@ spec:
name: ${CLUSTER_NAME}-md-0
version: ${KUBERNETES_VERSION}
---
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
kind: Bundle
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: ${CLUSTER_NAME}-crs-0
name: kindnet-cni-${CLUSTER_NAME}
spec:
clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
resources:
- kind: ConfigMap
name: cni-${CLUSTER_NAME}-crs-0
strategy: ApplyOnce
---
apiVersion: v1
data:
kindnet.yaml: |
# kindnetd networking manifest
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- patch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
roleRef:
apiGroup: rbac.authorization.k8s.io
# List of all resources that will be deployed
- content: |-
# kindnetd networking manifest
---
kind: ClusterRole
name: kindnet
subjects:
- kind: ServiceAccount
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- patch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kindnet
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kindnet
subjects:
- kind: ServiceAccount
name: kindnet
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kindnet
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kindnet
namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kindnet
namespace: kube-system
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
selector:
matchLabels:
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kindnet
namespace: kube-system
labels:
tier: node
app: kindnet
template:
metadata:
labels:
tier: node
k8s-app: kindnet
spec:
selector:
matchLabels:
app: kindnet
k8s-app: kindnet
spec:
hostNetwork: true
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: kindnet
containers:
- name: kindnet-cni
image: kindest/kindnetd:v20230511-dc714da8
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_SUBNET
value: '10.1.0.0/16'
volumeMounts:
- name: cni-cfg
mountPath: /etc/cni/net.d
- name: xtables-lock
mountPath: /run/xtables.lock
readOnly: false
- name: lib-modules
mountPath: /lib/modules
readOnly: true
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
capabilities:
add: ["NET_RAW", "NET_ADMIN"]
volumes:
- name: cni-bin
hostPath:
path: /opt/cni/bin
type: DirectoryOrCreate
- name: cni-cfg
hostPath:
path: /etc/cni/net.d
type: DirectoryOrCreate
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: lib-modules
hostPath:
path: /lib/modules
kind: ConfigMap
metadata:
name: cni-${CLUSTER_NAME}-crs-0
template:
metadata:
labels:
tier: node
app: kindnet
k8s-app: kindnet
spec:
hostNetwork: true
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: kindnet
containers:
- name: kindnet-cni
image: kindest/kindnetd:v20230511-dc714da8
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_SUBNET
value: '10.1.0.0/16'
volumeMounts:
- name: cni-cfg
mountPath: /etc/cni/net.d
- name: xtables-lock
mountPath: /run/xtables.lock
readOnly: false
- name: lib-modules
mountPath: /lib/modules
readOnly: true
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
capabilities:
add: ["NET_RAW", "NET_ADMIN"]
volumes:
- name: cni-bin
hostPath:
path: /opt/cni/bin
type: DirectoryOrCreate
- name: cni-cfg
hostPath:
path: /etc/cni/net.d
type: DirectoryOrCreate
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: lib-modules
hostPath:
path: /lib/modules
name: kindnet.yaml
targets:
- clusterSelector:
matchLabels:
cni: ${CLUSTER_NAME}-crs-0
Loading

0 comments on commit c7850e2

Please sign in to comment.