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 ISO mounting to Workflow boot options #1008

Merged
merged 13 commits into from
Oct 14, 2024

Conversation

jacobweinstock
Copy link
Member

@jacobweinstock jacobweinstock commented Oct 9, 2024

Description

Add ISO mounting capabilities to Workflow (spec) boot options. This is similar to the netboot option but with a virtual media mount and CDROM as the next boot device. This refactors the Workflow spec to be able to handle both network boot and iso booting.

Current Workflow spec example:

apiVersion: tinkerbell.org/v1alpha1
kind: Workflow
metadata:
  name: example1
  namespace: tink-system
spec:
  hardwareMap:
    device_1: 01:02:03:04:05:06
  templateRef: myTemplate
  hardwareRef: example1
  bootOptions:
    toggleAllowNetboot: true
    oneTimeNetboot: true

New Workflow spec example for network booting a machine:

apiVersion: tinkerbell.org/v1alpha1
kind: Workflow
metadata:
  name: example1
  namespace: tink-system
spec:
  hardwareMap:
    device_1: 01:02:03:04:05:06
  templateRef: myTemplate
  hardwareRef: example1
  bootOptions:
    toggleAllowNetboot: true
    bootMode: netboot

New Workflow spec example for ISO booting a machine:

apiVersion: tinkerbell.org/v1alpha1
kind: Workflow
metadata:
  name: example1
  namespace: tink-system
spec:
  hardwareMap:
    device_1: 01:02:03:04:05:06
  templateRef: myTemplate
  hardwareRef: example1
  bootOptions:
    toggleAllowNetboot: true
    bootMode: iso
    isoURL: http://192.168.2.113:7171/ipxe/ipxe.iso

Why is this needed

Fixes: #

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Upgrade:

  1. Update the workflow CRD
    kubectl replace -f https://raw.githubusercontent.com/tinkerbell/tink/refs/heads/main/config/crd/bases/tinkerbell.org_workflows.yaml
  2. Update the tink controller Role
    kubectl replace -f https://raw.githubusercontent.com/tinkerbell/tink/refs/heads/main/config/manager-rbac/role.yaml -n tink-system
  3. Update tink controller and tink server images
    kubectl set image -n tink-system deployment/tink-controller tink-controller=quay.io/tinkerbell/tink-controller:latest
    kubectl set image -n tink-system deployment/tink-server server=quay.io/tinkerbell/tink-server:latest

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@jacobweinstock jacobweinstock added the do-not-merge Signal to Mergify to block merging of the PR. label Oct 9, 2024
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 51.28866% with 189 lines in your changes missing coverage. Please review.

Project coverage is 30.86%. Comparing base (2fb5e40) to head (8997356).
Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
internal/deprecated/workflow/hardware.go 28.76% 43 Missing and 9 partials ⚠️
internal/deprecated/workflow/job.go 61.78% 36 Missing and 11 partials ⚠️
internal/deprecated/workflow/reconciler.go 43.18% 24 Missing and 1 partial ⚠️
internal/deprecated/workflow/post.go 0.00% 23 Missing ⚠️
internal/deprecated/workflow/pre.go 76.00% 10 Missing and 8 partials ⚠️
cmd/tink-controller/main.go 0.00% 15 Missing ⚠️
internal/deprecated/workflow/journal/journal.go 78.12% 3 Missing and 4 partials ⚠️
internal/server/kubernetes_api_workflow.go 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1008      +/-   ##
==========================================
+ Coverage   30.06%   30.86%   +0.80%     
==========================================
  Files          71       75       +4     
  Lines        3739     3923     +184     
==========================================
+ Hits         1124     1211      +87     
- Misses       2539     2617      +78     
- Partials       76       95      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobweinstock jacobweinstock force-pushed the iso-mounting branch 2 times, most recently from 68ff0e4 to 9efd4d8 Compare October 11, 2024 19:10
These updates allow for ISO mounting as a
boot option.

Signed-off-by: Jacob Weinstock <[email protected]>
Use STATE_PREPARING and STATE_POST. This
allows us to run operations in a specific
order in the state flow.

Refactor toggling Hardware allowPXE to be
more understandable.

Fix deleteExisting. It wasn't deleting existing
jobs correctly.

Instead of doing a static requeue of 5 seconds,
use an exponential backoff. All backoff durations
are less than 10seconds.

Move condition setting into toggleHardware for
consistentcy with the handleJob.

Make job.bmc names unique per job type (netboot, iso, etc).

Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
handleJob no longer deals with setting bootOption status,
just conditions.

Signed-off-by: Jacob Weinstock <[email protected]>
And to help with understanding code paths
taken. This is very helpful as we have to create
an idempotent Reconcile function.

Signed-off-by: Jacob Weinstock <[email protected]>
Otel was working well, but it was heavy and
required a otel specific log collector.
The journal is a lot lighter weight. Journal
entries are collected during a reconcile and
logged once at the end. As this produces a good
sized log line per reconcile, debug logging was added
so that this is opt in only.

Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
This makes it so that we don't make get calls
as much to the kube api server.

Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
Signed-off-by: Jacob Weinstock <[email protected]>
@jacobweinstock jacobweinstock added kind/feature Categorizes issue or PR as related to a new feature. and removed do-not-merge Signal to Mergify to block merging of the PR. labels Oct 14, 2024
@jacobweinstock jacobweinstock changed the title [WIP] Add ISO mounting to Workflow boot options Add ISO mounting to Workflow boot options Oct 14, 2024
@jacobweinstock jacobweinstock added the breaking-change Denotes a PR that introduces potentially breaking changes that require user action. label Oct 14, 2024
@jacobweinstock jacobweinstock merged commit 8c7a9c8 into tinkerbell:main Oct 14, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Denotes a PR that introduces potentially breaking changes that require user action. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant