Skip to content

Commit

Permalink
Address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mateoflorido committed Oct 18, 2024
1 parent 3453cf8 commit 2f8511d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions bootstrap/controllers/certificates_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,12 @@ func (r *CertificatesReconciler) Reconcile(ctx context.Context, req ctrl.Request
if refreshCertificates {
if configOwner.IsControlPlaneMachine() {
if err := r.refreshControlPlaneCertificates(ctx, scope); err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, fmt.Errorf("failed to refresh control plane certificates: %w", err)
}
} else {
if err := r.refreshWorkerCertificates(ctx, scope); err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, fmt.Errorf("failed to refresh worker certificates: %w", err)
}
return ctrl.Result{}, nil
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/canonical/cluster-api-k8s
go 1.22.6

require (
github.com/canonical/k8s-snap-api v1.0.10
github.com/canonical/k8s-snap-api v1.0.11
github.com/go-logr/logr v1.4.1
github.com/google/uuid v1.4.0
github.com/onsi/ginkgo v1.16.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/canonical/k8s-snap-api v1.0.10 h1:BoAw4Vr8mR8MWTKeZZxH5LmrF3JYGSZHDv+KEo5ifoU=
github.com/canonical/k8s-snap-api v1.0.10/go.mod h1:LDPoIYCeYnfgOFrwVPJ/4edGU264w7BB7g0GsVi36AY=
github.com/canonical/k8s-snap-api v1.0.11 h1:nGtwrUQBLiaL3HUXFx2gb4kq6qVpl2yNwMwHVX0dEok=
github.com/canonical/k8s-snap-api v1.0.11/go.mod h1:LDPoIYCeYnfgOFrwVPJ/4edGU264w7BB7g0GsVi36AY=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
Expand Down
4 changes: 2 additions & 2 deletions pkg/ck8s/workload_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ func (w *Workload) refreshCertificatesRun(ctx context.Context, machine *clusterv
// 1. The CAPI provider calls the /x/capi/refresh-certs/plan endpoint from the
// worker node, which generates the CSRs and creates the CertificateSigningRequest
// objects in the cluster.
// 2. The CAPI provider then calls the /x/capi/refresh-certs/plan endpoint with
// 2. The CAPI provider then calls the /x/capi/refresh-certs/run endpoint with
// the seed. This endpoint waits until the CSR is approved and the certificate
// is signed. Note that this is a blocking call.
// 3. The CAPI provider calls the /x/capi/refresh-certs/approve endpoint from
// any control plane node to approve the CSRs.
// 4. The /x/capi/refresh-certs/plan endpoint completes and returns once the
// 4. The /x/capi/refresh-certs/run endpoint completes and returns once the
// certificate is approved and signed.
func (w *Workload) RefreshWorkerCertificates(ctx context.Context, machine *clusterv1.Machine, nodeToken string, expirationSeconds int) (int, error) {
seed, err := w.refreshCertificatesPlan(ctx, machine, nodeToken)
Expand Down

0 comments on commit 2f8511d

Please sign in to comment.