Skip to content

OSDOCS-14472: CPMS custom machine name prefixes #93119

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skopacz1
Copy link
Contributor

@skopacz1 skopacz1 commented May 7, 2025

OSDOCS-14472

Version(s): 4.19+

This PR adds a feature to add custom prefixes to machine names in control plane machine sets.

QE review:

  • QE has approved this change.

Preview: Control plane machine set configuration options

@openshift-ci-robot
Copy link

openshift-ci-robot commented May 7, 2025

@skopacz1: This pull request references OSDOCS-14472 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

In response to this:

OSDOCS-14472

Version(s): 4.19+

This PR adds a feature to add custom prefixes to machine names in control plane machine sets.

QE review:

  • QE has approved this change.

Preview:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 7, 2025
@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 7, 2025
@ocpdocs-previewbot
Copy link

ocpdocs-previewbot commented May 7, 2025

@openshift-ci-robot
Copy link

openshift-ci-robot commented May 8, 2025

@skopacz1: This pull request references OSDOCS-14472 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

In response to this:

OSDOCS-14472

Version(s): 4.19+

This PR adds a feature to add custom prefixes to machine names in control plane machine sets.

QE review:

  • QE has approved this change.

Preview: Control plane machine set configuration options

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this as a procedure based on the docs epic content journey, but if this would be better represented as just a conceptual section with an example snippet (i.e. no instructions on how to edit the CR), let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a really generic (and perhaps not very useful) intro to the new section below. Please feel free to suggest any other wording.

Copy link

openshift-ci bot commented May 8, 2025

@skopacz1: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.


. Save your changes to the `ControlPlaneMachineSet` CR.

. If you are using an `OnDelete` update strategy for your control plane machine set: Manually apply the prefix to the name of any existing machines.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are verification steps to add, please let me know.

For example, what command to run to check machine names, and example output of that command

Comment on lines +34 to +37
** The name contains no more than 253 characters
** The name contains only lowercase alphanumeric characters, `-`, or `.`
** The name starts and ends with an alphanumeric character

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation needs some modification. Please have a look at https://github.com/openshift/api/blob/7318813e48da641a8b2e068018a3723a5cc34d5e/machine/v1/types_controlplanemachineset.go#L45-L61 details.

	// It must be a lowercase RFC 1123 subdomain, consisting of lowercase
	// alphanumeric characters, hyphens ('-'), and periods ('.').
	// Each block, separated by periods, must start and end with an alphanumeric character.
	// Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted.
	// The prefix must be between 1 and 245 characters in length.


. Save your changes to the `ControlPlaneMachineSet` CR.

. If you are using an `OnDelete` update strategy for your control plane machine set: Manually apply the prefix to the name of any existing machines.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually apply the prefix to the name of any existing machines.

I don't think there is any different way to apply the prefix for OnDelete or RollingUpdate update strategy. In both the cases, we need to modify .spec.machineNamePrefix field.

  • For OnDelete : We need to delete an existing machine; then only a new replacement machine will be created with the prefixed name.
  • For RollingUpdate: We need to force a rollout, maybe by adding some labels to the machine template metadata.

/cc @huali9, could you please help with some user-facing commands and outputs which can be added as an example? TiA!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both OnDelete and RollingUpdate, we can delete an existing machine, then a new replacement machine will be created with the prefixed name.
For RollingUpdate, we can also add some labels to the master machine template metadata to force a rollout. for example, under a master machine's .spec.providerSpec.value.metadata, add a label like

      metadata:
        labels:
          old: old

then a new replacement machine will be created with the prefixed name.

-n openshift-machine-api
----

. Add the following snippet to the `ControlPlaneMachineSet` CR:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a snippet? I am not sure if this the right wording here. The intention would be to edit .spec.machineNamePrefix field of ControlPlaneMachineSet CR.

= Adding a custom prefix to control plane machine names

You can customize the prefix of machine names created by a control plane machine set.
This can be done by editing a control plane machine set custom resource (CR)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This can be done by editing a control plane machine set custom resource (CR)
This can be done by editing the control plane machine set custom resource (CR)

[id="cpmso-config-prefix_{context}"]
= Adding a custom prefix to control plane machine names

You can customize the prefix of machine names created by a control plane machine set.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can customize the prefix of machine names created by a control plane machine set.
You can customize the prefix of machine names created by the control plane machine set.


// Saw the step below in another procedure, let me know if it's good to keep it in here.

. Edit your control plane machine set CR by running the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one is the right way to write this?

  • control plane machine set
  • control plane machine set CR
  • control plane machine set custom resource (CR)
  • ControlPlaneMachineSet CR

I am seeing all these are being used interchangeably.


.Procedure

// Saw the step below in another procedure, let me know if it's good to keep it in here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this?

@chiragkyal
Copy link
Member

/cc @huali9

@openshift-ci openshift-ci bot requested a review from huali9 May 9, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/enterprise-4.19 jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants