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

Configurable namingStrategy for KCP, MD and MP in classy Clusters #9323

Closed
sbueringer opened this issue Aug 28, 2023 · 3 comments
Closed

Configurable namingStrategy for KCP, MD and MP in classy Clusters #9323

sbueringer opened this issue Aug 28, 2023 · 3 comments
Assignees
Labels
area/clusterclass Issues or PRs related to clusterclass kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@sbueringer
Copy link
Member

sbueringer commented Aug 28, 2023

Some context:

  • In clusters that are not using ClusterClass users can freely decide on how to name KCP, MD and MP objects.
  • This allows users to follow naming conventions for KCP / MD / MS / Machine objects and eventually infrastructure resources
    • Note: In CAPI it is generally undefined how or if a Machine name maps to a specific infrastructure resource name. Some provider might guarantee a certain mapping or even use the Machine name directly for a server.
  • With ClusterClass today we generate names as follows:
    • KCP: {cluster-name}-{random-suffix}
    • MD: {cluster-name}-{md-topology-name}-{random-suffix}
    • MP: {cluster-name}-{mp-topology-name}-{random-suffix}

As a management cluster operator I would like to be able to configure how KCP, MD and MP objects are named in classy Clusters.

Note: This is also important to reach feature parity between classy and non-classy Clusters, so folks that have to follow naming conventions can start using ClusterClass.

Proposal

The proposal is now basically to make the currently hard-coded name formats configurable.

Per default the behavior stays the same as today.
Additionally users can customize the names by providing a namingStrategy on the ClusterClass

Example:

apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
spec:
  controlPlane:
    namingStrategy:
      name: "{{ .cluster.name }}-{{ .randomSuffix }}"
  workers:
    machineDeployments:
    - class: "default-worker"
      namingStrategy:
        name: "{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .randomSuffix }}"
   # Same for MachinePools

Notes:

  • the names are simple go templates
  • they will get some data that can be used for rendering that should be ~ aligned to builtin variables for ClusterClass (although we only provide a very small subset of those variables as things like e.g. MD replicas or version don't make sense)
  • Existing objects are not affected, we will only generate a name once per object on creation
  • If we're getting close to the max name lengths we should follow the same pattern as the SimpleNameGenerator to ensur the last few characters are a random string.
  • Required changes: ClusterClass API type, name calculation, e2e test coverage (just set namingStrategies in one of our test ClusterClasses)
  • We would like to propose to cherry-pick this back into v1.5 (based on "Enhancements or additions to experimental Cluster API features" (CONTRIBUTIN.md)
@sbueringer sbueringer added kind/feature Categorizes issue or PR as related to a new feature. area/clusterclass Issues or PRs related to clusterclass labels Aug 28, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 28, 2023
@sbueringer
Copy link
Member Author

/triage accepted

/assign @chrischdi
/assign @killianmuldoon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 28, 2023
@sbueringer sbueringer added this to the v1.6 milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterclass Issues or PRs related to clusterclass kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants