From 9d3076bf6619ae86f2f5347cb962f09d169e4a72 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 23 May 2020 20:43:47 -0500 Subject: [PATCH 1/3] Issue #39: Add affinity for arm/arm64 support for arm-exporter. --- arm_exporter.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm_exporter.jsonnet b/arm_exporter.jsonnet index 90a4b81..d992af6 100644 --- a/arm_exporter.jsonnet +++ b/arm_exporter.jsonnet @@ -72,7 +72,7 @@ local utils = import 'utils.libsonnet'; daemonset.mixin.metadata.withLabels(podLabels) + daemonset.mixin.spec.selector.withMatchLabels(podLabels) + daemonset.mixin.spec.template.metadata.withLabels(podLabels) + - daemonset.mixin.spec.template.spec.withNodeSelector({ 'beta.kubernetes.io/arch': 'arm64' }) + + daemonset.mixin.spec.template.spec.withAffinity({'nodeAffinity':{'requiredDuringSchedulingIgnoredDuringExecution':{'nodeSelectorTerms':[{'matchExpressions':[{'key':'kubernetes.io/arch','operator':'In','values':['arm','arm64']}]}]}}}) + daemonset.mixin.spec.template.spec.withServiceAccountName('arm-exporter') + daemonset.mixin.spec.template.spec.withContainers(c), From 17e7805ebf378aa0826889ac841b8b45b138f67a Mon Sep 17 00:00:00 2001 From: Carlos de Paula Date: Mon, 25 May 2020 11:39:57 -0300 Subject: [PATCH 2/3] Use node affinity to select architectures --- arm_exporter.jsonnet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arm_exporter.jsonnet b/arm_exporter.jsonnet index d992af6..6c7744d 100644 --- a/arm_exporter.jsonnet +++ b/arm_exporter.jsonnet @@ -72,7 +72,8 @@ local utils = import 'utils.libsonnet'; daemonset.mixin.metadata.withLabels(podLabels) + daemonset.mixin.spec.selector.withMatchLabels(podLabels) + daemonset.mixin.spec.template.metadata.withLabels(podLabels) + - daemonset.mixin.spec.template.spec.withAffinity({'nodeAffinity':{'requiredDuringSchedulingIgnoredDuringExecution':{'nodeSelectorTerms':[{'matchExpressions':[{'key':'kubernetes.io/arch','operator':'In','values':['arm','arm64']}]}]}}}) + + daemonset.mixin.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.withNodeSelectorTerms([{ matchExpressions: [{ key: 'kubernetes.io/arch', operator: 'In', values: ['arm', 'arm64'] }] }]) + + daemonset.mixin.spec.template.spec.withTolerations([{ operator: 'Exists' }]) + daemonset.mixin.spec.template.spec.withServiceAccountName('arm-exporter') + daemonset.mixin.spec.template.spec.withContainers(c), From f40d8410b3e5621f42456aefe9f8ec1368e30385 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 25 May 2020 11:27:12 -0500 Subject: [PATCH 3/3] Fixing style tweak. --- arm_exporter.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm_exporter.jsonnet b/arm_exporter.jsonnet index 6c7744d..eb780e7 100644 --- a/arm_exporter.jsonnet +++ b/arm_exporter.jsonnet @@ -73,7 +73,7 @@ local utils = import 'utils.libsonnet'; daemonset.mixin.spec.selector.withMatchLabels(podLabels) + daemonset.mixin.spec.template.metadata.withLabels(podLabels) + daemonset.mixin.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.withNodeSelectorTerms([{ matchExpressions: [{ key: 'kubernetes.io/arch', operator: 'In', values: ['arm', 'arm64'] }] }]) + - daemonset.mixin.spec.template.spec.withTolerations([{ operator: 'Exists' }]) + + daemonset.mixin.spec.template.spec.withTolerations([{ 'operator': 'Exists' }]) + daemonset.mixin.spec.template.spec.withServiceAccountName('arm-exporter') + daemonset.mixin.spec.template.spec.withContainers(c),