Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

[WIP] Propagation of labels #48

Closed
wants to merge 2 commits into from

Conversation

zoetrope
Copy link

ref #47

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 15, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @zoetrope!

It looks like this is your first PR to kubernetes-sigs/hierarchical-namespaces 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/hierarchical-namespaces has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 15, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zoetrope
To complete the pull request process, please assign adrianludwin after the PR has been reviewed.
You can assign the PR to them by writing /assign @adrianludwin in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from srampal and tashimi June 15, 2021 02:10
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 15, 2021
Copy link
Contributor

@adrianludwin adrianludwin left a 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 {
Copy link
Contributor

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{}
Copy link
Contributor

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").

Comment on lines -377 to +392
// 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 {
Copy link
Contributor

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)
Copy link
Contributor

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.

@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 13, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2021
@k8s-ci-robot
Copy link
Contributor

@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.

@zoetrope zoetrope closed this Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants