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

📖 Document the immutability of machine templates #3105

Merged
merged 1 commit into from
May 29, 2020

Conversation

scottslowe
Copy link
Contributor

What this PR does / why we need it:
This PR adds documentation regarding the immutability of machine templates, and provides information on the recommended process for modifying a machine template. This PR adds a new page, a link to the sidebar, and modifies the Tasks/KCP page to reference the new page.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2557

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 27, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @scottslowe. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 27, 2020
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 27, 2020
@ncdc
Copy link
Contributor

ncdc commented May 27, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 27, 2020
@ncdc
Copy link
Contributor

ncdc commented May 27, 2020

@scottslowe would you mind breaking long lines at ~100 characters? It makes it easier to comment. Thanks!

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 27, 2020
@scottslowe
Copy link
Contributor Author

@ncdc Done, sorry about that!

docs/book/src/tasks/change-machine-template.md Outdated Show resolved Hide resolved

Several different components of Cluster API leverage _infrastructure machine templates_,
including `KubeadmControlPlane`, `MachineDeployment`, and `MachineSet`. These
`MachineTemplate` resources are **immutable** and are not intended to be modified
Copy link
Contributor

Choose a reason for hiding this comment

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

xref kubernetes-sigs/cluster-api-provider-aws#1711. I know you mention at the bottom that providers may decide to support some field changes, but I wonder if we should highlight this use case here, or soften/clarify the immutable bit here?

Copy link
Member

Choose a reason for hiding this comment

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

+1 I'd say that they should be immutable, unless the documentation on the infrastructure provider states otherwise for certain fields

cc @rudoi @sethp-nr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed via af55bb4.

docs/book/src/tasks/change-machine-template.md Outdated Show resolved Hide resolved
`MachineDeployment`s spec will begin a rolling update of the workload machines.
`MachineDeployment`s spec will begin a rolling update of the workload machines. As described in
[this section on changing a `MachineTemplate`](./change-machine-template.md), infrastructure machine
templates are immutable and should not be modified directly; follow the instructions there for
Copy link
Member

Choose a reason for hiding this comment

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

Given that infrastructure provider might relax the immutability, here I suggest to simplify an simply link the other page. e.g.

follow these instruction for changing the template for an existing MachineDeployment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes incorporated into af55bb4.

Fields that might need to be modified could include the SSH key, the AWS instance
type, or the Azure machine type). Refer to the provider-specific documentation
for more details on the specific fields that each provider requires or accepts.
3. Give the newly-modified template a new name by modifying the `metadata.name` field.
Copy link
Member

Choose a reason for hiding this comment

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

Or using metadata.generateName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added via af55bb4.

@fabriziopandini
Copy link
Member

thanks @scottslowe
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, scottslowe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2020
for more details on the specific fields that each provider requires or accepts.
3. Give the newly-modified template a new name by modifying the `metadata.name` field
(or by using `metadata.generateName`).
4. Create the new infrastructure machine template on the API server using `kubectl`.
Copy link
Contributor

Choose a reason for hiding this comment

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

If you saved to disk as indicated in step 1, you'll also need to clear out the resource version before trying to send it to the apiserver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ncdc Should I omit this command entirely? Is there a better way to generate a new machine template?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would just add a parenthetical that says make sure you clear out the RV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ncdc Have a look at this updated wording and let me know what you think (added in 276fe9f).

@ncdc
Copy link
Contributor

ncdc commented May 29, 2020

LGTM. Please squash. Thanks!

Add documentation regarding the immutability of machine templates. Add new document to book summary. Create link from existing KCP page.

Signed-off-by: Scott Lowe <[email protected]>
@scottslowe
Copy link
Contributor Author

@ncdc Commits squashed, thanks!

@ncdc
Copy link
Contributor

ncdc commented May 29, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 29, 2020
@k8s-ci-robot k8s-ci-robot merged commit 87c0343 into kubernetes-sigs:master May 29, 2020
@scottslowe scottslowe deleted the issue-2557 branch May 30, 2020 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Document infrastructure machine templates & immutability
6 participants