Skip to content

skupper.v2.resources ignores def.metadata.namespace for system sites #81

@hash-d

Description

@hash-d

Calls to skupper.v2.resources without namespace defined on the top level field create resources on the default namespace, even if the namespace is defined within def.metadata.namespace. This behavior is specific to system sites.

This can cause situations that are difficult for a user to debug, as there are no failures, and still the resources do not get created (at least not in the right place).

On Kubernetes sites, if the namespace is set on the definition only, the task fails:

TASK [Create a Listener] ***************************************************************************************************
task path: /gist/35b27c16f8b4f1bc4f8b1716c3f3756d/main.yaml:18
fatal: [localhost]: FAILED! => changed=false 
  msg:
  - namespace cannot be set to 'None' as resource (skupper.io/v2alpha1/Listener) is defined with namespace 'asdf'

Ideally, all platforms should behave the same in this regard. kubernetes.core.k8s could be used as a paradigm:

 namespace  Use to specify an object namespace.
          Useful when creating, deleting, or discovering an object without providing a full resource definition.
          Use in conjunction with api_version, kind, and name to identify a specific object.
          If resource definition is provided, the metadata.namespace value from the resource_definition will override this option.
    default: null
    type: str

Otherwise, having both kube and non-kube fail in case namespace is defined on the definition only would be the second-best approach.

Reproducer available on https://gist.github.com/hash-d/35b27c16f8b4f1bc4f8b1716c3f3756d

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions