Skip to content

Add KernelArguments to MachineConfig - #762

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
cgwalters:kargs
May 27, 2019
Merged

openshift-merge-robot merged 1 commit into
openshift:masterfrom
cgwalters:kargs

Conversation

@cgwalters

@cgwalters cgwalters commented May 15, 2019 •

Copy link
Copy Markdown
Member

We need to support things like adding nosmt to the kernel
commandline, for users that want to choose security over performance;
this is particularly relevant for multi-tenant clusters.
There are a lot of other "tuning" features that are expressed as
kernel cmdline args; down the line we want node-tuning-operator
to write something like machineconfig/05-node-tuning-operator.

Per discussion in the PR, we may consider adding
an operatingsystem CRD or so that would be a high level wrapper
for this, but today everything else is expressed in MachineConfig,
so we need to extend this type.

There have also been some discussions about extending Ignition,
but that's not likely to land soon, and even if it did we still
need to handle "early pivot" pulling machine-os-content, and
scoping both OS updates and kargs into Ignition is too far out.

This is the first step which will support "day 2" configuration.
After this lands, we have further work to have the MCS provide
MachineConfig and not just Ignition, so that we can replace
the "early pivot" with MCD code.

Closes: #388

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 15, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2019
Comment thread pkg/daemon/update.go Resolved
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2019
@cgwalters

Copy link
Copy Markdown
Member Author

Updated and tested with this MC:

apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels:
    machineconfiguration.openshift.io/role: worker
  name: 05-walters-mctest-worker-nosmt
spec:
  config:
    ignition:
      version: 2.2.0
  kernelArguments:
    - nosmt

And I correctly get nosmt in the kargs on my worker nodes 🎉

Comment thread pkg/daemon/update.go Resolved
Comment thread pkg/daemon/update.go Resolved
@ashcrow

ashcrow commented May 16, 2019

Copy link
Copy Markdown
Member

Looks good so far! When this makes it in let's not forget to drop the pivot interface.

@cgwalters

cgwalters commented May 17, 2019 •

Copy link
Copy Markdown
Member Author

When this makes it in let's not forget to drop the pivot interface.

Yeah, though we'll need to ratchet by landing this, then switch the installer over to use it, then we can drop the pivot component.

And...hum actually this goes straight into https://github.com/coreos/coreos-installer/issues/13 - we're served Ignition, not MachineConfig, so we won't have KernelArguments. But we really want to handle those kargs during the early pivot so we're not rebooting twice.

Hmm. Hmm. I think what we really want to do is have a mechanism to "invert" things and inject the extra stuff (today osImageURL, w/this PR also kernelArguments) from MachineConfig into the Ignition, and then have a host side service that processes the extra bits.

This would really be moving pivot to be "machineconfig handling for updates + kargsl". I think the simplest thing may be that we actually move the pivot code into the MCD, and when we go to build RHCOS we extract the binary from the MCD container or so, rather than building an RPM. (That entangles the build systems in an interesting way though)

Or: we make this bit common between FCOS/RHCOS and add kargs into Ignition.

@ashcrow

ashcrow commented May 17, 2019 •

Copy link
Copy Markdown
Member

Or: we make this bit common between FCOS/RHCOS and add kargs into Ignition.

I feel like that would be a big win and help bring the two closer together if it's feasible. /cc @bgilbert @ajeddeloh @dustymabe

@bgilbert

Copy link
Copy Markdown
Contributor

For Ignition kargs discussion, see https://github.com/coreos/ignition-dracut/issues/81. Note that it currently presumes a mechanism along the lines of ostreedev/ostree#479 (comment).

@cgwalters

Copy link
Copy Markdown
Member Author

Oh hey cool, this passed the new e2e test I added!

--- PASS: TestKernelArguments (189.01s)
        mcd_test.go:296: Created kargs-81bd2992-78dc-11e9-b495-0a58ac10166e
        mcd_test.go:115: Pool worker has rendered config kargs-81bd2992-78dc-11e9-b495-0a58ac10166e with rendered-worker-431eab0a737953d758eacf1c99c1b9f1 (waited 2.032938681s)
        mcd_test.go:139: Pool worker has completed rendered-worker-431eab0a737953d758eacf1c99c1b9f1 (waited 2m52.017149132s)
        mcd_test.go:327: Node ip-10-0-131-46.ec2.internal has expected kargs
        mcd_test.go:327: Node ip-10-0-143-244.ec2.internal has expected kargs
        mcd_test.go:327: Node ip-10-0-147-161.ec2.internal has expected kargs

But it failed units...looking at that.

Will look at the other review comments here too.

But we need to close the debate pretty soon - are we all OK with extending MachineConfig in this fashion, or do we want to try creating a new operatingsystem.openshift.io CRD or something?

@runcom

runcom commented May 17, 2019

Copy link
Copy Markdown
Member

But we need to close the debate pretty soon - are we all OK with extending MachineConfig in this fashion, or do we want to try creating a new operatingsystem.openshift.io CRD or something?

This is tricky, we got so may inputs and ideas (at a point, we wanted also something on top of MachineConfig to be more sugar to allow for a nice upgrade to ignv2s3). The CRD to allow us oc edit kargs was from the beginning an amazing view and idea (oc edit fips anyone?).

My preference would go to a new CRD though (operatingsystem sounds perfect and extensible/reusable) and it follows what we did with KubeletConfig and ContainerRuntimeConfig (both of them eventually create MachineConfigs so we could also use the same pattern here somehow?). Also, we could still have a nice CRD on top of the MachineConfig and leave the implementation in this PR to land as is now.

@cgwalters

cgwalters commented May 18, 2019 •

Copy link
Copy Markdown
Member Author

My preference would go to a new CRD though (operatingsystem sounds perfect and extensible/reusable) and it follows what we did with KubeletConfig and ContainerRuntimeConfig (both of them eventually create MachineConfigs so we could also use the same pattern here somehow?).

Yeah...what has me hesitating about that is all the copy-paste involved in the "sub-controllers". But eh, we can figure that out.

Also, we could still have a nice CRD on top of the MachineConfig and leave the implementation in this PR to land as is now.

That's an interesting point. I had thought that for this we'd "bypass" MachineConfig so we wouldn't have the options twice, but that would involve a bigger rearchitecting.

Maybe there aren't that many special things that aren't basically files (i.e. Ignition), so we won't have to duplicate too much...I am actually having a bit of trouble thinking of anything besides kargs and osimageurl that are special.

@runcom

runcom commented May 18, 2019 •

Copy link
Copy Markdown
Member

I am actually having a bit of trouble thinking of anything besides kargs and osimageurl that are special.

sebooleans? we had a doc at some point 🤔 but maybe sebooleans (timeservers and the like) aren't really operating system

@cgwalters

Copy link
Copy Markdown
Member Author

sebooleans?

Oh yeah that's a good one.

As far as other things like timeservers - this topic is kind of more about things that can't obviously "compile down" to just writing files or changing kernel args. Timeservers should basically just be writing a file. I think FIPS is potentially a good example as you need to run this update-crypto-policy command. But on the other hand...we can write a systemd unit that does it based on a file (or perhaps better, ship the unit with RHCOS by default).

@runcom

runcom commented May 18, 2019

Copy link
Copy Markdown
Member

I think FIPS is potentially a good example as you need to run this update-crypto-policy command. But on the other hand...we can write a systemd unit that does it based on a file (or perhaps better, ship the unit with RHCOS by default).

oh yeah, FIPS is the follow up of this anyway (I'm ok on a pre-shipped unit as well if it works for RHCOS, but exercising it w/o a unit would be nice also).

Ok, let's sum this up, I believe we can overload MachineConfig with Kargs|FIPS|Sebooleans and abstract those out with CRDs in follow ups if we really want to (even before next release for kargs|fips).
The MC object is still the way to let MCD know what it has to do to when reconciling to a given config. Am I missing something? 🤔 even if we want sugar on top (or on the side), the MC is still the last unit in the chain that the MCD understands.

@cgwalters

Copy link
Copy Markdown
Member Author

/retest

@ashcrow

ashcrow commented May 20, 2019

Copy link
Copy Markdown
Member
The container could not be located when the pod was terminated
May 20 14:21:18.352 I test="[Disruptive] Cluster upgrade should maintain a functioning cluster [Feature:ClusterUpgrade] [Suite:openshift] [Serial]" failed

@ashcrow

ashcrow commented May 20, 2019

Copy link
Copy Markdown
Member

/test e2e-aws-upgrade

@cgwalters

Copy link
Copy Markdown
Member Author

The upgrade failure seems unrelated, seeing that in a few other jobs in https://prow.svc.ci.openshift.org/?job=*e2e-aws-upgrade*&state=failure
/retest

@cgwalters cgwalters changed the title WIP: Add KernelArguments to MachineConfig Add KernelArguments to MachineConfig May 20, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2019
We need to support things like adding `nosmt` to the kernel
commandline, for users that want to choose security over performance;
this is particularly relevant for multi-tenant clusters.
There are a lot of other "tuning" features that are expressed as
kernel cmdline args; another good exmaple is to have `node-tuning-operator`
to write something like `machineconfig/05-node-tuning-operator`.

Per discussion in the PR, we down the line probably want to add
an `operatingsystem` type or so that would be a high level wrapper
for this, but today everything else is expressed in `MachineConfig`,
so we need to extend this type.

There have also been some discussions about extending Ignition,
but that's not likely to land soon, and even if it did we still
need to handle "early pivot" pulling `machine-os-content`, and
scoping both OS updates and kargs into Ignition is too far out.

This is the first step which will support "day 2" configuration.
After this lands, we have further work to have the MCS provide
`MachineConfig` and not just Ignition, so that we can replace
the "early pivot" with MCD code.

Closes: openshift#388
@cgwalters

Copy link
Copy Markdown
Member Author

OK, updated the commit message, and also updated the MachineConfig docs a bit. (I dropped the osImageURL stuff mostly from the user-facing docs since...they shouldn't/can't-really touch that)

I think this is probably good to go ⏩ ?

@runcom

runcom commented May 21, 2019

Copy link
Copy Markdown
Member

/retest

@runcom

runcom commented May 21, 2019

Copy link
Copy Markdown
Member

Uhm, looks like upgrade is stuck from e2e?

@cgwalters

Copy link
Copy Markdown
Member Author

/retest

@runcom

runcom commented May 27, 2019

Copy link
Copy Markdown
Member

Guess this is really good now, @ashcrow @miabbott this is a prereq for FIPS as well so we now have something to test with

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 27, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, runcom

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

The pull request process is described here

Details 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

@openshift-merge-robot
openshift-merge-robot merged commit 470f219 into openshift:master May 27, 2019
ashcrow added a commit to ashcrow/pivot that referenced this pull request May 28, 2019
This functionality has been replaced within the MCO.

See: openshift/machine-config-operator#762

This reverts commit 9383200.
@cgwalters cgwalters mentioned this pull request May 28, 2019
Comment thread pkg/daemon/update.go
return nil
}
if dn.OperatingSystem != machineConfigDaemonOSRHCOS {
return fmt.Errorf("Updating kargs on non-RHCOS nodes is not supported: %v", diff)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

now that I'm looking at this, should we just return nicely as we do for updateOS 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread pkg/daemon/update.go
// kargs
if err := dn.updateKernelArguments(oldConfig, newConfig); err != nil {
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

and I've now found that we need to roll this back if we fail 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ptalgulk01 pushed a commit to ptalgulk01/machine-config-operator that referenced this pull request May 15, 2026
 Add KernelArguments to MachineConfig
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support kernel arguments

6 participants