Skip to content

Instantly share code, notes, and snippets.

@magickatt
Last active April 19, 2024 21:25
Show Gist options
  • Save magickatt/2b4332b01ef7dd0f3b2bc7fc7b3c0953 to your computer and use it in GitHub Desktop.
Save magickatt/2b4332b01ef7dd0f3b2bc7fc7b3c0953 to your computer and use it in GitHub Desktop.

Revisions

  1. magickatt revised this gist Apr 19, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion convert_namespace_to_subnamespace.sh
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,4 @@ metadata:
    name: $CHILD_NAMESPACE
    EOF

    # subnamespaceanchor.hnc.x-k8s.io/sa-pepperoni created
    # subnamespaceanchor.hnc.x-k8s.io/pepperoni created
  2. magickatt created this gist Apr 19, 2024.
    17 changes: 17 additions & 0 deletions convert_namespace_to_subnamespace.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    PARENT_NAMESPACE=pizzeria
    CHILD_NAMESPACE=pepperoni

    $ kubectl annotate namespace $CHILD_NAMESPACE \
    hnc.x-k8s.io/subnamespace-of=$PARENT_NAMESPACE

    # namespace/pepperoni annotated

    $ cat <<EOF | kubectl apply -f -
    apiVersion: hnc.x-k8s.io/v1alpha2
    kind: SubnamespaceAnchor
    metadata:
    namespace: $PARENT_NAMESPACE
    name: $CHILD_NAMESPACE
    EOF

    # subnamespaceanchor.hnc.x-k8s.io/sa-pepperoni created