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

⚠️ Kustomizations usable off the shelf #1438

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

lentzi90
Copy link
Member

@lentzi90 lentzi90 commented Nov 9, 2023

The PR is marked as ⚠️ breaking because the structure of the kustomizations changed. In practice I do not think it should cause problems, because the kustomizations that we change here were not usable without modifications (adding credentials) anyway. The deploy.sh script should work just as before.

What this PR does / why we need it:

This restructures the BMO kustomizations to make use of components
(similar to what was already done for the Ironic kustomizations).

It also makes the kustomizations usable "off the shelf" by removing the
secret generation. Previously it was necessary to clone the repository
and add the relevant files (e.g. by running tools/deploy.sh) before it
was possible to build the kustomizations that included secrets generated
from the files. With this commit, the secrets will NOT be generated as
part of the kustomizations and they can thus be used as is. However, the
user is instead required to add the necessary secrets.

The secrets can be added in any way. One common way is that the users
creates their own overlays that add the secrets. These kustomizations
can be based on and use the kustomizations in the repo since they are
now buildable without changes. Another way to add the secrets is via the
external secrets operator.

Finally, basic-auth and TLS is enabled for the e2e tests. This also works as an example for how to make use of the kustomizations and for what secrets are needed.

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 #1361, #1375

Note for reviewers:

Most changes are just from moving files around to get the kustomize components structure. Some files needed slight modifications because of the new structure though and this can sometimes show as a large diff.

@metal3-io-bot metal3-io-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 9, 2023
@lentzi90
Copy link
Member Author

lentzi90 commented Nov 9, 2023

/metal3-bmo-e2e-test

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 changes here is just to install Ironic before BMO, since BMO will try to mount the CA certificate that comes with Ironic.

@lentzi90
Copy link
Member Author

lentzi90 commented Nov 9, 2023

/hold
I think we need some adaption in metal3-dev-env for this also...

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 9, 2023
@lentzi90
Copy link
Member Author

/metal3-bmo-e2e-test

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

1 similar comment
@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/metal3-bmo-e2e-test

@lentzi90
Copy link
Member Author

Tests looks good!
/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 10, 2023
Copy link
Member Author

Choose a reason for hiding this comment

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

These credentials would be used in the e2e tests. I'm curious to hear opinions on this. My reasoning for including them in the repo is that

  1. They act like a concrete example that users can look at to understand both how to create the secrets and what to put in them
  2. The tests should (ideally) not expose Ironic to anything outside the CI system anyway and they are relatively short lived

I'm open for other solutions though. We could generate them automatically for the tests and static examples can be provided without being part of the CI.

/cc @tuminoid

Copy link
Member

@tuminoid tuminoid Nov 13, 2023

Choose a reason for hiding this comment

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

I agree that we need to have proper usable examples for the users, so they don't need to guess what they're supposed to look like etc, but I'd prefer generating them, and just documenting the proper format/process.

  1. While the risk of exposure is small, it still exists, better remove it
  2. There is always someone who will deploy them in production anyways ...
  3. If we generate them, we also test our codebase versus accidental hardcoding, ie. make it more realistic check

If in step 3 we use random username/password, it'll make debugging/developing a bit harder though, so let's document it well where/how to fetch the creds.

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does make sense to me, but makes things a bit more complicated. I need to think about how to do it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, and looks like it is working!
I have not added any more documentation yet. Perhaps that can be in a separate PR? We don't have any docs for it at the moment anyway so no degradation...

The credentials are created in the ci-e2e.sh script. This means that outside of CI, users can still choose to set up a static overlay for use with a baremetal lab or similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was basically copied to config/base/kustomization.yaml and then simplified by using that as base

tools/deploy.sh Outdated
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 changes to this file can be summarized like this:

  1. Gereration of credentials was moved up so that the files will be in place when we start building the kustomizations.
  2. A temporary overlay is used for BMO (just like Ironic was already doing).

Copy link
Member Author

Choose a reason for hiding this comment

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

This was copied from config/default and then the paths were adapted. The only other change is that this does NOT create the ironic configmap. This is because the content of the configmap depends on the environment so the user will anyway need to change it in almost all cases.

Copy link
Member

@kashifest kashifest left a comment

Choose a reason for hiding this comment

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

Great work. lgtm. I will leave it open for some time for review before I stamp approval.

config/README.md Outdated Show resolved Hide resolved
config/overlays/e2e/kustomization.yaml Outdated Show resolved Hide resolved
@lentzi90
Copy link
Member Author

/metal3-bmo-e2e-test
/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@kashifest
Copy link
Member

@dtantsur @honza @zaneb PTAL. This patch will help us get rid of deploy script and allow us to use conventional kustomize overlays.

@lentzi90
Copy link
Member Author

@dtantsur @honza @zaneb PTAL. This patch will help us get rid of deploy script and allow us to use conventional kustomize overlays.

To be clear, it will still be possible to use the deploy script for those who want to do so. I don't expect people in general want to use a script to deploy though, and this will make it possible to just use the kustomizations as is, without modifications or scripts.

@metal3-io-bot metal3-io-bot added the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Nov 21, 2023
@metal3-io-bot metal3-io-bot removed the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2023
@lentzi90 lentzi90 force-pushed the lentzi90/e2e-basic-auth-tls branch 2 times, most recently from 47b482d to 4eccf2b Compare November 22, 2023 08:16
This restructures the BMO kustomizations to make use of components
(similar to what was already done for the Ironic kustomizations).

It also makes the kustomizations usable "off the shelf" by removing the
secret generation. Previously it was necessary to clone the repository
and add the relevant files (e.g. by running `tools/deploy.sh`) before it
was possible to build the kustomizations that included secrets generated
from the files. With this commit, the secrets will NOT be generated as
part of the kustomizations and they can thus be used as is. However, the
user is instead required to add the necessary secrets.

The secrets can be added in any way. One common way is that the users
creates their own overlays that add the secrets. These kustomizations
can be based on and use the kustomizations in the repo since they are
now buildable without changes. Another way to add the secrets is via the
external secrets operator.

Signed-off-by: Lennart Jern <[email protected]>
@lentzi90
Copy link
Member Author

/metal3-bmo-e2e-test
/test-ubuntu-integration-main
/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-centos-e2e-integration-main

2 similar comments
@lentzi90
Copy link
Member Author

/test-centos-e2e-integration-main

@lentzi90
Copy link
Member Author

/test-centos-e2e-integration-main

@kashifest
Copy link
Member

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kashifest

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

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 23, 2023
@lentzi90
Copy link
Member Author

/cc @elfosardo @tuminoid @dtantsur

@dtantsur
Copy link
Member

I wonder how much easier this change becomes if we throw Inspector out in the window.

@lentzi90
Copy link
Member Author

lentzi90 commented Dec 4, 2023

I wonder how much easier this change becomes if we throw Inspector out in the window.

Not that much I think. I would still want to shuffle around the files like I do here. The Ironic and inspector auth configs would reduce to just one I guess, but that is just a few lines.

@dtantsur
Copy link
Member

dtantsur commented Dec 6, 2023

I cannot wait for ironic-(standalone-)operator to make most of this redundant. But for now, great job refactoring!

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2023
@metal3-io-bot metal3-io-bot merged commit 63abe2d into metal3-io:main Dec 6, 2023
18 checks passed
@metal3-io-bot metal3-io-bot deleted the lentzi90/e2e-basic-auth-tls branch December 6, 2023 14:55
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Ironic and BMO kustomizations usable off the shelf
5 participants