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

KRM function "ensure-name-substring" should have a parameter "delimiter" #4135

Open
isihu opened this issue Apr 3, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@isihu
Copy link

isihu commented Apr 3, 2024

Describe your problem

I want to provide a kpt package for my users.
I use this function to ensure consistent naming across the resources of the package.
In my kpt package the prefix is set to "example" and added to the resources successfully, e.g. "example-deployment".

When a user clones the kpt package and changes the prefix to "myservice", the name of the deployment becomes "myservice-example-deployment" while I want the name to be "myservice-deployment"

Potential solution

I can provide a delimiter to the functionConfig, like "-". Then the function behaves as follows:

if delimiter in original_resource_name:
  # replace the previous prefix with the new one
  new_resource_name = prefix + delimiter + original_resource_name.split(delimiter, 1)[1] 
else:
  # current behavior
  new_resource_name = prefix + delimiter + original_resource_name 
@isihu isihu added the enhancement New feature or request label Apr 3, 2024
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

1 participant