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

No metadata.namespace field in the HierarchyConfiguration CRD jsonschema

Open hrk091 opened this issue 1 year ago • 4 comments

HierarchyConfiguration CRD is patched to make it singleton by https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/master/hack/crd_patches/singleton-enum-patch.sh, but metadata.namespace field is not defined there. While HNCConfiguration is global singleton, HierarchyConfiguration is namespaced singleton so there should be metadata.namespace field in the HierarchyConfiguration CRD.

Now I’m trying validate manifests including HierarchyConfiguration resources using kubeconfirm, and it has reported the following Error:

HierarchyConfiguration hierarchy is invalid: problem validating schema. Check JSON formatting: jsonschema: '/metadata' does not validate with file:///generated/crd_schemas/eval/hierarchyconfiguration-hnc-v1alpha2.json#/properties/metadata/additionalProperties: additionalProperties 'namespace' not allowed

It seems that the namespace property needs to be added here as follows:

            # This is patched by hack/crd_patches/singleton-enum-patch.sh
            properties:
              name:
                type: string
                enum:
                  - hierarchy
+             namespace:
+               type: string

hrk091 avatar Sep 27 '23 13:09 hrk091