Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ e2e-templates: $(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
cluster-template-multi-network.yaml \
cluster-template-without-lb.yaml \
cluster-template.yaml \
cluster-template-topology.yaml \
cluster-template-flatcar.yaml \
cluster-template-k8s-upgrade.yaml \
cluster-template-flatcar-sysext.yaml \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
apiVersion: cluster.x-k8s.io/v1beta1
apiVersion: cluster.x-k8s.io/v1beta2
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
spec:
topology:
class: dev-test
version: ${KUBERNETES_VERSION}
classRef:
name: dev-test
controlPlane:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: default-worker
name: md-0
replicas: ${WORKER_MACHINE_COUNT}
variables:
- name: identityRef
value:
name: ${CLOUD_CONFIG_SECRET:=dev-test-cloud-config}
cloudName: ${OPENSTACK_CLOUD:=capo-e2e}
- name: imageName
value: ${IMAGE_NAME:=flatcar_production}
name: ${CLOUD_CONFIG_SECRET:=dev-test-cloud-config}
- name: imageRef
value: ${IMAGE_REF:=node-image}
- name: addImageVersion
value: ${ADD_IMAGE_VERSION:=false}
- name: injectIgnitionSysext
Expand All @@ -32,6 +27,12 @@ spec:
spec:
flavor: ${OPENSTACK_BASTION_FLAVOR:=m1.small}
image:
filter:
imageRef:
name: ${OPENSTACK_BASTION_IMAGE_NAME:=ubuntu-24.04}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""}
version: ${KUBERNETES_VERSION}
workers:
machineDeployments:
- class: default-worker
name: md-0
replicas: ${WORKER_MACHINE_COUNT}
112 changes: 85 additions & 27 deletions templates/clusterclass-dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
controlPlane:
templateRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
kind: KubeadmControlPlaneTemplate
name: dev-test-control-plane
machineInfrastructure:
Expand All @@ -23,7 +23,7 @@ spec:
- class: default-worker
bootstrap:
templateRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfigTemplate
name: dev-test-default-worker-bootstraptemplate
infrastructure:
Expand Down Expand Up @@ -53,16 +53,22 @@ spec:
type: string
description: |
The base name of the OpenStack image that is used for creating the servers.
This will be combined with the k8s version to create the full name. E.g. imageName-v1.31.2.
default: "ubuntu-2404-kube"
- name: addImageVersion
required: false
schema:
openAPIV3Schema:
type: boolean
description: |
Add a suffix with the Kubernetes version to the imageName. E.g. imageName-v1.32.2.
Add a suffix with the Kubernetes version to the imageName or imageRef. E.g. imageName-v1.32.2.
default: true
- name: imageRef
required: false
schema:
openAPIV3Schema:
type: string
description: |
The name of the ORC Image object that is used for creating the servers.
default: "node-image"
- name: injectIgnitionSysext
required: false
schema:
Expand Down Expand Up @@ -109,6 +115,12 @@ spec:
name:
type: string
description: "Name of the image to use for bastion"
imageRef:
type: object
properties:
name:
type: string
description: "Name of the ORC Image to use for bastion"
sshKeyName:
type: string
description: "SSH key pair name for bastion access"
Expand All @@ -120,20 +132,23 @@ spec:
type: string
description: "Availability zone for the bastion host"
patches:
- name: image
description: "Sets the OpenStack image that is used for creating the servers."
- name: imageName
description: "Sets the OpenStack image that is used for creating the servers using a name filter."
enabledIf: "{{ if .imageName }}true{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: remove
path: /spec/template/spec/image/imageRef
- op: add
path: /spec/template/spec/image/filter/name
path: /spec/template/spec/image/filter
valueFrom:
template: |
{{ .imageName }}{{ if .addImageVersion }}-{{ .builtin.controlPlane.version }}{{ end }}
name: {{ .imageName }}{{ if .addImageVersion }}-{{ .builtin.controlPlane.version }}{{ end }}
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
Expand All @@ -142,11 +157,41 @@ spec:
names:
- default-worker
jsonPatches:
- op: remove
path: /spec/template/spec/image/imageRef
- op: add
path: /spec/template/spec/image/filter/name
path: /spec/template/spec/image/filter
valueFrom:
template: |
{{ .imageName }}{{ if .addImageVersion }}-{{ .builtin.machineDeployment.version }}{{ end }}
name: {{ .imageName }}{{ if .addImageVersion }}-{{ .builtin.machineDeployment.version }}{{ end }}
- name: imageRef
description: "Sets the OpenStack image that is used for creating the servers using an ORC Image reference."
enabledIf: "{{ if .imageRef }}true{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: replace
path: /spec/template/spec/image/imageRef/name
valueFrom:
template: |
{{ .imageRef }}{{ if .addImageVersion }}-{{ .builtin.controlPlane.version }}{{ end }}
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: /spec/template/spec/image/imageRef/name
valueFrom:
template: |
{{ .imageRef }}{{ if .addImageVersion }}-{{ .builtin.controlPlane.version }}{{ end }}
- name: identityRef
description: "Sets the OpenStack identity reference."
definitions:
Expand Down Expand Up @@ -193,7 +238,7 @@ spec:
enabledIf: "{{ .injectIgnitionSysext }}"
definitions:
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
Expand All @@ -211,12 +256,18 @@ spec:
nodeRegistration:
name: $${COREOS_OPENSTACK_HOSTNAME}
kubeletExtraArgs:
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
- name: cloud-provider
value: external
- name: provider-id
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
joinConfiguration:
nodeRegistration:
name: $${COREOS_OPENSTACK_HOSTNAME}
kubeletExtraArgs:
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
- name: cloud-provider
value: external
- name: provider-id
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
format: ignition
ignition:
containerLinuxConfig:
Expand All @@ -233,16 +284,16 @@ spec:
mode: 0644
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ $minor }}.conf
url: https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ $minor }}.conf
- path: /etc/sysupdate.d/noop.conf
mode: 0644
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
url: https://extensions.flatcar.org/extensions/noop.conf
- path: /opt/extensions/kubernetes/kubernetes-{{ .builtin.controlPlane.version }}-x86-64.raw
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ .builtin.controlPlane.version }}-x86-64.raw
url: https://extensions.flatcar.org/extensions/kubernetes-{{ .builtin.controlPlane.version }}-x86-64.raw
systemd:
units:
- name: systemd-sysupdate.service
Expand Down Expand Up @@ -277,7 +328,7 @@ spec:
[Service]
EnvironmentFile=/run/metadata/flatcar
- selector:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: KubeadmConfigTemplate
matchResources:
machineDeploymentClass:
Expand All @@ -297,7 +348,10 @@ spec:
nodeRegistration:
name: $${COREOS_OPENSTACK_HOSTNAME}
kubeletExtraArgs:
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
- name: cloud-provider
value: external
- name: provider-id
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
format: ignition
ignition:
containerLinuxConfig:
Expand All @@ -314,16 +368,16 @@ spec:
mode: 0644
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ $minor }}.conf
url: https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ $minor }}.conf
- path: /etc/sysupdate.d/noop.conf
mode: 0644
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/noop.conf
url: https://extensions.flatcar.org/extensions/noop.conf
- path: /opt/extensions/kubernetes/kubernetes-{{ .builtin.machineDeployment.version }}-x86-64.raw
contents:
remote:
url: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ .builtin.machineDeployment.version }}-x86-64.raw
url: https://extensions.flatcar.org/extensions/kubernetes-{{ .builtin.machineDeployment.version }}-x86-64.raw
systemd:
units:
- name: systemd-sysupdate.service
Expand Down Expand Up @@ -365,7 +419,6 @@ metadata:
spec:
template:
spec:
files: []
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
Expand All @@ -382,6 +435,11 @@ metadata:
spec:
template:
spec:
rollout:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
kubeadmConfigSpec:
clusterConfiguration:
controllerManager:
Expand Down Expand Up @@ -454,8 +512,8 @@ spec:
spec:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR:=m1.medium}
image:
filter:
name: overridden-by-patch
imageRef:
name: node-image
sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
Expand All @@ -467,6 +525,6 @@ spec:
spec:
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR:=m1.small}
image:
filter:
name: overridden-by-patch
imageRef:
name: node-image
sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""}
2 changes: 2 additions & 0 deletions test/e2e/data/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ providers:
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template.yaml"
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-without-lb.yaml"
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-cluster-identity.yaml"
- sourcePath: "../../../templates/clusterclass-dev-test.yaml"
replacements:
- old: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev
new: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:e2e
Expand Down Expand Up @@ -246,6 +247,7 @@ variables:
E2E_IMAGE_URL: "http://10.0.3.15/capo-e2e-image.tar"
# The default user for SSH connections from bastion to machines
SSH_USER_MACHINE: "ubuntu"
CLUSTER_TOPOLOGY: "true"
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
# The Flatcar image produced by the image-builder
OPENSTACK_FLATCAR_IMAGE_NAME: "flatcar-stable-4152.2.3-kube-v1.33.1"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/data/kustomize/components/common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- images.yaml
components:
- ../images
patches:
# Set AZ and enable bastion
- target:
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/data/kustomize/components/images/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- images.yaml
40 changes: 40 additions & 0 deletions test/e2e/data/kustomize/topology/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Rather than editing the cluster-template, which include already variables,
# we simply create a new cluster-template with the correct variables for e2e.
apiVersion: cluster.x-k8s.io/v1beta2
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
spec:
topology:
classRef:
name: dev-test
version: ${KUBERNETES_VERSION}
controlPlane:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: default-worker
name: md-0
replicas: ${WORKER_MACHINE_COUNT}
variables:
- name: identityRef
value:
name: ${CLUSTER_NAME}-cloud-config
cloudName: ${OPENSTACK_CLOUD}
- name: imageRef
value: node-image
- name: addImageVersion
value: false
- name: injectIgnitionSysext
value: true
- name: allowedCIDRs
value: ${OPENSTACK_API_SERVER_ALLOWED_CIDRS:=[]}
- name: bastion
value:
enabled: ${OPENSTACK_BASTION_ENABLED:=false}
spec:
flavor: ${OPENSTACK_BASTION_FLAVOR:=m1.small}
image:
imageRef:
name: bastion-image
sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""}
Loading