-
Notifications
You must be signed in to change notification settings - Fork 567
CNTRLPLANE-1388: Spot with termination handler #7567
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
openshift-merge-bot
merged 3 commits into
openshift:main
from
enxebre:spot-with-termination-handler
Jan 27, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
24 changes: 24 additions & 0 deletions
24
...ixture_TestControlPlaneComponents_aws_node_termination_handler_controlplanecomponent.yaml
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,24 @@ | ||
| apiVersion: hypershift.openshift.io/v1beta1 | ||
| kind: ControlPlaneComponent | ||
| metadata: | ||
| name: aws-node-termination-handler | ||
| namespace: hcp-namespace | ||
| resourceVersion: "1" | ||
| spec: {} | ||
| status: | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: aws-node-termination-handler Deployment Available condition not found | ||
| reason: NotFound | ||
| status: "False" | ||
| type: Available | ||
| - lastTransitionTime: null | ||
| message: 'Waiting for deployment aws-node-termination-handler rollout to finish: | ||
| 0 out of 1 new replicas have been updated' | ||
| reason: WaitingForRolloutComplete | ||
| status: "False" | ||
| type: RolloutComplete | ||
| resources: | ||
| - group: "" | ||
| kind: Secret | ||
| name: aws-node-termination-handler-creds |
16 changes: 16 additions & 0 deletions
16
.../GCP/zz_fixture_TestControlPlaneComponents_aws_node_termination_handler_creds_secret.yaml
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,16 @@ | ||
| apiVersion: v1 | ||
| data: | ||
| credentials: W2RlZmF1bHRdCnJvbGVfYXJuID0gYXJuOmF3czppYW06OjEyMzQ1Njc4OTAxMjpyb2xlL3Rlc3Qtbm9kZS1wb29sLW1hbmFnZW1lbnQtcm9sZQp3ZWJfaWRlbnRpdHlfdG9rZW5fZmlsZSA9IC92YXIvcnVuL3NlY3JldHMvb3BlbnNoaWZ0L3NlcnZpY2VhY2NvdW50L3Rva2VuCnN0c19yZWdpb25hbF9lbmRwb2ludHMgPSByZWdpb25hbAo= | ||
| kind: Secret | ||
| metadata: | ||
| name: aws-node-termination-handler-creds | ||
| namespace: hcp-namespace | ||
| ownerReferences: | ||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||
| blockOwnerDeletion: true | ||
| controller: true | ||
| kind: HostedControlPlane | ||
| name: hcp | ||
| uid: "" | ||
| resourceVersion: "1" | ||
| type: Opaque | ||
204 changes: 204 additions & 0 deletions
204
...er/GCP/zz_fixture_TestControlPlaneComponents_aws_node_termination_handler_deployment.yaml
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,204 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| labels: | ||
| hypershift.openshift.io/managed-by: control-plane-operator | ||
| name: aws-node-termination-handler | ||
| namespace: hcp-namespace | ||
| ownerReferences: | ||
| - apiVersion: hypershift.openshift.io/v1beta1 | ||
| blockOwnerDeletion: true | ||
| controller: true | ||
| kind: HostedControlPlane | ||
| name: hcp | ||
| uid: "" | ||
| resourceVersion: "1" | ||
| spec: | ||
| replicas: 1 | ||
| revisionHistoryLimit: 2 | ||
| selector: | ||
| matchLabels: | ||
| app: aws-node-termination-handler | ||
| strategy: {} | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| cluster-autoscaler.kubernetes.io/safe-to-evict-local-volumes: tmp,token,tmp-dir | ||
| component.hypershift.openshift.io/config-hash: 2e848593 | ||
| hypershift.openshift.io/release-image: quay.io/openshift-release-dev/ocp-release:4.16.10-x86_64 | ||
| labels: | ||
| app: aws-node-termination-handler | ||
| hypershift.openshift.io/control-plane-component: aws-node-termination-handler | ||
| hypershift.openshift.io/hosted-control-plane: hcp-namespace | ||
| spec: | ||
| affinity: | ||
| nodeAffinity: | ||
| preferredDuringSchedulingIgnoredDuringExecution: | ||
| - preference: | ||
| matchExpressions: | ||
| - key: hypershift.openshift.io/control-plane | ||
| operator: In | ||
| values: | ||
| - "true" | ||
| weight: 50 | ||
| - preference: | ||
| matchExpressions: | ||
| - key: hypershift.openshift.io/cluster | ||
| operator: In | ||
| values: | ||
| - hcp-namespace | ||
| weight: 100 | ||
| podAffinity: | ||
| preferredDuringSchedulingIgnoredDuringExecution: | ||
| - podAffinityTerm: | ||
| labelSelector: | ||
| matchLabels: | ||
| hypershift.openshift.io/hosted-control-plane: hcp-namespace | ||
| topologyKey: kubernetes.io/hostname | ||
| weight: 100 | ||
| automountServiceAccountToken: false | ||
| containers: | ||
| - env: | ||
| - name: NODE_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: spec.nodeName | ||
| - name: POD_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.name | ||
| - name: NAMESPACE | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.namespace | ||
| - name: ENABLE_SPOT_INTERRUPTION_DRAINING | ||
| value: "true" | ||
| - name: ENABLE_SCHEDULED_EVENT_DRAINING | ||
| value: "true" | ||
| - name: ENABLE_REBALANCE_MONITORING | ||
| value: "true" | ||
| - name: ENABLE_REBALANCE_DRAINING | ||
| value: "true" | ||
| - name: ENABLE_SQS_TERMINATION_DRAINING | ||
| value: "true" | ||
| - name: AWS_REGION | ||
| - name: QUEUE_URL | ||
| value: https://sqs.us-east-1.amazonaws.com/123456789012/test-queue | ||
| - name: DELETE_SQS_MSG_IF_NODE_NOT_FOUND | ||
| value: "false" | ||
| - name: DRY_RUN | ||
| value: "false" | ||
| - name: CORDON_ONLY | ||
| value: "false" | ||
| - name: TAINT_NODE | ||
| value: "true" | ||
| - name: EXCLUDE_FROM_LOAD_BALANCERS | ||
| value: "false" | ||
| - name: JSON_LOGGING | ||
| value: "false" | ||
| - name: LOG_LEVEL | ||
| value: info | ||
| - name: WEBHOOK_URL | ||
| - name: WORKERS | ||
| value: "10" | ||
| - name: METADATA_TRIES | ||
| value: "3" | ||
| - name: KUBERNETES_SERVICE_HOST | ||
| value: kube-apiserver | ||
| - name: KUBERNETES_SERVICE_PORT | ||
| value: "6443" | ||
| - name: AWS_SHARED_CREDENTIALS_FILE | ||
| value: /etc/aws/credentials | ||
| - name: ENABLE_KUBERNETES_EVENTS | ||
| value: "true" | ||
| image: public.ecr.aws/aws-ec2/aws-node-termination-handler:v1.25.3 | ||
| imagePullPolicy: IfNotPresent | ||
| name: aws-node-termination-handler | ||
| resources: | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| requests: | ||
| cpu: 50m | ||
| memory: 64Mi | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| readOnlyRootFilesystem: true | ||
| runAsNonRoot: true | ||
| terminationMessagePolicy: FallbackToLogsOnError | ||
| volumeMounts: | ||
| - mountPath: /tmp | ||
| name: tmp | ||
| - mountPath: /var/run/secrets/kubernetes.io/serviceaccount | ||
| name: token | ||
| - mountPath: /etc/aws | ||
| name: credentials | ||
| - args: | ||
| - | | ||
| # Extract CA certificate from kubeconfig and write to expected location | ||
| grep certificate-authority-data /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | ||
|
|
||
| /usr/bin/control-plane-operator token-minter \ | ||
| --service-account-namespace=openshift-cluster-version \ | ||
| --service-account-name=default \ | ||
| --token-audience=https://test-oidc-bucket.s3.us-east-1.amazonaws.com/test-cluster \ | ||
| --token-file=/var/run/secrets/kubernetes.io/serviceaccount/token \ | ||
| --kubeconfig=/etc/kubernetes/kubeconfig | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| image: token-minter | ||
| imagePullPolicy: IfNotPresent | ||
| name: token-minter-kube | ||
| resources: | ||
| requests: | ||
| cpu: 10m | ||
| memory: 30Mi | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| readOnlyRootFilesystem: true | ||
| runAsNonRoot: true | ||
| terminationMessagePolicy: FallbackToLogsOnError | ||
| volumeMounts: | ||
| - mountPath: /var/run/secrets/kubernetes.io/serviceaccount | ||
| name: token | ||
| - mountPath: /etc/kubernetes | ||
| name: svc-kubeconfig | ||
| - mountPath: /tmp | ||
| name: tmp-dir | ||
| enableServiceLinks: false | ||
| nodeSelector: | ||
| kubernetes.io/os: linux | ||
| priorityClassName: hypershift-control-plane | ||
| tolerations: | ||
| - effect: NoSchedule | ||
| key: hypershift.openshift.io/control-plane | ||
| operator: Equal | ||
| value: "true" | ||
| - effect: NoSchedule | ||
| key: hypershift.openshift.io/cluster | ||
| operator: Equal | ||
| value: hcp-namespace | ||
| volumes: | ||
| - emptyDir: {} | ||
| name: tmp | ||
| - emptyDir: | ||
| medium: Memory | ||
| name: token | ||
| - name: svc-kubeconfig | ||
| secret: | ||
| defaultMode: 416 | ||
| secretName: service-network-admin-kubeconfig | ||
| - name: credentials | ||
| secret: | ||
| defaultMode: 416 | ||
| secretName: aws-node-termination-handler-creds | ||
| - emptyDir: {} | ||
| name: tmp-dir | ||
| status: {} |
24 changes: 24 additions & 0 deletions
24
...ixture_TestControlPlaneComponents_aws_node_termination_handler_controlplanecomponent.yaml
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,24 @@ | ||
| apiVersion: hypershift.openshift.io/v1beta1 | ||
| kind: ControlPlaneComponent | ||
| metadata: | ||
| name: aws-node-termination-handler | ||
| namespace: hcp-namespace | ||
| resourceVersion: "1" | ||
| spec: {} | ||
| status: | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: aws-node-termination-handler Deployment Available condition not found | ||
| reason: NotFound | ||
| status: "False" | ||
| type: Available | ||
| - lastTransitionTime: null | ||
| message: 'Waiting for deployment aws-node-termination-handler rollout to finish: | ||
| 0 out of 1 new replicas have been updated' | ||
| reason: WaitingForRolloutComplete | ||
| status: "False" | ||
| type: RolloutComplete | ||
| resources: | ||
| - group: "" | ||
| kind: Secret | ||
| name: aws-node-termination-handler-creds |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redact/allowlist this Secret fixture to avoid credential leakage flags.
Even as testdata, this trips gitleaks and can be mistaken for real credentials. Prefer a gitleaks allowlist for fixture paths and/or inline
gitleaks:allowmarkers with clearly dummy data.🛡️ Example inline suppression (fixture-only)
📝 Committable suggestion
🧰 Tools
🪛 Gitleaks (8.30.0)
[high] 2-4: Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments
(kubernetes-secret-yaml)
[high] 3-3: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents