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

CAPT PBNJ power management integration #147

Closed
wants to merge 10 commits into from

Conversation

pokearu
Copy link
Contributor

@pokearu pokearu commented Mar 13, 2022

Description

The PR enables automated power on/off of nodes that are made part of the cluster using a CRD driven approach. Currently the BMC information is not part of the Tinkerbell hardware, hence a new CRD is introduced.

  • New CRD BMC and a corresponding controller controller/bmc which is responsible for maintaining the state of the hardware's bmc for the corresponding nodes.
  • The bmc controller uses a PBNJ client (similar to the tink client) which enables performing pbnj PowerRequest and DeviceRequest to manage the nodes.
  • The bmc spec has a SecretReference field that points to a k8s secret that contains the BMC user creds.
  • bmc spec has 2 fields PowerAction and BootDevice which the controller uses to reconcile the bare metal nodes by performing PBNJ requests. The values for these fields are based from machine.proto#L40L57.
  • During cluster create, when a hardware is selected for a machine, the new bmcRef field in the hardware CRD is used to fetch the BMC object and patch the PowerAction field and set the desired power state.
  • During cluster delete, when a hardware is released, the bmcRef field is used to patch the BMC object and set BootDevice to PXE and power off the nodes.

Why is this needed

Tries to address the issues listed on #146.

How Has This Been Tested?

I have tested these changes by creating and deleting multiple clusters using CAPT with the new modified CRDs.

Sample yaml for the new CRDs

kind: Hardware
apiVersion: tinkerbell.org/v1alpha1
metadata:
  name: node-1
spec:
  id: 8b8fdc3c-22e8-11ec-9621-0242ac130004
  bmcRef: bmc-node-1
---
kind: BMC
apiVersion: tinkerbell.org/v1alpha1
metadata:
  name: bmc-node-1
spec:
  host: 0.0.0.0
  authSecretRef:
    name: bmc-1-auth
    namespace: test-system
  vendor: Supermicro
---
apiVersion: v1
kind: Secret
metadata:
  name: bmc-1-auth
  namespace: test-system
type: kubernetes.io/basic-auth
data:
  password: QWRtaW4=
  username: YWRtaW4=

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

The existing users are not impacted. The bmcRef field in the hardware CRD is optional, and if not specified the power management steps are skipped.

Checklist:

I have:

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

@cprivitere
Copy link
Contributor

@pokearu @detiber Seems like there's some issues here, can someone resolve and repush?

@pokearu pokearu force-pushed the capt-pbnj-power-management branch from 7a8f3b3 to a5f2385 Compare May 4, 2022 05:07
@pokearu pokearu force-pushed the capt-pbnj-power-management branch from a5f2385 to c884558 Compare May 4, 2022 05:10
@pokearu
Copy link
Contributor Author

pokearu commented May 4, 2022

@pokearu @detiber Seems like there's some issues here, can someone resolve and repush?

Hi @cprivitere I just rebased and updated some of the files that had issues.

@cprivitere
Copy link
Contributor

Well, closer at least. Now someone just needs to solve the rest.

@pokearu pokearu force-pushed the capt-pbnj-power-management branch from f9e33d2 to aae60fd Compare May 4, 2022 18:08
@pokearu
Copy link
Contributor Author

pokearu commented May 4, 2022

Well, closer at least. Now someone just needs to solve the rest.

Updated again! Hopefully its green this time ✅

@pokearu
Copy link
Contributor Author

pokearu commented Jun 1, 2022

Closing PR as the changes are no longer valid with the Tinkerbell kubernetes model.
Opened new PR #182

@pokearu pokearu closed this Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants