Skip to content
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

[Feature] Customize prefix of name of the ephemeral generated namespace #2155

Open
1 task done
ChrisV404 opened this issue Nov 18, 2024 · 2 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@ChrisV404
Copy link

ChrisV404 commented Nov 18, 2024

Problem Statement

Currently I have a need to run tests in a namespace with a certain prefix in the name. I'd still want to maintain the random name generated by Chainsaw as the suffix. The tests require certain Roles that exist in my cluster. The prefix will enforce isolation to block access of the namespace to anyone (or anything) that don't possess the valid Role.

Solution Description

I'd like to configure the prefix of the namespace at the Test spec level and in the Configuration file.

Potential solution at the Test spec level:

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
  name: my-test
  labels:
    group: basic
spec:
  description: "First Test"
  namespace-prefix: "my-test"   # The namespace would look like: my-test-<random-string>-<random-string>

Potential solution in Configuration:

apiVersion: chainsaw.kyverno.io/v1alpha2
kind: Configuration
metadata:
  name: tests-config
spec:
  namespace-prefix: "my-test"

Alternatives

As of right now, I couldn't find any workaround for this.

Additional Context

No response

Slack discussion

No response

Research

  • I have searched other issues in this repository and mine is not recorded.
@ChrisV404 ChrisV404 added the enhancement New feature or request label Nov 18, 2024
@eolatham
Copy link

Great idea, this would allow the user to override the default prefix of chainsaw.

Minor suggestion: maybe the new property name should be namespacePrefix instead of namespace-prefix to follow the convention of the other properties.

@eddycharly
Copy link
Member

You can configure it in the config:

  namespace:
    template:
      metadata:
        name: (join('-', ['prefix', $namespace]))

Would this work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants