Skip to content

Commit

Permalink
jsonnet: run pyrra only on amd64 nodes with configured resource requests
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
  • Loading branch information
paulfantom committed Apr 25, 2022
1 parent a51a935 commit b7bac61
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions jsonnet/kube-prometheus/addons/pyrra.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
namespace:: error 'must provide namespace',
version:: error 'must provide version',
image: error 'must provide image',
resources: {
// TODO(paulfantom): configure limits when we have more operational data
// limits: { cpu: '100m', memory: '100Mi' },
requests: { memory: '100Mi' },
},
replicas:: 1,
port:: 9099,

Expand All @@ -40,7 +45,6 @@
import 'github.com/pyrra-dev/pyrra/config/crd/bases/pyrra.dev_servicelevelobjectives.json'
),


_apiMetadata:: {
name: pyrra._config.name + '-api',
namespace: pyrra._config.namespace,
Expand Down Expand Up @@ -72,10 +76,10 @@
image: pyrra._config.image,
args: [
'api',
'--api-url=http://%s.%s.svc.cluster.local:9444' % [pyrra.kubernetesService.metadata.name, pyrra.kubernetesService.metadata.namespace],
'--prometheus-url=http://prometheus-k8s.%s.svc.cluster.local:9090' % pyrra._config.namespace,
'--api-url=http://%s.%s.svc:9444' % [pyrra.kubernetesService.metadata.name, pyrra.kubernetesService.metadata.namespace],
'--prometheus-url=http://prometheus-k8s.%s.svc:9090' % pyrra._config.namespace,
],
// resources: pyrra._config.resources,
resources: pyrra._config.resources,
ports: [{ containerPort: pyrra._config.port }],
securityContext: {
allowPrivilegeEscalation: false,
Expand Down Expand Up @@ -103,7 +107,10 @@
spec: {
containers: [c],
// serviceAccountName: $.serviceAccount.metadata.name,
nodeSelector: { 'kubernetes.io/os': 'linux' },
nodeSelector: {
'kubernetes.io/os': 'linux',
'kubernetes.io/arch': 'amd64',
},
},
},
},
Expand Down Expand Up @@ -186,7 +193,7 @@
args: [
'kubernetes',
],
// resources: pyrra._config.resources,
resources: pyrra._config.resources,
ports: [{ containerPort: pyrra._config.port }],
securityContext: {
allowPrivilegeEscalation: false,
Expand Down Expand Up @@ -216,7 +223,10 @@
spec: {
containers: [c],
serviceAccountName: pyrra.kubernetesServiceAccount.metadata.name,
nodeSelector: { 'kubernetes.io/os': 'linux' },
nodeSelector: {
'kubernetes.io/os': 'linux',
'kubernetes.io/arch': 'amd64',
},
},
},
},
Expand Down

0 comments on commit b7bac61

Please sign in to comment.