Skip to content

Validate the resource scope against requested namespace #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 10, 2021

Conversation

nolar
Copy link
Owner

@nolar nolar commented Jan 10, 2021

Essentially, two things:

  • Cluster-scoped resources cannot have namespaced URLs, even if a namespace is accidentally provided.
  • Namespace-scoped resources cannot miss the namespace for individual resources (but can miss it for lists).

Both cases are considered errors with no fallbacks. It is the caller's responsibility to ensure that the namespace matches the resource's scope. In the framework's code, it serves as an additional validation of the correctness of resource management (observations, orchestration).

Besides, test everything with both namespaced and cluster-scoped resources, to make sure both work fine with all units and aspects — but mostly to make this namespaced vs. cluster-scoped separation work with other tests (previously, there were assumptions on the passed namespace to match the resource's namespace-ability, which hypothetically can be wrong).

nolar added 3 commits January 10, 2021 15:20
Essentially, two things:

* Cluster-scoped resources cannot have namespaced URLs, even if a namespace is accidentally provided.
* Namespace-scoped resources cannot miss the namespace for individual resources (but can miss it for lists).

Both cases are considered errors with no fallbacks. It is the caller's responsibility to ensure that the namespace matches the resource's scope. In the framework's code, it serves as an additional validation of the correctness of resource management (observations, orchestration).
@nolar nolar added automation CI/CD: testing, linting, releasing automatically refactoring Code cleanup without new features added labels Jan 10, 2021
@nolar nolar merged commit f190fe5 into master Jan 10, 2021
@nolar nolar deleted the proper-urls-for-clusterscoped-resources branch January 10, 2021 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation CI/CD: testing, linting, releasing automatically refactoring Code cleanup without new features added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant