-
Notifications
You must be signed in to change notification settings - Fork 2
Enhanced node reconciliation by automating maintenance CR lifecycle #157
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e96e793
Node maintenance controller
anton-paulovich 1fdada3
Node maintenance finalizer
anton-paulovich ceac43a
Local environment
anton-paulovich 9c68690
go mod tidy
anton-paulovich ba12c39
Changes motivated by code review
anton-paulovich 6df53da
ServerMaintenance managed-by label
anton-paulovich dd9769e
Check for ServerMaintenance owner before CreateOrPatch()
anton-paulovich 916320f
Delete ServerMaintenance even if ServerClaim not found
anton-paulovich 6446036
Refactor providerID logic + switch to komega in tests
anton-paulovich 14ae853
metal operator v0.4.0
anton-paulovich 8f81417
Merge branch 'main' into feat/ServerMaintenenace
anton-paulovich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| allow_k8s_contexts(['kind-mgmt', 'kind-worker']) | ||
|
|
||
| mgmt_ctx = 'kind-mgmt' | ||
| worker_ctx = 'kind-worker' | ||
|
|
||
| mgmt_kubeconfig = './config/kind/mgmt-kubeconfig-external' | ||
| worker_kubeconfig = './config/kind/worker-kubeconfig' | ||
|
|
||
| def mgmt_kubectl(args): | ||
| return local('kubectl --kubeconfig=' + mgmt_kubeconfig + ' --context=' + mgmt_ctx + ' ' + args) | ||
|
|
||
| def worker_kubectl(args): | ||
| return local('kubectl --kubeconfig=' + worker_kubeconfig + ' --context=' + worker_ctx + ' ' + args) | ||
|
|
||
| METAL_OPERATOR_REF = "v0.3.0" | ||
| mgmt_kubectl('apply -f https://raw.githubusercontent.com/ironcore-dev/metal-operator/' + METAL_OPERATOR_REF + '/config/crd/bases/metal.ironcore.dev_serverclaims.yaml') | ||
| mgmt_kubectl('apply -f https://raw.githubusercontent.com/ironcore-dev/metal-operator/' + METAL_OPERATOR_REF + '/config/crd/bases/metal.ironcore.dev_servermaintenances.yaml') | ||
| mgmt_kubectl('apply -f https://raw.githubusercontent.com/ironcore-dev/metal-operator/' + METAL_OPERATOR_REF + '/config/crd/bases/metal.ironcore.dev_servers.yaml') | ||
| mgmt_kubectl('wait --for=condition=Established --timeout=60s crd/serverclaims.metal.ironcore.dev') | ||
| mgmt_kubectl('wait --for=condition=Established --timeout=60s crd/servermaintenances.metal.ironcore.dev') | ||
| mgmt_kubectl('wait --for=condition=Established --timeout=60s crd/servers.metal.ironcore.dev') | ||
| mgmt_kubectl('apply -f config/kind/crs/server.yaml') | ||
| mgmt_kubectl('apply -f config/kind/crs/serverclaim.yaml') | ||
|
|
||
| worker_kubectl('apply -k config/kind') # kustomize | ||
| worker_kubectl('apply -f config/kind/crs/node.yaml') | ||
|
|
||
| local_resource( | ||
| "manager-binary", | ||
| cmd = 'mkdir -p .tiltbuild; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o .tiltbuild/manager ./cmd/metal-cloud-controller-manager/main.go', | ||
| deps = ["pkg", "cmd", "go.mod", "go.sum"] | ||
| ) | ||
|
|
||
| docker_build( | ||
| ref = "controller", | ||
| context = "./.tiltbuild/", | ||
| dockerfile_contents = """ | ||
| FROM gcr.io/distroless/static:nonroot | ||
| WORKDIR / | ||
| COPY manager /metal-cloud-controller-manager | ||
| USER 65532:65532 | ||
| ENTRYPOINT ["/metal-cloud-controller-manager"] | ||
| """, | ||
| only = "manager" | ||
| ) | ||
anton-paulovich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| k8s_yaml(kustomize('config/kind')) | ||
|
|
||
| k8s_resource( | ||
| 'cloud-controller-manager', | ||
| labels=['CCM'], | ||
| port_forwards='10258:10258', | ||
| extra_pod_selectors=[{'app.kubernetes.io/name': 'cloud-controller-manager'}] | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: 2026 SAP SE | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| clusterName: kind-ccm | ||
| networking: | ||
| configureNodeAddresses: true | ||
| ipamKind: | ||
| apiGroup: metal.ironcore.dev | ||
| kind: ServerClaim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apiVersion: v1 | ||
| kind: Node | ||
| metadata: | ||
| name: metal-node-1 | ||
| labels: | ||
| kubernetes.io/hostname: metal-node-1 | ||
| spec: | ||
| providerID: metal://default/server-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: metal.ironcore.dev/v1alpha1 | ||
| kind: Server | ||
| metadata: | ||
| name: physical-server-1 | ||
| namespace: default | ||
anton-paulovich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| spec: | ||
| systemUUID: "some-uuid" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: metal.ironcore.dev/v1alpha1 | ||
| kind: ServerClaim | ||
| metadata: | ||
| name: server-1 | ||
| namespace: default | ||
| spec: | ||
| image: "test-image" | ||
| power: "On" | ||
| serverRef: | ||
| name: physical-server-1 | ||
| serverSelector: | ||
| matchLabels: | ||
| machine: "true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| namespace: kube-system | ||
|
|
||
| resources: | ||
| - ../default | ||
|
|
||
| patches: | ||
| - target: | ||
| kind: Deployment | ||
| name: manager | ||
| path: manager-patch.yaml | ||
|
|
||
| secretGenerator: | ||
| - name: metal-cloud-config | ||
| namespace: kube-system | ||
| files: | ||
| - cloud-config=cloud-config.yaml | ||
| - kubeconfig=mgmt-kubeconfig-internal | ||
|
|
||
| generatorOptions: | ||
| disableNameSuffixHash: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: manager | ||
| spec: | ||
| strategy: | ||
| type: Recreate | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: manager | ||
| image: controller | ||
| imagePullPolicy: IfNotPresent | ||
| args: | ||
| - --cloud-provider=metal | ||
| - --cloud-config=/etc/kubernetes/cloud-config/cloud-config | ||
| - --metal-kubeconfig=/etc/kubernetes/cloud-config/kubeconfig | ||
| - --concurrent-service-syncs=10 | ||
| - --leader-elect=false | ||
| - --secure-port=10258 | ||
| - --v=2 | ||
| volumeMounts: | ||
| - mountPath: /etc/kubernetes/cloud-config | ||
| name: cloud-config | ||
| readOnly: true | ||
| volumes: | ||
| - name: cloud-config | ||
| secret: | ||
| secretName: metal-cloud-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.