Skip to content

Commit

Permalink
default to amd64 only
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunne committed Oct 23, 2023
1 parent 7d0c8f1 commit 70cad9d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions manageiq-operator/api/v1alpha1/miqutils/node_affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ import (
func OperatorNodeAffinityArchValues(deployment *appsv1.Deployment, client client.Client) []string {
podName := os.Getenv("POD_NAME")
pod := FindPodByName(client, deployment.ObjectMeta.Namespace, podName)
values := []string{"amd64"}

if pod.Spec.Affinity == nil {
// In case we don't find the operator pod (local testing) or it doesn't have affinities
return []string{}
return values
}

nodeSelectorTerms := pod.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms

for _, selector := range nodeSelectorTerms {
for _, matchExpression := range selector.MatchExpressions {
if matchExpression.Key == "kubernetes.io/arch" {
return matchExpression.Values
values = matchExpression.Values
}
}
}

// We should never get here, but the compiler requires it
return []string{}
return values
}

func SetDeploymentNodeAffinity(deployment *appsv1.Deployment, client client.Client) {
Expand Down

0 comments on commit 70cad9d

Please sign in to comment.