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

Add a new FIPS test #25362

Merged
merged 1 commit into from Oct 13, 2020
Merged

Conversation

cgwalters
Copy link
Member

See discussion in
openshift/release#10488
and https://bugzilla.redhat.com/show_bug.cgi?id=1861095

This test replaces the bash code in the release repo
with a more proper test here.

While here I noticed that the topology tests had some code
that reused the MCD as a handy privileged pod; extract
that to the toplevel utils and use both here and there.

@cgwalters
Copy link
Member Author

cgwalters commented Jul 31, 2020

EDIT: Actually I did test this in FIPS mode, the local libvirt cluster I had was using fips: true in the install config when I was previously debugging this.

@cgwalters
Copy link
Member Author

Hmm indeed something is going wrong in fips; in this e2e-aws-fips run the install config has fips: true but it's not set in the machineconfig.

It is working for me in a local run.

But this would be much nicer to debug if we weren't dealing with the shell test failure. (That's openshift/release#10488 - the problem isn't obvious to me and to be honest felt easier to rewrite than to debug and fix; bash is easy to write, but fragile in failure cases and hard to debug/maintain)

@smarterclayton
Copy link
Contributor

The problem with this test is that you need to know that FIPS is on. The point of the other check is a) to check that the cluster ack'd that FIPS was on, and then b) to run a test suite that verifies normal function. Since FIPS is not always on, this test doesn't replace the check in the ci code (which inits FIPS and then verifies a user observable side effect, then runs one or more suites). We don't want to have a FIPS version of each suite, so we would probably need to have a "FIPS suite" that has 1-N tests that check FIPS explicitly, then in CI testing run two suites.

However, if you do that, you have to either backport that to all previous releases, or make the version check in the CI code do one of two things (if the suite is available from openshift-tests, run that, otherwise run the script for legacy behavior). It's probably easier to just fix the CI check for the new code to start with so that we can get back to green.

@cgwalters
Copy link
Member Author

By the nature of Ignition, we enable FIPS from the very first thing. Our whole architecture is designed around this "system is in desired state" by the time we get to the real root. Specifically for FIPS in RHCOS we actually implement an extra reboot if we detect FIPS to enter that state before we do anything else. It's not like Ansible where there would be some portion of a playbook run after ssh was already up and the cluster might be running.

Hence I don't think "check FIPS, then run test suite" is necessary.

@cgwalters
Copy link
Member Author

The problem with this test is that you need to know that FIPS is on

We have that data in the install config.

Now I could imagine something where we truly triple check by having the tests here more explicitly support the CLUSTER_VARIANT environment variable from the release repo and validate that if that env is set and contains fips it matches the install config.

(It'd be a triple check because remember FIPS is also already today validated in the MCO)

But overall this test is small and straightforward, extremely low cost - any reason not to merge?

(That said it clearly would be good to get e2e-aws-fips passing reliably again before merging)
/test e2e-aws-fips

cgwalters added a commit to cgwalters/machine-config-operator that referenced this pull request Aug 7, 2020
I was surprised we weren't logging anything related to this when
I went to double-check the node state while working on
openshift/origin#25362
@cgwalters
Copy link
Member Author

OK now that FIPS is green I'd like to get this in.

@cgwalters
Copy link
Member Author

/retest


g.It("TestFIPS", func() {
clusterAdminKubeClientset := oc.AdminKubeClient()
installConfig, err := installConfigFromCluster(clusterAdminKubeClientset.CoreV1())
Copy link
Contributor

Choose a reason for hiding this comment

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

don't read the install config to get FIPS enabled/disabled.

Use the machine config pool to figure out if FIPS is enabled using the rendered machine config and then use the target label from machine config pool to create a list of nodes to validate if the expected matched.

Copy link
Member Author

Choose a reason for hiding this comment

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

The thing is - that's what the MCO is already doing today. See previous discussion in openshift/release#10488

The intent of this test is to be a "triple check": if say there was a bug in the MCO that failed to get fips into the rendered machineconfig, this test would catch it.

@cgwalters
Copy link
Member Author

Rebased 🏄 I still think this is a good idea, and this also contains some code I'd like to use in other tests.

@cgwalters
Copy link
Member Author

Trying to run ./hack/update-generated.sh here changes all the tests to drop the [Suite:...]?

See discussion in
openshift/release#10488
and https://bugzilla.redhat.com/show_bug.cgi?id=1861095

This test replaces the bash code in the release repo
with a more proper test here.

While here I noticed that the topology tests had some code
that reused the MCD as a handy privileged pod; extract
that to the toplevel utils and use both here and there.
@cgwalters
Copy link
Member Author

OK @smarterclayton now that 4.7 is open I'd like to get this in, any other comments?

@abhinavdahiya
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2020
@knobunc
Copy link
Contributor

knobunc commented Oct 13, 2020

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, cgwalters, knobunc

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 13, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@ironcladlou
Copy link
Contributor

/unassign ironcladlou

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 9b173ba into openshift:master Oct 13, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants