project-codeflare / multi-cluster-app-dispatcher

Holistic job manager on Kubernetes
Apache License 2.0
108 stars 63 forks source link

Force creation of generic items into AppWrapper deployment namespace #665

Closed tardieu closed 1 year ago

tardieu commented 1 year ago

This PR makes sure that generic items are created in the same namespace as the AppWrapper. If the metadata of the generic item explicitly specifies a namespace that is different from the AppWrapper deployment namespace, an error message is generated to report the discrepancy and the resource creation fails. If the specified namespace is equal to the AppWrapper namespace or if no explicit namespace is specified then the creation can process in the AppWrapper namespace.

This PR does not affect the creation of cluster scoped resources, which was already prohibited.

This PR modifies MCAD's behavior when resources do not specify a namespace. They used to be deployed in the default namespace irrespective of the AppWrapper namespace. Now they will be deployed in the AppWrapper namespace instead. Alternatively, we could check the namespace without changing the existing behavior. In the long term though, if the deployment namespace can only be the appwrapper namespace, it does not make much sense to require the namespace in the resource definition, i.e., interpret the absence of a namespace as the default namespace.

tardieu commented 1 year ago

It's still possible for users to delete existing resources in namespaces they are not granted permissions to.

Ok. I added the same fix on resource deletion.

astefanutti commented 1 year ago

/lgtm

astefanutti commented 1 year ago

/approve

openshift-ci[bot] commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astefanutti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/project-codeflare/multi-cluster-app-dispatcher/blob/main/OWNERS)~~ [astefanutti] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment