hierarchical-namespaces icon indicating copy to clipboard operation
hierarchical-namespaces copied to clipboard

Add labels/annotations to the subnamespace (or its anchor) at creation time

Open fpoirotte opened this issue 1 year ago • 5 comments

Hello,

I would like to be able to define labels/annotations for a new subnamespace at the time it is created. Something along the lines of:

kubectl hns create -n parent child --annotation foo=bar --annotation baz=qux --label tata=titi --label toto=tutu

Currently, this requires first creating the subnamespace, then updating it to add the annotations/labels. I was hoping that the two operations could be merged into one.

What do you think?

fpoirotte avatar Jun 23 '23 18:06 fpoirotte

The raw capability for this already exists: the SubnamespaceAnchor has label and annotation fields here. Adding command-line flags to kubectl-hns to populate those seems like a good idea and quite easy to do - please feel free to add that!

adrianludwin avatar Jun 23 '23 18:06 adrianludwin

@adrianludwin Using SubnamespaceAnchor and trying to add metadata.labels does not work, it does not add the labels, instead the labels have to be added after the namespaces have already been created - which is the original issue. See #323 .

aboncok avatar Aug 22 '23 20:08 aboncok

Sorry for the delay - you need to use spec.labels, not metadata.labels, see my latest comment in #323.

adrianludwin avatar Sep 15 '23 19:09 adrianludwin

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues 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 as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Jan 28 '24 12:01 k8s-triage-robot

/remove-lifecycle stale

manjinder-mckc avatar Jan 31 '24 10:01 manjinder-mckc

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues 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 as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

k8s-triage-robot avatar Apr 30 '24 11:04 k8s-triage-robot