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

OCPBUGS-17585: Tighten the rules for modifying Tuned Profiles #775

Conversation

jmencak
Copy link
Contributor

@jmencak jmencak commented Aug 29, 2023

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways. First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec. Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

This change also simplifies the mechanism for accepting kernel
command-line parameters as calculated by the NTO operands. Now, all NTO
operands must agree on the calculated kernel command-line parameters.

ClusterOperator/node-tuning now also reports operand version. The
operand version changes only when all operand replicas have successfully
upgraded and are ready. This information is used to block PPC
Reconcilation loop until the operator and operand RELEASE_VERSION agree.
This is a short-term measure to prevent from multiple node reboots
during upgrades.

Other fixes:

  • Disallow MC updates during upgrades when kernel command-line
    parameters of nodes within a MCP do not match.
  • ClusterOperator/node-tuning object was sometimes giving false
    information based on an old Metadata.Generation.

Resolves: OCPBUGS-17585

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 29, 2023

@jmencak: GitHub didn't allow me to request PR reviews from the following users: jmencak.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways. First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec. Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

Resolves: OCPBUGS-17585

/cc

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.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2023
@jmencak
Copy link
Contributor Author

jmencak commented Aug 29, 2023

/payload-aggregate periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade 10

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 29, 2023

@jmencak: trigger 1 job(s) for the /payload-(job|aggregate) command

  • periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/4c0e1b00-4668-11ee-83f0-1bac13c94f74-0

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 29, 2023

@jmencak: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test e2e-aws-operator
  • /test e2e-aws-ovn
  • /test e2e-gcp-pao
  • /test e2e-gcp-pao-updating-profile
  • /test e2e-gcp-pao-workloadhints
  • /test e2e-hypershift
  • /test e2e-no-cluster
  • /test e2e-upgrade
  • /test images
  • /test unit
  • /test verify
  • /test vet

Use /test all to run all jobs.

In response to this:

/test ci/prow/e2e-gcp-pao-updating-profile

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.

@jmencak jmencak force-pushed the 4.14-OCPBUGS-17585-profiles-subresource branch 2 times, most recently from a11c6d7 to 38b7d94 Compare August 29, 2023 17:10
@jmencak
Copy link
Contributor Author

jmencak commented Aug 29, 2023

/retest

@jmencak
Copy link
Contributor Author

jmencak commented Aug 30, 2023

/payload-aggregate periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade 10

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2023

@jmencak: trigger 1 job(s) for the /payload-(job|aggregate) command

  • periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/829adea0-46fa-11ee-9c97-6d9651431b8b-0

@jmencak
Copy link
Contributor Author

jmencak commented Aug 30, 2023

/cc @MarSik
As discussed on Monday, only block PPC reconciliation loop on upgrades. I've intentionally split this PR into 2 commits. The first one was already reviewed by @dagrayvid . Please take a look at mostly the parts affecting PPC.

@openshift-ci openshift-ci bot requested a review from MarSik August 30, 2023 06:05
@jmencak jmencak force-pushed the 4.14-OCPBUGS-17585-profiles-subresource branch from 38b7d94 to 8d65cd4 Compare August 30, 2023 07:11
NTO operands allow updating Tuned Profiles.  This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways.  First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec.  Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

This change also simplifies the mechanism for accepting kernel
command-line parameters as calculated by the NTO operands.  Now, all NTO
operands must agree on the calculated kernel command-line parameters.

ClusterOperator/node-tuning now also reports operand version.  The
operand version changes only when all operand replicas have successfully
upgraded and are ready.  This information is used to block PPC
Reconcilation loop until the operator and operand RELEASE_VERSION agree.
This is a short-term measure to prevent from multiple node reboots
during upgrades.

Other fixes:
  - Disallow MC updates during upgrades when kernel command-line
    parameters of nodes within a MCP do not match.
  - ClusterOperator/node-tuning object was sometimes giving false
    information based on an old Metadata.Generation.

Resolves: OCPBUGS-17585
@jmencak jmencak force-pushed the 4.14-OCPBUGS-17585-profiles-subresource branch from 8d65cd4 to c756bbd Compare August 30, 2023 12:36
@jmencak jmencak changed the title Tighten the rules for modifying Tuned Profiles OCPBUGS-17585: Tighten the rules for modifying Tuned Profiles Aug 30, 2023
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Aug 30, 2023
@openshift-ci-robot
Copy link
Contributor

@jmencak: This pull request references Jira Issue OCPBUGS-17585, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (liqcui@redhat.com), skipping review request.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful lTighten the rules for modifying Tuned Profiles

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways. First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec. Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

This change also simplifies the mechanism for accepting kernel
command-line parameters as calculated by the NTO operands. Now, all NTO
operands must agree on the calculated kernel command-line parameters.

ClusterOperator/node-tuning now also reports operand version. The
operand version changes only when all operand replicas have successfully
upgraded and are ready. This information is used to block PPC
Reconcilation loop until the operator and operand RELEASE_VERSION agree.
This is a short-term measure to prevent from multiple node reboots
during upgrades.

Other fixes:

  • Disallow MC updates during upgrades when kernel command-line
    parameters of nodes within a MCP do not match.
  • ClusterOperator/node-tuning object was sometimes giving false
    information based on an old Metadata.Generation.

Resolves: OCPBUGS-17585

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.

@jmencak
Copy link
Contributor Author

jmencak commented Aug 30, 2023

/payload-aggregate periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade 10

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2023

@jmencak: trigger 1 job(s) for the /payload-(job|aggregate) command

  • periodic-ci-openshift-release-master-ci-4.14-upgrade-from-stable-4.13-e2e-gcp-ovn-rt-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/9e0ccd00-4732-11ee-97fb-2046709d4fbf-0

@openshift-ci-robot
Copy link
Contributor

@jmencak: This pull request references Jira Issue OCPBUGS-17585, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (liqcui@redhat.com), skipping review request.

In response to this:

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways. First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec. Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

This change also simplifies the mechanism for accepting kernel
command-line parameters as calculated by the NTO operands. Now, all NTO
operands must agree on the calculated kernel command-line parameters.

ClusterOperator/node-tuning now also reports operand version. The
operand version changes only when all operand replicas have successfully
upgraded and are ready. This information is used to block PPC
Reconcilation loop until the operator and operand RELEASE_VERSION agree.
This is a short-term measure to prevent from multiple node reboots
during upgrades.

Other fixes:

  • Disallow MC updates during upgrades when kernel command-line
    parameters of nodes within a MCP do not match.
  • ClusterOperator/node-tuning object was sometimes giving false
    information based on an old Metadata.Generation.

Resolves: OCPBUGS-17585

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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 30, 2023

@jmencak: 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/test-infra repository. I understand the commands that are listed here.

@jmencak
Copy link
Contributor Author

jmencak commented Aug 30, 2023

@MarSik, all tests passed and the blocking job also succeeded successfully all 3 times I tried. I belive I've hopefully also addressed your concerns.

return nil
}

bootcmdline := profile.Status.Bootcmdline
if ok := c.allNodesAgreeOnBootcmdline(nodes); !ok {
return fmt.Errorf("not all %d Nodes in MCP %v agree on bootcmdline: %s", len(nodes), pools[0].ObjectMeta.Name, bootcmdline)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this propagate to the Status section of the Tuned object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean. Tuned CR/object doesn't really use status.

Copy link
Contributor

@MarSik MarSik left a comment

Choose a reason for hiding this comment

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

/lgtm

I like it, just make sure the user will be visibly informed when the nodes do not agree and update is blocked. The same about the version mismatch, we should report that in the status (probably as a condition).

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 31, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 31, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jmencak, MarSik

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

@jmencak
Copy link
Contributor Author

jmencak commented Aug 31, 2023

I like it, just make sure the user will be visibly informed when the nodes do not agree and update is blocked. The same about the version mismatch, we should report that in the status (probably as a condition).

Let's do this as a follow up PR, this needs to get in.

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Aug 31, 2023
@openshift-merge-robot openshift-merge-robot merged commit 0c4ce0a into openshift:master Aug 31, 2023
13 checks passed
@openshift-ci-robot
Copy link
Contributor

@jmencak: Jira Issue OCPBUGS-17585: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-17585 has been moved to the MODIFIED state.

In response to this:

NTO operands allow updating Tuned Profiles. This is intentional and by design
as some host information needs to be communicated back to the NTO operator,
but this also allows a successful local attacker potentially affect node-level
configuration of other cluster nodes.

This change addresses the situation in two ways. First, scoped RBAC
permissions on Profile.status subresource is used to disallow Node-level
write access to Profile.spec. Second, the Node resource is used to provide
status loops back to NTO using the kubelet credential to write an annotation
to the Node resource.

This change also simplifies the mechanism for accepting kernel
command-line parameters as calculated by the NTO operands. Now, all NTO
operands must agree on the calculated kernel command-line parameters.

ClusterOperator/node-tuning now also reports operand version. The
operand version changes only when all operand replicas have successfully
upgraded and are ready. This information is used to block PPC
Reconcilation loop until the operator and operand RELEASE_VERSION agree.
This is a short-term measure to prevent from multiple node reboots
during upgrades.

Other fixes:

  • Disallow MC updates during upgrades when kernel command-line
    parameters of nodes within a MCP do not match.
  • ClusterOperator/node-tuning object was sometimes giving false
    information based on an old Metadata.Generation.

Resolves: OCPBUGS-17585

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.

@jmencak jmencak deleted the 4.14-OCPBUGS-17585-profiles-subresource branch September 4, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants