-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #424 from salasberryfin/clusterclass-add-to-e2e
test: cover clusterclass in e2e tests
- Loading branch information
Showing
9 changed files
with
636 additions
and
28 deletions.
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
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
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,31 @@ | ||
//go:build e2e | ||
// +build e2e | ||
|
||
/* | ||
Copyright 2024 SUSE. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package e2e | ||
|
||
import ( | ||
_ "embed" | ||
) | ||
|
||
var ( | ||
//go:embed data/infrastructure/clusterclass-template-docker.yaml | ||
ClusterClassDocker []byte | ||
//go:embed data/infrastructure/cluster-from-clusterclass-template-docker.yaml | ||
ClusterFromClusterClassDocker []byte | ||
) |
29 changes: 29 additions & 0 deletions
29
test/e2e/data/infrastructure/cluster-from-clusterclass-template-docker.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,29 @@ | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: "${CLUSTER_NAME}" | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- 10.45.0.0/16 | ||
serviceDomain: cluster.local | ||
services: | ||
cidrBlocks: | ||
- 10.46.0.0/16 | ||
topology: | ||
class: "${CLASS_NAME}" | ||
version: ${KUBERNETES_VERSION}+rke2r1 | ||
controlPlane: | ||
metadata: {} | ||
replicas: ${CABPR_CP_REPLICAS} | ||
workers: | ||
machineDeployments: | ||
- class: default-worker | ||
name: md-0 | ||
replicas: ${CABPR_WK_REPLICAS} | ||
variables: | ||
- name: dockerKindImage | ||
value: kindest/node:${KIND_IMAGE_VERSION} |
205 changes: 205 additions & 0 deletions
205
test/e2e/data/infrastructure/clusterclass-template-docker.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,205 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: ClusterClass | ||
metadata: | ||
name: "${CLASS_NAME}" | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
controlPlane: | ||
ref: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: RKE2ControlPlaneTemplate | ||
name: ${CLASS_NAME}-control-plane | ||
machineInfrastructure: | ||
ref: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: ${CLASS_NAME}-control-plane | ||
infrastructure: | ||
ref: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerClusterTemplate | ||
name: ${CLASS_NAME}-cluster | ||
workers: | ||
machineDeployments: | ||
- class: default-worker | ||
template: | ||
bootstrap: | ||
ref: | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: RKE2ConfigTemplate | ||
name: ${CLASS_NAME}-default-worker-bootstraptemplate | ||
infrastructure: | ||
ref: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: ${CLASS_NAME}-default-worker-machinetemplate | ||
variables: | ||
- name: dockerKindImage | ||
required: true | ||
schema: | ||
openAPIV3Schema: | ||
type: string | ||
default: kindest/node:v1.28.12 | ||
patches: | ||
- name: controlPlaneDockerKindImage | ||
definitions: | ||
- selector: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
matchResources: | ||
controlPlane: true | ||
jsonPatches: | ||
- op: add | ||
path: /spec/template/spec/customImage | ||
valueFrom: | ||
variable: dockerKindImage | ||
- name: workerDockerKindImage | ||
definitions: | ||
- selector: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
matchResources: | ||
machineDeploymentClass: | ||
names: | ||
- default-worker | ||
jsonPatches: | ||
- op: add | ||
path: "/spec/template/spec/customImage" | ||
valueFrom: | ||
variable: dockerKindImage | ||
--- | ||
apiVersion: v1 | ||
data: | ||
value: |- | ||
# generated by kind | ||
global | ||
log /dev/log local0 | ||
log /dev/log local1 notice | ||
daemon | ||
# limit memory usage to approximately 18 MB | ||
# (see https://github.com/kubernetes-sigs/kind/pull/3115) | ||
maxconn 100000 | ||
resolvers docker | ||
nameserver dns 127.0.0.11:53 | ||
defaults | ||
log global | ||
mode tcp | ||
option dontlognull | ||
# TODO: tune these | ||
timeout connect 5000 | ||
timeout client 50000 | ||
timeout server 50000 | ||
# allow to boot despite dns don't resolve backends | ||
default-server init-addr none | ||
frontend stats | ||
bind *:8404 | ||
stats enable | ||
stats uri / | ||
stats refresh 10s | ||
frontend control-plane | ||
bind *:{{ .FrontendControlPlanePort }} | ||
{{ if .IPv6 -}} | ||
bind :::{{ .FrontendControlPlanePort }}; | ||
{{- end }} | ||
default_backend kube-apiservers | ||
backend kube-apiservers | ||
option httpchk GET /healthz | ||
http-check expect status 401 | ||
# TODO: we should be verifying (!) | ||
{{range $server, $address := .BackendServers}} | ||
server {{ $server }} {{ JoinHostPort $address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }} | ||
{{- end}} | ||
frontend rke2-join | ||
bind *:9345 | ||
{{ if .IPv6 -}} | ||
bind :::9345; | ||
{{- end }} | ||
default_backend rke2-servers | ||
backend rke2-servers | ||
option httpchk GET /v1-rke2/readyz | ||
http-check expect status 403 | ||
{{range $server, $address := .BackendServers}} | ||
server {{ $server }} {{ $address }}:9345 check check-ssl verify none | ||
{{- end}} | ||
kind: ConfigMap | ||
metadata: | ||
name: ${CLASS_NAME}-lb-config | ||
namespace: "${NAMESPACE}" | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerClusterTemplate | ||
metadata: | ||
name: ${CLASS_NAME}-cluster | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
template: | ||
spec: | ||
loadBalancer: | ||
customHAProxyConfigTemplateRef: | ||
name: ${CLASS_NAME}-lb-config | ||
--- | ||
kind: RKE2ControlPlaneTemplate | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
metadata: | ||
name: ${CLASS_NAME}-control-plane | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
template: | ||
spec: | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: ${CLASS_NAME}-control-plane | ||
serverConfig: | ||
cni: calico | ||
disableComponents: | ||
kubernetesComponents: [ "cloudController"] | ||
nodeDrainTimeout: 2m | ||
rolloutStrategy: | ||
type: "RollingUpdate" | ||
rollingUpdate: | ||
maxSurge: 1 | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
metadata: | ||
name: ${CLASS_NAME}-control-plane | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
template: | ||
spec: | ||
customImage: kindest/node:v1.28.0 # will be replaced by the patch | ||
extraMounts: | ||
- containerPath: "/var/run/docker.sock" | ||
hostPath: "/var/run/docker.sock" | ||
bootstrapTimeout: 15m | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
metadata: | ||
name: ${CLASS_NAME}-default-worker-machinetemplate | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
template: | ||
spec: | ||
customImage: kindest/node:v1.28.0 # will be replaced by the patch | ||
extraMounts: | ||
- containerPath: "/var/run/docker.sock" | ||
hostPath: "/var/run/docker.sock" | ||
bootstrapTimeout: 15m | ||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: RKE2ConfigTemplate | ||
metadata: | ||
name: ${CLASS_NAME}-default-worker-bootstraptemplate | ||
namespace: "${NAMESPACE}" | ||
spec: | ||
template: | ||
spec: {} |
Oops, something went wrong.