-
Notifications
You must be signed in to change notification settings - Fork 114
Conversation
Welcome @zoetrope! |
Hi @zoetrope. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zoetrope 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 |
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.
As described here, there are a bunch of issues we should resolve before we can settle on an implementation, but I took a quick pass and left some comments here. Thanks!
log.Error(anchorErr, "while setting anchor state", "state", api.Missing, "reason", err) | ||
} | ||
return ctrl.Result{}, err | ||
if err := r.updateNamespace(ctx, log, nm, pnm); err != nil { |
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 that this change only affects subnamespaces (e.g., child namespaces created via an Anchor), and not all descendant namespaces (e.g., child namespaces that are created normally and then assigned a parent). See here for the difference.
As a result, this should probably go in hierarchy_config.go
, not here.
func (r *AnchorReconciler) writeNamespace(ctx context.Context, log logr.Logger, nm, pnm string) error { | ||
inst := &corev1.Namespace{} | ||
func (r *AnchorReconciler) updateNamespace(ctx context.Context, log logr.Logger, nm, pnm string) error { | ||
pnmInst := &corev1.Namespace{} |
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.
Nit: this should be pnsInst
("Parent NameSpace Instance").
// It's safe to use create here since if the namespace is created by someone | ||
// else while this reconciler is running, returning an error will trigger a | ||
// retry. The reconciler will set the 'Conflict' state instead of recreating | ||
// this namespace. All other transient problems should trigger a retry too. | ||
log.Info("Creating subnamespace") | ||
if err := r.Create(ctx, inst); err != nil { | ||
log.Error(err, "While creating subnamespace") | ||
log.Info("Updating subnamespace") | ||
if err := r.Patch(ctx, inst, client.Apply, &client.PatchOptions{ | ||
FieldManager: api.MetaGroup, | ||
}); err != nil { |
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.
A couple of things here:
- This was a very important comment, are you sure it's safe to delete?
- Where does the subnamespace get created if you've taken away the "Create" call?
- We use "r.Update" everywhere in HNC, why are you using "r.Patch" here? If this is important, there should be a very clear comment explaining why, otherwise someone will "fix" it in the future.
return nil | ||
result := make([]reconcile.Request, 0) | ||
nss := &corev1.NamespaceList{} | ||
err := r.List(context.Background(), nss) |
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.
This will result in every namespace being processed every time any namespace is changed, with no timeout. Is this really what you want? Note that the Forest already has all the namespaces in memory.
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 |
@zoetrope: 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. |
ref #47