Skip to content

Commit

Permalink
Update LB templates to use new structure
Browse files Browse the repository at this point in the history
- Breakind change: kubernetes-sigs/cluster-api#11430

Signed-off-by: Danil-Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Dec 16, 2024
1 parent b1ec601 commit 24c70b8
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 66 deletions.
3 changes: 3 additions & 0 deletions controlplane/internal/controllers/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package controllers

import (
"cmp"
"context"
"encoding/json"
"strings"
Expand Down Expand Up @@ -324,6 +325,8 @@ func (r *RKE2ControlPlaneReconciler) cloneConfigsAndGenerateMachine(
UID: rcp.UID,
}

rcp.Spec.InfrastructureRef.Namespace = cmp.Or(rcp.Spec.InfrastructureRef.Namespace, rcp.Namespace)

// Clone the infrastructure template
infraRef, err := external.CreateFromTemplate(ctx, &external.CreateFromTemplateInput{
Client: r.Client,
Expand Down
14 changes: 8 additions & 6 deletions examples/docker/air-gapped/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -165,8 +167,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -179,6 +181,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/cis-profile/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -155,8 +157,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -169,6 +171,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/clusterclass/clusterclass-quick-start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -110,8 +112,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -124,8 +126,8 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
kind: ConfigMap
metadata:
Expand Down
14 changes: 8 additions & 6 deletions examples/docker/disable-components/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -157,8 +159,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -171,6 +173,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/enable-multus/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -156,8 +158,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -170,6 +172,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/kube-vip/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -197,8 +199,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -211,6 +213,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/online-default/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -166,8 +168,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -180,6 +182,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
14 changes: 8 additions & 6 deletions examples/docker/priv-registries/rke2-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -209,8 +211,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -223,6 +225,6 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
4 changes: 4 additions & 0 deletions pkg/rke2/workload_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ func (m *Management) NewWorkload(
return nil, err
}

if clientKey == nil {
return nil, fmt.Errorf("client key is not populated yet, requeuing")
}

clientCert, err = generateClientCert(etcdKeyPair.Cert, etcdKeyPair.Key, clientKey)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -41,8 +43,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -55,8 +57,8 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
kind: ConfigMap
metadata:
Expand Down
14 changes: 8 additions & 6 deletions test/e2e/data/infrastructure/cluster-template-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ data:
default-server init-addr none
frontend stats
mode http
bind *:8404
stats enable
stats uri /
stats refresh 10s
stats uri /stats
stats refresh 1s
stats admin if TRUE
frontend control-plane
bind *:{{ .FrontendControlPlanePort }}
Expand All @@ -41,8 +43,8 @@ data:
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 }}
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ JoinHostPort $backend.Address $.BackendControlPlanePort }} check check-ssl verify none resolvers docker resolve-prefer {{ if $.IPv6 -}} ipv6 {{- else -}} ipv4 {{- end }}
{{- end}}
frontend rke2-join
Expand All @@ -55,8 +57,8 @@ data:
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
{{range $server, $backend := .BackendServers}}
server {{ $server }} {{ $backend.Address }}:9345 check check-ssl verify none
{{- end}}
kind: ConfigMap
metadata:
Expand Down
Loading

0 comments on commit 24c70b8

Please sign in to comment.