Skip to content

Commit 4aea658

Browse files
committed
be explicit: recommend the defaults of upstream hcloud-ccm.
1 parent cdca0c3 commit 4aea658

File tree

5 files changed

+58
-28
lines changed

5 files changed

+58
-28
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ else
202202
helm repo add hcloud https://charts.hetzner.cloud
203203
helm repo update hcloud
204204
KUBECONFIG=$(WORKER_CLUSTER_KUBECONFIG) helm install hccm \
205-
hcloud/ cloud-cloud-controller-manager -n kube-system \
206-
--set privateNetwork.enabled=$(PRIVATE_NETWORK)
205+
hcloud/hcloud-cloud-controller-manager -n kube-system \
206+
--set privateNetwork.enabled=$(PRIVATE_NETWORK) \
207207
--set robot.enabled=true
208208
@echo 'run "kubectl --kubeconfig=$(WORKER_CLUSTER_KUBECONFIG) ..." to work with the new target cluster'
209209
endif

api/v1beta1/types.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ type HetznerSecretRef struct {
107107
// "hcloud". The Syself ccm defaults to "hetzner". For compatibility with upstream hcloud-ccm
108108
// the controller creates two secrets, if the name is different from "hcloud" (one with name
109109
// "hcloud", one with name being the value of this setting). The secret will be created in the
110-
// namespace "mgt-system" of the workload-cluster. Set
111-
// `spec.skipCreatingHetznerSecretInWorkloadCluster`, if you don't want that secret in the
112-
// wl-cluster to be created.
110+
// namespace "kube-system" of the workload-cluster. We recommend to use "hcloud", because this is
111+
// the default of upstream hcloud-ccm. Set `spec.skipCreatingHetznerSecretInWorkloadCluster`, if
112+
// you don't want that secret in the wl-cluster to be created.
113113
//
114114
// +kubebuilder:default=hcloud
115115
Name string `json:"name"`
@@ -123,18 +123,29 @@ type HetznerSecretRef struct {
123123
// Need to specify either HCloudToken or both HetznerRobotUser and HetznerRobotPassword.
124124
type HetznerSecretKeyRef struct {
125125
// HCloudToken defines the name of the key where the token for the Hetzner Cloud API is stored.
126+
// We recommend to use "token", because this is the default of upstream hcloud-ccm.
127+
//
126128
// +optional
127129
// +kubebuilder:default=token
128130
HCloudToken string `json:"hcloudToken"`
129-
// HetznerRobotUser defines the name of the key where the username for the Hetzner Robot API is stored.
131+
132+
// HetznerRobotUser defines the name of the key where the username for the Hetzner Robot API is
133+
// stored. We recommend to use "robot-user", because this is the default of upstream hcloud-ccm.
134+
//
130135
// +optional
131136
// +kubebuilder:default=robot-user
132137
HetznerRobotUser string `json:"hetznerRobotUser"`
133-
// HetznerRobotPassword defines the name of the key where the password for the Hetzner Robot API is stored.
138+
139+
// HetznerRobotPassword defines the name of the key where the password for the Hetzner Robot API
140+
// is stored. We recommend to use "robot-password", because this is the default of upstream
141+
// hcloud-ccm.
142+
//
134143
// +optional
135144
// +kubebuilder:default=robot-password
136145
HetznerRobotPassword string `json:"hetznerRobotPassword"`
146+
137147
// SSHKey defines the name of the ssh key.
148+
//
138149
// +optional
139150
// +kubebuilder:default=hcloud-ssh-key-name
140151
SSHKey string `json:"sshKey"`

config/crd/bases/infrastructure.cluster.x-k8s.io_hetznerclusters.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,22 @@ spec:
247247
properties:
248248
hcloudToken:
249249
default: token
250-
description: HCloudToken defines the name of the key where
251-
the token for the Hetzner Cloud API is stored.
250+
description: |-
251+
HCloudToken defines the name of the key where the token for the Hetzner Cloud API is stored.
252+
We recommend to use "token", because this is the default of upstream hcloud-ccm.
252253
type: string
253254
hetznerRobotPassword:
254255
default: robot-password
255-
description: HetznerRobotPassword defines the name of the
256-
key where the password for the Hetzner Robot API is stored.
256+
description: |-
257+
HetznerRobotPassword defines the name of the key where the password for the Hetzner Robot API
258+
is stored. We recommend to use "robot-password", because this is the default of upstream
259+
hcloud-ccm.
257260
type: string
258261
hetznerRobotUser:
259262
default: robot-user
260-
description: HetznerRobotUser defines the name of the key
261-
where the username for the Hetzner Robot API is stored.
263+
description: |-
264+
HetznerRobotUser defines the name of the key where the username for the Hetzner Robot API is
265+
stored. We recommend to use "robot-user", because this is the default of upstream hcloud-ccm.
262266
type: string
263267
sshKey:
264268
default: hcloud-ssh-key-name
@@ -274,9 +278,9 @@ spec:
274278
"hcloud". The Syself ccm defaults to "hetzner". For compatibility with upstream hcloud-ccm
275279
the controller creates two secrets, if the name is different from "hcloud" (one with name
276280
"hcloud", one with name being the value of this setting). The secret will be created in the
277-
namespace "mgt-system" of the workload-cluster. Set
278-
`spec.skipCreatingHetznerSecretInWorkloadCluster`, if you don't want that secret in the
279-
wl-cluster to be created.
281+
namespace "kube-system" of the workload-cluster. We recommend to use "hcloud", because this is
282+
the default of upstream hcloud-ccm. Set `spec.skipCreatingHetznerSecretInWorkloadCluster`, if
283+
you don't want that secret in the wl-cluster to be created.
280284
type: string
281285
required:
282286
- key

config/crd/bases/infrastructure.cluster.x-k8s.io_hetznerclustertemplates.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,22 @@ spec:
276276
properties:
277277
hcloudToken:
278278
default: token
279-
description: HCloudToken defines the name of the key
280-
where the token for the Hetzner Cloud API is stored.
279+
description: |-
280+
HCloudToken defines the name of the key where the token for the Hetzner Cloud API is stored.
281+
We recommend to use "token", because this is the default of upstream hcloud-ccm.
281282
type: string
282283
hetznerRobotPassword:
283284
default: robot-password
284-
description: HetznerRobotPassword defines the name
285-
of the key where the password for the Hetzner Robot
286-
API is stored.
285+
description: |-
286+
HetznerRobotPassword defines the name of the key where the password for the Hetzner Robot API
287+
is stored. We recommend to use "robot-password", because this is the default of upstream
288+
hcloud-ccm.
287289
type: string
288290
hetznerRobotUser:
289291
default: robot-user
290-
description: HetznerRobotUser defines the name of
291-
the key where the username for the Hetzner Robot
292-
API is stored.
292+
description: |-
293+
HetznerRobotUser defines the name of the key where the username for the Hetzner Robot API is
294+
stored. We recommend to use "robot-user", because this is the default of upstream hcloud-ccm.
293295
type: string
294296
sshKey:
295297
default: hcloud-ssh-key-name
@@ -305,9 +307,9 @@ spec:
305307
"hcloud". The Syself ccm defaults to "hetzner". For compatibility with upstream hcloud-ccm
306308
the controller creates two secrets, if the name is different from "hcloud" (one with name
307309
"hcloud", one with name being the value of this setting). The secret will be created in the
308-
namespace "mgt-system" of the workload-cluster. Set
309-
`spec.skipCreatingHetznerSecretInWorkloadCluster`, if you don't want that secret in the
310-
wl-cluster to be created.
310+
namespace "kube-system" of the workload-cluster. We recommend to use "hcloud", because this is
311+
the default of upstream hcloud-ccm. Set `spec.skipCreatingHetznerSecretInWorkloadCluster`, if
312+
you don't want that secret in the wl-cluster to be created.
311313
type: string
312314
required:
313315
- key

controllers/hetznercluster_controller.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,21 @@ func reconcileOneWorkloadClusterSecret(ctx context.Context, clusterScope *scope.
590590
wlSecret.Data["apiserver-host"] = []byte(clusterScope.HetznerCluster.Spec.ControlPlaneEndpoint.Host)
591591
wlSecret.Data["apiserver-port"] = []byte(strconv.Itoa(int(clusterScope.HetznerCluster.Spec.ControlPlaneEndpoint.Port)))
592592

593+
notes := []string{
594+
"This secret gets reconciled by Cluster API Provider Hetzner.",
595+
}
596+
597+
if clusterScope.HetznerCluster.Spec.HetznerSecret.Name != "hcloud" {
598+
notes = append(notes, fmt.Sprintf("We recommend to use 'hcloud' for hetznercluster.spec.hetznerSecret.name(not %q).",
599+
clusterScope.HetznerCluster.Spec.HetznerSecret.Name))
600+
}
601+
602+
if clusterScope.HetznerCluster.Spec.HetznerSecret.Key.HCloudToken != "token" {
603+
notes = append(notes, fmt.Sprintf("We recommend to use 'token' for hetznercluster.spec.hetznerSecret.key.hcloudToken (not %q).", clusterScope.HetznerCluster.Spec.HetznerSecret.Key.HCloudToken))
604+
}
605+
593606
// Make things more obvious for people new to caph:
594-
wlSecret.Data["note"] = []byte("This secret gets reconciled by Cluster API Provider Hetzner")
607+
wlSecret.Data["note"] = []byte(strings.Join(notes, " "))
595608

596609
return nil
597610
})

0 commit comments

Comments
 (0)