|
1 | | -# public_template |
| 1 | +# host-management-openstack |
2 | 2 |
|
3 | | -Use this repository as the template for public-facing repositories. Please keep the following warning at the top of the repository README: |
| 3 | +Kubernetes controller that manages bare metal nodes via OpenStack Ironic. Watches Host CRs (defined in [osac-operator](https://github.com/DanNiESh/osac-operator)) and reconciles the desired state to Ironic. |
4 | 4 |
|
5 | | -> [!WARNING] |
6 | | -> Be mindful of the content you commit to this repository. Do not commit any |
7 | | -> material containing Red Hat confidential content, including information about |
8 | | -> future product development plans. |
| 5 | +## Description |
| 6 | + |
| 7 | +This controller filters Host CRs where `spec.hostManagementClass == "openstack"` and uses `spec.id` as the Ironic node UUID to manage node lifecycle through Ironic. |
| 8 | + |
| 9 | +## Test locally (with Ironic) |
| 10 | + |
| 11 | +Run the host controller on your machine and point it at your Ironic API. You need a Kubernetes API (e.g. a `kind` cluster) so the controller can watch Host CRs; the controller runs locally and talks to Ironic from your local machine. |
| 12 | + |
| 13 | +### 1. Create a kind cluster |
| 14 | + |
| 15 | +```bash |
| 16 | +kind create cluster --name host-mgmt-test |
| 17 | +``` |
| 18 | + |
| 19 | +### 2. Install the Host CRD from osac-operator |
| 20 | + |
| 21 | +The Host CR is defined in the [osac-operator](https://github.com/DanNiESh/osac-operator) `host-operator` branch. |
| 22 | + |
| 23 | +```bash |
| 24 | +kubectl apply -f <path-to-osac-operator>/config/crd/bases/osac.openshift.io_hosts.yaml |
| 25 | +``` |
| 26 | + |
| 27 | +### 3. Set Ironic URL and token |
| 28 | + |
| 29 | +```bash |
| 30 | +export IRONIC_URL="https://ironic-url" |
| 31 | +export OSAC_AUTH_TOKEN="token" # e.g. openstack token issue -f value -c id |
| 32 | +export IRONIC_INSECURE=true # optional, if using self-signed certs |
| 33 | +``` |
| 34 | + |
| 35 | +### 4. Run the controller |
| 36 | + |
| 37 | +```bash |
| 38 | +make run |
| 39 | +``` |
| 40 | + |
| 41 | +The controller will use `IRONIC_URL` and `OSAC_AUTH_TOKEN` to connect to Ironic. |
| 42 | + |
| 43 | +### 5. Apply a sample Host CR |
| 44 | + |
| 45 | +In another terminal: |
| 46 | + |
| 47 | +```bash |
| 48 | +kubectl apply -f config/samples/v1alpha1_host.yaml |
| 49 | +``` |
| 50 | + |
| 51 | +### 6. Verify |
| 52 | + |
| 53 | +```bash |
| 54 | +# Check Host status |
| 55 | +kubectl get host host-sample -n osac-namespace -o yaml |
| 56 | + |
| 57 | +# Watch controller logs for reconciliation |
| 58 | +``` |
| 59 | + |
| 60 | +## Getting Started |
| 61 | + |
| 62 | +### Prerequisites |
| 63 | +- go version v1.25.0+ |
| 64 | +- docker version 17.03+ |
| 65 | +- kubectl version v1.11.3+ |
| 66 | +- Access to a Kubernetes v1.11.3+ cluster |
| 67 | +- Access to an OpenStack Ironic endpoint |
| 68 | + |
| 69 | +### To Deploy on the cluster |
| 70 | +**Build and push your image to the location specified by `IMG`:** |
| 71 | + |
| 72 | +```sh |
| 73 | +make docker-build docker-push IMG=<some-registry>/host-management-openstack:tag |
| 74 | +``` |
| 75 | + |
| 76 | +**Install the Host CRD (from osac-operator):** |
| 77 | + |
| 78 | +```sh |
| 79 | +kubectl apply -f <path-to-osac-operator>/config/crd/bases/osac.openshift.io_hosts.yaml |
| 80 | +``` |
| 81 | + |
| 82 | +**Deploy the Manager to the cluster with the image specified by `IMG`:** |
| 83 | + |
| 84 | +```sh |
| 85 | +make deploy IMG=<some-registry>/host-management-openstack:tag |
| 86 | +``` |
| 87 | + |
| 88 | +> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin |
| 89 | +privileges or be logged in as admin. |
| 90 | + |
| 91 | +**Create instances of your solution** |
| 92 | +You can apply the samples (examples) from the config/sample: |
| 93 | + |
| 94 | +```sh |
| 95 | +kubectl apply -k config/samples/ |
| 96 | +``` |
| 97 | + |
| 98 | +### To Uninstall |
| 99 | +**Delete the instances (CRs) from the cluster:** |
| 100 | + |
| 101 | +```sh |
| 102 | +kubectl delete -k config/samples/ |
| 103 | +``` |
| 104 | + |
| 105 | +**UnDeploy the controller from the cluster:** |
| 106 | + |
| 107 | +```sh |
| 108 | +make undeploy |
| 109 | +``` |
| 110 | + |
| 111 | +## Contributing |
| 112 | + |
| 113 | +**NOTE:** Run `make help` for more information on all potential `make` targets |
| 114 | + |
| 115 | +More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) |
| 116 | + |
| 117 | +## License |
| 118 | + |
| 119 | +Copyright 2026. |
| 120 | + |
| 121 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 122 | +you may not use this file except in compliance with the License. |
| 123 | +You may obtain a copy of the License at |
| 124 | + |
| 125 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 126 | + |
| 127 | +Unless required by applicable law or agreed to in writing, software |
| 128 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 129 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 130 | +See the License for the specific language governing permissions and |
| 131 | +limitations under the License. |
0 commit comments