-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 WIP: Reformat logs/bootstrap #6110
🌱 WIP: Reformat logs/bootstrap #6110
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
78c3a2d
to
412c1c3
Compare
45590c2
to
9098dfc
Compare
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
9098dfc
to
1af7aa5
Compare
cc83ff8
to
1edf198
Compare
75bcaeb
to
ee6b5b3
Compare
ee6b5b3
to
dffc1ae
Compare
@killianmuldoon: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits, but i really like the direction of this PR
} | ||
|
||
// Look up the owner of this kubeadm config if there is one | ||
configOwner, err := bsutil.GetConfigOwner(ctx, r.Client, config) | ||
if apierrors.IsNotFound(err) { | ||
log.Info("Reconcile finished - waiting for KubeadmConfig owner to be set by Machine or MachinePool controller") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about
log.Info("Reconcile finished - waiting for KubeadmConfig owner to be set by Machine or MachinePool controller") | |
log.Info(fmt.Sprintf("Waiting for %s owner to be set by Machine or MachinePool controller", klog.KObj(KubeadmConfig)) |
So it will read
- Reconciling ...
- Waiting for ... owner to be set by Machine or MachinePool controller
- No changes to ...
If this is ok let's apply to other similar messages (drop "Reconcile finished", add obj name)
@@ -320,24 +331,26 @@ func (r *KubeadmConfigReconciler) rotateMachinePoolBootstrapToken(ctx context.Co | |||
return ctrl.Result{}, err | |||
} | |||
if shouldRotate { | |||
log.V(2).Info("Creating new bootstrap token") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep this otherwise it won't be clear why a new token has been created; might be the message should be "Rotating the bootstrap token for the MachinePool"
|
||
// update the bootstrap data | ||
return r.joinWorker(ctx, scope) | ||
} | ||
|
||
log.Info("Extending MachinePool token lifetime") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop this given that we are not extending token lifecycle but creating new tokens
config.Spec.JoinConfiguration = &bootstrapv1.JoinConfiguration{} | ||
} | ||
|
||
// it's a control plane join | ||
if configOwner.IsControlPlaneMachine() { | ||
return r.joinControlplane(ctx, scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop this change and L287
return ctrl.Result{RequeueAfter: 30 * time.Second}, nil | ||
} | ||
|
||
// if the machine has not ClusterConfiguration and InitConfiguration, requeue | ||
if scope.Config.Spec.InitConfiguration == nil && scope.Config.Spec.ClusterConfiguration == nil { | ||
scope.Info("Control plane is not ready, requeing joining control planes until ready.") | ||
log.Info("Reconcile finished - control plane is not ready, requeuing joining control planes until ready") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for a follow up PR
We should drop RequeAfter and instead watch for machines (and probably MachinePools); same at line 382.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "Waiting for control plane object to be ready before generating DataSecret for ..."?
~same for L382
@@ -508,6 +519,7 @@ func (r *KubeadmConfigReconciler) joinWorker(ctx context.Context, scope *Scope) | |||
if res, err := r.reconcileDiscovery(ctx, scope.Cluster, scope.Config, certificates); err != nil { | |||
return ctrl.Result{}, err | |||
} else if !res.IsZero() { | |||
log.Info("Reconcile finished - discovery configuration set") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will drop this in favor of logging inside reconcileDiscovery when we return non zero values
return ctrl.Result{}, err | ||
} | ||
|
||
log.Info("Reconcile finished - bootstrap data generated for Machine") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this message; is this a duplicate of the side effect? if not, should this have the secret KObj?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar consideration applies to joinWorker/joinControlplane
@@ -114,26 +115,27 @@ func (c *ControlPlaneInitMutex) Lock(ctx context.Context, cluster *clusterv1.Clu | |||
func (c *ControlPlaneInitMutex) Unlock(ctx context.Context, cluster *clusterv1.Cluster) bool { | |||
sema := newSemaphore() | |||
cmName := configMapName(cluster.Name) | |||
log := c.log.WithValues("namespace", cluster.Namespace, "cluster-name", cluster.Name, "configmap-name", cmName) | |||
log.Info("Checking for lock") | |||
log := c.log.WithValues("ConfigMap", fmt.Sprintf("%s/%s", cluster.Namespace, cmName), "Cluster", newkObj(cluster)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use KObj/KRef?
@killianmuldoon: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@killianmuldoon do you still want to pursue these changes, or shall we close? |
|
Closing this for now as the changes are stale / behind where we are on logging right now. Will possibly come back to this on a new PR, or open a new PR with similar changes. /close |
@killianmuldoon: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR is a work in progress and leads on from #5571. This is a poc to see how we should improve our logging overall and should not be merged.
Add extra key-value pairs and add logging levels to logs in the bootstrap package.