Skip to content

Commit

Permalink
removing explicit resource namespaces and templatizing secret names
Browse files Browse the repository at this point in the history
Signed-off-by: Archisman <archisman@obmondo.com>
  • Loading branch information
Archisman committed Dec 10, 2024
1 parent 2a6f45c commit 78691fc
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: {{ .Values.global.clusterName }}
namespace: capi-cluster-{{ .Values.global.customerid }}
labels:
cluster.x-k8s.io/name: {{ .Values.global.clusterName }}
capi.syself.com/constant-bare-metal-hostname: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: HetznerBareMetalHost
metadata:
name: {{ $value.name }}
namespace: capi-cluster-{{ $.Values.global.customerid }}
labels:
role: {{ $.Values.global.clusterName }}-control-plane
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: HetznerBareMetalMachineTemplate
metadata:
name: {{ .Values.global.clusterName }}-control-plane
namespace: capi-cluster-{{ .Values.global.customerid }}
spec:
template:
spec:
Expand Down Expand Up @@ -66,4 +65,4 @@ spec:
name: sshkey-name
privateKey: ssh-privatekey
publicKey: ssh-publickey
name: capi-cluster-robot-ssh
name: {{ .Values.robotSSHKeysSecretName }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: HetznerCluster
metadata:
name: {{ .Values.global.clusterName }}
namespace: capi-cluster-{{ .Values.global.customerid }}
labels:
cluster.x-k8s.io/name: {{ .Values.global.clusterName }}
spec:
Expand Down Expand Up @@ -31,7 +30,7 @@ spec:
hcloudToken: hcloud
hetznerRobotPassword: robot-password
hetznerRobotUser: robot-user
name: capi-cluster-hetzner
name: {{ .Values.cloudCredentialsSecretName }}
sshKeys:
hcloud:
- name: cluster
Expand All @@ -40,4 +39,4 @@ spec:
name: sshkey-name
privateKey: ssh-privatekey
publicKey: ssh-publickey
name: capi-cluster-robot-ssh
name: {{ .Values.robotSSHKeysSecretName }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: {{ .Values.global.clusterName }}-md-0
namespace: capi-cluster-{{ .Values.global.customerid }}
spec:
template:
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: {{ .Values.global.clusterName }}-control-plane
namespace: capi-cluster-{{ .Values.global.customerid }}
spec:
kubeadmConfigSpec:
clusterConfiguration:
Expand Down
4 changes: 4 additions & 0 deletions argocd-helm-charts/capi-cluster/charts/hetzner/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
controlPlaneLoadBalancer:
enabled: true

robot:
floating: false

robotSSHKeysSecretName: hetzner-robot-ssh-keys
cloudCredentialsSecretName: cloud-credentials
21 changes: 16 additions & 5 deletions argocd-helm-charts/capi-cluster/templates/provider-hetzner.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{{- if (.Values.provider).hetzner }}

{{- /* For non Obmondo users, no customerid is needed. */ -}}
{{- $name := "hetzner" }}
{{- $namespace := "capi-cluster" }}

{{- /* For obmondo customers. */ -}}
{{- if .Values.global.customerid }}
{{- $name = printf "%s-%s" $name .Values.global.customerid }}
{{- $namespace = printf "%s-%s" $namespace .Values.global.customerid }}
{{- end }}

apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: hetzner-{{ .Values.global.customerid }}
namespace: capi-cluster-{{ .Values.global.customerid }}
name: {{ $name }}
namespace: {{ $namespace }}
spec:
configSecret:
name: capi-cluster-hetzner
namespace: capi-cluster-{{ .Values.global.customerid }}
name: {{ .Values.hetzner.cloudCredentialsSecretName }}
namespace: {{ $namespace }}
version: {{ .Values.global.caph.version }}
fetchConfig:
url: https://github.com/syself/cluster-api-provider-hetzner/releases/download/{{ .Values.global.caph.version }}/infrastructure-components.yaml
manager:
manager: {}
# bug: cluster-api renders it as
# --metrics-bind-addr and CAPH wants --metrics-bind-address
# metrics:
Expand Down

0 comments on commit 78691fc

Please sign in to comment.