Skip to content

Commit 3268799

Browse files
authored
Merge branch 'main' into tg/support-provider-id-format-of-upstream-ccm
2 parents a6979e0 + bd6d67a commit 3268799

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ $(CTLPTL):
118118
CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR)/clusterctl)
119119
clusterctl: $(CLUSTERCTL) ## Build a local copy of clusterctl
120120
$(CLUSTERCTL):
121-
go install sigs.k8s.io/cluster-api/cmd/clusterctl@v1.8.10
121+
go install sigs.k8s.io/cluster-api/cmd/clusterctl@v1.10.7
122122

123123
HCLOUD := $(abspath $(TOOLS_BIN_DIR)/hcloud)
124124
hcloud: $(HCLOUD) ## Build a local copy of hcloud

hack/update-operator-dev-deployment.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,18 @@ if ! echo "$current_context" | grep -P '.*-admin@.*-mgt-cluster'; then
6666
fi
6767

6868
branch=$(git branch --show-current)
69+
70+
# No branch name was found. Try to get a git-tag.
6971
if [ "$branch" == "" ]; then
70-
echo "failed to get branch name"
72+
branch=$(git describe --tags --exact-match 2>/dev/null || echo "")
73+
fi
74+
75+
if [ "$branch" == "" ]; then
76+
echo "failed to find git branch/tag name"
7177
exit 1
7278
fi
7379

80+
# Build tag for container image.
7481
tag="dev-$USER-$branch"
7582
tag="$(echo -n "$tag" | tr -c 'a-zA-Z0-9_.-' '-')"
7683

@@ -81,27 +88,43 @@ image="$image_path/caph-staging:$tag"
8188
make generate-manifests
8289
kustomize build config/crd | kubectl apply -f -
8390
} &
91+
pid_generate=$!
8492

85-
# run in background2
93+
# run in background
8694
{
8795
docker build -f images/caph/Dockerfile -t "$image" .
8896
docker push "$image"
8997
} &
98+
pid_docker_push=$!
9099

91-
wait
100+
# wait for both processes and check their exit codes
101+
if ! wait $pid_generate; then
102+
echo "Error: generate-manifests/kustomize failed"
103+
exit 1
104+
fi
105+
106+
if ! wait $pid_docker_push; then
107+
echo "Error: docker build/push failed"
108+
exit 1
109+
fi
92110

111+
# Find namespace of caph deployment.
93112
ns=$(kubectl get deployments.apps -A | { grep caph-controller || true; } | cut -d' ' -f1)
94113
if [[ -z $ns ]]; then
95114
echo "failed to get namespace for caph-controller"
96115
exit 1
97116
fi
98117

118+
# Scale deployment to 1.
99119
kubectl scale --replicas=1 -n "$ns" deployment/caph-controller-manager
100120

101121
kubectl set image -n "$ns" deployment/caph-controller-manager manager="$image"
102122

123+
# Set imagePullPolicy to "Always", so that a new image (with same name/tag) gets pulled.
103124
kubectl patch deployment -n "$ns" -p '[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Always"}]' --type='json' caph-controller-manager
104125

126+
# If you update the image again, there might be no change the deployment spec.
127+
# Force a rollout:
105128
kubectl rollout restart -n "$ns" deployment caph-controller-manager
106129

107130
trap "echo 'Interrupted! Exiting...'; exit 1" SIGINT

pkg/services/baremetal/host/host.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ func rebootTypesFromStringList(rebootTypeStringList []string) ([]infrav1.RebootT
316316
return rebootTypes, nil
317317
}
318318

319+
// ensureSSHKey ensures that the given ssh key is known to the Robot-API.
320+
// s.scope.RobotClient.SetSSHKey() gets used to upload the public-key, if it is not there yet.
319321
func (s *Service) ensureSSHKey(sshSecretRef infrav1.SSHSecretRef, sshSecret *corev1.Secret) (infrav1.SSHKey, actionResult) {
320322
if sshSecret == nil {
321323
return infrav1.SSHKey{}, actionError{err: errNilSSHSecret}
@@ -324,7 +326,7 @@ func (s *Service) ensureSSHKey(sshSecretRef infrav1.SSHSecretRef, sshSecret *cor
324326
if err != nil {
325327
s.handleRobotRateLimitExceeded(err, "ListSSHKeys")
326328
if !models.IsError(err, models.ErrorCodeNotFound) {
327-
return infrav1.SSHKey{}, actionError{err: fmt.Errorf("failed to list ssh heys: %w", err)}
329+
return infrav1.SSHKey{}, actionError{err: fmt.Errorf("failed to list ssh keys: %w", err)}
328330
}
329331
}
330332

@@ -345,6 +347,9 @@ func (s *Service) ensureSSHKey(sshSecretRef infrav1.SSHSecretRef, sshSecret *cor
345347
if err != nil {
346348
s.handleRobotRateLimitExceeded(err, "SetSSHKey")
347349
if models.IsError(err, models.ErrorCodeKeyAlreadyExists) {
350+
// Robot SSH-keys API is a bit strange: the public key value must be unique; you
351+
// can’t add the same key twice. Uniqueness is checked by key value, not by the
352+
// key’s name.
348353
msg := fmt.Sprintf("cannot upload ssh key %q (from secret %q) - exists already under a different name: %s",
349354
string(sshSecret.Data[sshSecretRef.Key.Name]), sshSecretRef.Name, err.Error())
350355
conditions.MarkFalse(
@@ -2149,7 +2154,7 @@ func (s *Service) actionProvisioned(ctx context.Context) actionResult {
21492154
}
21502155
err = fmt.Errorf("failed to handle incomplete boot - actionProvisioned: %w", err)
21512156
conditions.MarkFalse(host, infrav1.RebootSucceededCondition,
2152-
"FailureFailGettingHostnameViaSSH",
2157+
"FailureGettingHostnameViaSSH",
21532158
clusterv1.ConditionSeverityWarning, "%s",
21542159
err.Error())
21552160
return actionError{err: err}

0 commit comments

Comments
 (0)