Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.3] 🐛 Fix to enable bootstrap secret rotation if the secret itself missing #7853

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bootstrap/kubeadm/internal/controllers/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
bootstraputil "k8s.io/cluster-bootstrap/token/util"
Expand Down Expand Up @@ -101,6 +102,12 @@ func refreshToken(ctx context.Context, c client.Client, token string, ttl time.D
func shouldRotate(ctx context.Context, c client.Client, token string, ttl time.Duration) (bool, error) {
secret, err := getToken(ctx, c, token)
if err != nil {
// If the secret is deleted before due to unknown reasons, machine pools cannot be scaled up.
// Since that, secret should be rotated if missing.
// Normally, it is not expected to reach this line.
if apierrors.IsNotFound(err) {
return true, nil
}
return false, err
}

Expand Down