Skip to content

Commit

Permalink
Add affinity settings in viz and jaeger chart (#11464)
Browse files Browse the repository at this point in the history
Fixes #10680

Signed-off-by: Naing Naing Htun <[email protected]>
Co-authored-by: Alex Leong <[email protected]>
  • Loading branch information
naing2victor and adleong authored Nov 17, 2023
1 parent d341b6a commit fd54697
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 5 deletions.
3 changes: 3 additions & 0 deletions jaeger/charts/linkerd-jaeger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Kubernetes: `>=1.21.0-0`
| collector.image.pullPolicy | string | `""` | |
| collector.image.version | string | `"0.83.0"` | |
| collector.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | NodeSelector section, See the [K8S documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) for more information |
| collector.replicas | int | `1` | Number of replicas of the collector component |
| collector.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the collector container can use |
| collector.resources.cpu.request | string | `nil` | Amount of CPU units that the collector container requests |
| collector.resources.ephemeral-storage.limit | string | `""` | Maximum amount of ephemeral storage that the collector container can use |
Expand All @@ -92,6 +93,7 @@ Kubernetes: `>=1.21.0-0`
| commonLabels | object | `{}` | Labels to apply to all resources |
| defaultUID | int | `2103` | Default UID for all the jaeger components |
| enablePSP | bool | `false` | Create Roles and RoleBindings to associate this extension's ServiceAccounts to the control plane PSP resource. This requires that `enabledPSP` is set to true on the control plane install. Note PSP has been deprecated since k8s v1.21 |
| enablePodAntiAffinity | bool | `false` | Enables Pod Anti Affinity logic to balance the placement of replicas across hosts and zones for High Availability. Enable this only when you have multiple replicas of components. |
| imagePullSecrets | list | `[]` | For Private docker registries, authentication is needed. Registry secrets are applied to the respective service accounts |
| jaeger.UID | string | `nil` | UID for the jaeger resource |
| jaeger.args | list | `["--query.base-path=/jaeger"]` | CLI arguments for Jaeger, See [Jaeger AIO Memory CLI reference](https://www.jaegertracing.io/docs/1.24/cli/#jaeger-all-in-one-memory) |
Expand Down Expand Up @@ -135,6 +137,7 @@ Kubernetes: `>=1.21.0-0`
| webhook.namespaceSelector | string | `nil` | |
| webhook.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | NodeSelector section, See the [K8S documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) for more information |
| webhook.objectSelector | string | `nil` | |
| webhook.replicas | int | `1` | Number of replicas of the jaeger-injector component |
| webhook.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the jaeger-injector container can use |
| webhook.resources.cpu.request | string | `nil` | Amount of CPU units that the jaeger-injector container requests |
| webhook.resources.memory.limit | string | `nil` | Maximum amount of memory that jaeger-injector container can use |
Expand Down
11 changes: 10 additions & 1 deletion jaeger/charts/linkerd-jaeger/templates/jaeger-injector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
###
### Jaeger Injector
###
{{- $tree := deepCopy . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -15,11 +16,16 @@ metadata:
name: jaeger-injector
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
replicas: {{ .Values.webhook.replicas }}
selector:
matchLabels:
linkerd.io/extension: jaeger
component: jaeger-injector
{{- if .Values.enablePodAntiAffinity }}
strategy:
rollingUpdate:
maxUnavailable: 1
{{- end }}
template:
metadata:
annotations:
Expand All @@ -37,6 +43,9 @@ spec:
{{- include "linkerd.tolerations" (dict "Values" .Values.webhook) | nindent 6 }}
{{- end -}}
{{- include "linkerd.node-selector" (dict "Values" .Values.webhook) | nindent 6 }}
{{- $_ := set $tree "component" "jaeger-injector" -}}
{{- $_ := set $tree "label" "component" -}}
{{- include "linkerd.affinity" $tree | nindent 6 }}
containers:
- args:
- -collector-svc-addr={{.Values.webhook.collectorSvcAddr}}
Expand Down
20 changes: 19 additions & 1 deletion jaeger/charts/linkerd-jaeger/templates/tracing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
selector:
component: collector
---
{{- $tree := deepCopy . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -67,10 +68,15 @@ metadata:
name: collector
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
replicas: {{ .Values.collector.replicas }}
selector:
matchLabels:
component: collector
{{- if .Values.enablePodAntiAffinity }}
strategy:
rollingUpdate:
maxUnavailable: 1
{{- end }}
minReadySeconds: 5
progressDeadlineSeconds: 120
template:
Expand All @@ -93,6 +99,9 @@ spec:
{{- include "linkerd.tolerations" (dict "Values" .Values.collector) | nindent 6 }}
{{- end -}}
{{- include "linkerd.node-selector" (dict "Values" .Values.collector) | nindent 6 }}
{{- $_ := set $tree "component" "collector" -}}
{{- $_ := set $tree "label" "component" -}}
{{- include "linkerd.affinity" $tree | nindent 6 }}
containers:
- command:
- {{ .Values.collector.command }}
Expand Down Expand Up @@ -188,6 +197,7 @@ spec:
- name: ui
port: 16686
---
{{- $tree := deepCopy . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -204,6 +214,11 @@ spec:
selector:
matchLabels:
component: jaeger
{{- if .Values.enablePodAntiAffinity }}
strategy:
rollingUpdate:
maxUnavailable: 1
{{- end }}
template:
metadata:
annotations:
Expand All @@ -222,6 +237,9 @@ spec:
{{- include "linkerd.tolerations" (dict "Values" .Values.jaeger) | nindent 6 }}
{{- end -}}
{{- include "linkerd.node-selector" (dict "Values" .Values.jaeger) | nindent 6 }}
{{- $_ := set $tree "component" "jaeger" -}}
{{- $_ := set $tree "label" "component" -}}
{{- include "linkerd.affinity" $tree | nindent 6 }}
containers:
- args:
{{- range .Values.jaeger.args }}
Expand Down
14 changes: 14 additions & 0 deletions jaeger/charts/linkerd-jaeger/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ imagePullSecrets: []
# for more information
tolerations: &default_tolerations

# -- Enables Pod Anti Affinity logic to balance the placement of replicas
# across hosts and zones for High Availability.
# Enable this only when you have multiple replicas of components.
enablePodAntiAffinity: false

# -- NodeAffinity section, See the
# [K8S documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity)
# for more information
#nodeAffinity:

# -- Create Roles and RoleBindings to associate this extension's
# ServiceAccounts to the control plane PSP resource. This requires that
# `enabledPSP` is set to true on the control plane install. Note PSP has been
Expand All @@ -36,6 +46,8 @@ clusterDomain: cluster.local
collector:
# -- Set to false to exclude collector installation
enabled: true
# -- Number of replicas of the collector component
replicas: 1
image:
name: otel/opentelemetry-collector-contrib
version: 0.83.0
Expand Down Expand Up @@ -222,6 +234,8 @@ namespaceMetadata:
tolerations: *default_tolerations

webhook:
# -- Number of replicas of the jaeger-injector component
replicas: 1
# -- Do not create a secret resource for the webhook.
# If this is set to `true`, the value `webhook.caBundle` must be set
# or the ca bundle must injected with cert-manager ca injector using
Expand Down
2 changes: 1 addition & 1 deletion viz/charts/linkerd-viz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Kubernetes: `>=1.21.0-0`
| metricsAPI.logLevel | string | defaultLogLevel | log level of the metrics-api component |
| metricsAPI.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | NodeSelector section, See the [K8S documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) for more information |
| metricsAPI.proxy | string | `nil` | |
| metricsAPI.replicas | int | `1` | number of replicas of the metrics-api component |
| metricsAPI.replicas | int | `1` | Number of replicas of the metrics-api component |
| metricsAPI.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the metrics-api container can use |
| metricsAPI.resources.cpu.request | string | `nil` | Amount of CPU units that the metrics-api container requests |
| metricsAPI.resources.ephemeral-storage.limit | string | `""` | Maximum amount of ephemeral storage that the metrics-api container can use |
Expand Down
4 changes: 4 additions & 0 deletions viz/charts/linkerd-viz/templates/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spec:
port: 9994
targetPort: 9994
---
{{- $tree := deepCopy . }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -74,6 +75,9 @@ spec:
{{- include "linkerd.tolerations" . | nindent 6 }}
{{- end -}}
{{- include "linkerd.node-selector" . | nindent 6 }}
{{- $_ := set $tree "component" "web" -}}
{{- $_ := set $tree "label" "component" -}}
{{- include "linkerd.affinity" $tree | nindent 6 }}
containers:
- args:
- -linkerd-metrics-api-addr=metrics-api.{{.Release.Namespace}}.svc.{{.Values.clusterDomain}}:8085
Expand Down
4 changes: 2 additions & 2 deletions viz/charts/linkerd-viz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jaegerUrl: ""

# metrics API configuration
metricsAPI:
# -- number of replicas of the metrics-api component
# -- Number of replicas of the metrics-api component
replicas: 1
# -- log level of the metrics-api component
# @default -- defaultLogLevel
Expand Down Expand Up @@ -131,7 +131,7 @@ metricsAPI:

# tap configuration
tap:
# -- Number of tap component replicas
# -- Number of tap component replicas
replicas: 1
# -- log level of the tap component
# @default -- defaultLogLevel
Expand Down

0 comments on commit fd54697

Please sign in to comment.