Skip to content

Commit

Permalink
cluster-class: simplify ipv4/ipv6 templating
Browse files Browse the repository at this point in the history
  • Loading branch information
65278 committed Apr 2, 2024
1 parent 11044ad commit e11408b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 161 deletions.
60 changes: 6 additions & 54 deletions templates/cluster-class-calico.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,30 +412,10 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv4Config/addresses
valueFrom:
variable: ipv4Config.addresses
- op: replace
path: /spec/template/spec/ipv4Config/prefix
valueFrom:
variable: ipv4Config.prefix
- op: replace
path: /spec/template/spec/ipv4Config/gateway
valueFrom:
variable: ipv4Config.gateway
- name: ClusterDeleteIPv4
description: "Delete Cluster IPv4 config if not enabled"
enabledIf: "{{ if .ipv4Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
- op: add
path: /spec/template/spec/ipv4Config
valueFrom:
variable: ipv4Config
- name: ClusterIPv6Config
description: "Configure Cluster IPv6 config"
enabledIf: "{{ if .ipv6Config }}true{{ end }}"
Expand All @@ -446,30 +426,10 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv6Config/addresses
valueFrom:
variable: ipv6Config.addresses
- op: replace
path: /spec/template/spec/ipv6Config/prefix
valueFrom:
variable: ipv6Config.prefix
- op: replace
path: /spec/template/spec/ipv6Config/gateway
valueFrom:
variable: ipv6Config.gateway
- name: ClusterDeleteIPv6
description: "Delete Cluster IPv6 config if not enabled"
enabledIf: "{{ if .ipv6Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
- op: add
path: /spec/template/spec/ipv6Config
valueFrom:
variable: ipv6Config
- name: ControlPlaneSetup
description: "How to bind the Control Plane and what K8S version"
definitions:
Expand Down Expand Up @@ -894,14 +854,6 @@ spec:
host: 10.10.10.9
port: 6443
dnsServers: [8.8.8.8, 8.8.4.4]
ipv4Config:
addresses: ["10.10.10.2-10.10.10.10"]
prefix: 24
gateway: 10.10.10.1
ipv6Config:
addresses: ["2001:db8::2-2001:db8::ffff"]
prefix: 64
gateway: 2001:db8::1
cloneSpec:
virtualIPNetworkInterface: ""
sshAuthorizedKeys: []
Expand Down
60 changes: 6 additions & 54 deletions templates/cluster-class-cilium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,30 +412,10 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv4Config/addresses
valueFrom:
variable: ipv4Config.addresses
- op: replace
path: /spec/template/spec/ipv4Config/prefix
valueFrom:
variable: ipv4Config.prefix
- op: replace
path: /spec/template/spec/ipv4Config/gateway
valueFrom:
variable: ipv4Config.gateway
- name: ClusterDeleteIPv4
description: "Delete Cluster IPv4 config if not enabled"
enabledIf: "{{ if .ipv4Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
- op: add
path: /spec/template/spec/ipv4Config
valueFrom:
variable: ipv4Config
- name: ClusterIPv6Config
description: "Configure Cluster IPv6 config"
enabledIf: "{{ if .ipv6Config }}true{{ end }}"
Expand All @@ -446,30 +426,10 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv6Config/addresses
valueFrom:
variable: ipv6Config.addresses
- op: replace
path: /spec/template/spec/ipv6Config/prefix
valueFrom:
variable: ipv6Config.prefix
- op: replace
path: /spec/template/spec/ipv6Config/gateway
valueFrom:
variable: ipv6Config.gateway
- name: ClusterDeleteIPv6
description: "Delete Cluster IPv6 config if not enabled"
enabledIf: "{{ if .ipv6Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
- op: add
path: /spec/template/spec/ipv6Config
valueFrom:
variable: ipv6Config
- name: ControlPlaneSetup
description: "How to bind the Control Plane and what K8S version"
definitions:
Expand Down Expand Up @@ -894,14 +854,6 @@ spec:
host: 10.10.10.9
port: 6443
dnsServers: [8.8.8.8, 8.8.4.4]
ipv4Config:
addresses: ["10.10.10.2-10.10.10.10"]
prefix: 24
gateway: 10.10.10.1
ipv6Config:
addresses: ["2001:db8::2-2001:db8::ffff"]
prefix: 64
gateway: 2001:db8::1
cloneSpec:
virtualIPNetworkInterface: ""
sshAuthorizedKeys: []
Expand Down
60 changes: 7 additions & 53 deletions templates/cluster-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,10 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv4Config/addresses
- op: add
path: /spec/template/spec/ipv4Config
valueFrom:
variable: ipv4Config.addresses
- op: replace
path: /spec/template/spec/ipv4Config/prefix
valueFrom:
variable: ipv4Config.prefix
- op: replace
path: /spec/template/spec/ipv4Config/gateway
valueFrom:
variable: ipv4Config.gateway
- name: ClusterDeleteIPv4
description: "Delete Cluster IPv4 config if not enabled"
enabledIf: "{{ if .ipv4Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
path: /spec/template/spec/ipv4Config
- name: ClusterIPv6Config
description: "Configure Cluster IPv6 config"
enabledIf: "{{ if .ipv6Config }}true{{ end }}"
Expand All @@ -416,29 +396,7 @@ spec:
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: /spec/template/spec/ipv6Config/addresses
valueFrom:
variable: ipv6Config.addresses
- op: replace
path: /spec/template/spec/ipv6Config/prefix
valueFrom:
variable: ipv6Config.prefix
- op: replace
path: /spec/template/spec/ipv6Config/gateway
valueFrom:
variable: ipv6Config.gateway
- name: ClusterDeleteIPv6
description: "Delete Cluster IPv6 config if not enabled"
enabledIf: "{{ if .ipv6Config }}false{{ end }}"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: ProxmoxClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: remove
- op: add
path: /spec/template/spec/ipv6Config
- name: ControlPlaneSetup
description: "How to bind the Control Plane and what K8S version"
Expand Down Expand Up @@ -864,14 +822,6 @@ spec:
host: 10.10.10.9
port: 6443
dnsServers: [8.8.8.8, 8.8.4.4]
ipv4Config:
addresses: ["10.10.10.2-10.10.10.10"]
prefix: 24
gateway: 10.10.10.1
ipv6Config:
addresses: ["2001:db8::2-2001:db8::ffff"]
prefix: 64
gateway: 2001:db8::1
cloneSpec:
virtualIPNetworkInterface: ""
sshAuthorizedKeys: []
Expand Down Expand Up @@ -938,3 +888,7 @@ spec:
nodeRegistration:
kubeletExtraArgs:
provider-id: "proxmox://'{{ ds.meta_data.instance_id }}'"
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/load-balancer
value: ""

0 comments on commit e11408b

Please sign in to comment.