Skip to content

Commit

Permalink
Merge pull request #11 from Blazemeter/NodeSelector-&-Toleration
Browse files Browse the repository at this point in the history
Node selector & toleration
  • Loading branch information
ImMnan authored Dec 5, 2024
2 parents 263b9fa + 7749bca commit 51b7f9d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ keywords:
- Labels
- ResourceLimit
- Nginx Ingress
- NodeSelector
- Tolerations

type: application

#dependencies:
# - name: nginx
# condition: .Values.installed

version: 1.2.0
version: 1.2.1

maintainers:
- name: Manan Patel
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,24 @@ resourceLimit:
MEM: "4Gi"
```

#### [4.11] Configure deployment to support node selectors and tolerations
- The configuration is used to specify the tolerations & nodeselector labels. The crane container will pass these tolerations and node selector elements to child containers when they are deployed. Switch the `enable` to `yes` and add tolerations & nodeselector labels in a Json format as per the example:
```yaml
toleration:
enable: yes
syntax: [{ "effect": "NoSchedule", "key": "lifecycle", "operator": "Equal", "value": "spot" }]
nodeSelector:
enable: yes
syntax: {"label_1": "label_1_value", "label_2": "label_2_value"}
```

#### [5.0] Verify if everything is setup correctly
- Once the values are updated, please verify if the values are correctly used in the helm chart:

```
helm template .
helm lint <path-to-chart>
helm template <path-to-chart>
```
This will print the template helm will use to install this chart. Check the values and if something is missing, please make ammends.

Expand Down Expand Up @@ -231,6 +243,7 @@ Therefore, ***always go with Node autoscalling***

## [9.0] Changelog:

- 1.2.1 - Chart now supports node selectors and tolerationss see: [4.11](https://github.com/Blazemeter/helm-crane/tree/NodeSelector-%26-Toleration?tab=readme-ov-file#411-configure-deployment-to-support-node-selectors-and-tolerations)
- 1.2.0 - Chart now supports service virtualisation deployment using nginx-ingress [4.7]
- 1.1.0 - Chart now supports inheriting labels and resourcelimits to child pods from crane environment [4.9] [4.10]
- 1.0.1 - The AUTH_TOKEN can now be inherited from a secret [4.8]
Expand Down
20 changes: 14 additions & 6 deletions templates/crane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ spec:
{{- end }}
- name: NO_PROXY
value: {{ .Values.proxy.no_proxy }}
{{- end -}}
{{ end -}}
{{ if .Values.ca_bundle.enable }}
- name: REQUEST_CA_BUNDLE
value: {{ .Values.volume.mount_path }}/{{ .Values.ca_bundle.ca_subpath }}
- name: AWS_CA_BUNDLE
value: {{ .Values.volume.mount_path }}/{{ .Values.ca_bundle.aws_subpath }}
- name: KUBERNETES_CA_BUNDLE_MOUNT
value: REQUESTS_CA_BUNDLE={{ .Release.Name }}-configmap=certificate.crt:AWS_CA_BUNDLE={{ .Release.Name }}-configmap=certificate.crt
{{- end -}}
{{ end -}}
{{ if and (.Values.istio_ingress.enable) (eq .Values.nginx_ingress.enable false) }}
- name: KUBERNETES_WEB_EXPOSE_TYPE
value: ISTIO
Expand All @@ -80,7 +80,7 @@ spec:
value: "true"
- name: KUBERNETES_ISTIO_GATEWAY_NAME
value: {{ .Values.istio_ingress.istio_gateway_name | quote }}
{{- end -}}
{{ end -}}
{{ if and (.Values.nginx_ingress.enable) (eq .Values.istio_ingress.enable false)}}
- name: KUBERNETES_WEB_EXPOSE_TYPE
value: INGRESS
Expand All @@ -98,15 +98,23 @@ spec:
value: 'true'
- name: RUN_HEALTH_WEB_SERVICE
value: 'true'
{{- end -}}
{{end -}}
{{ if .Values.non_privilege_container.enable }}
- name: INHERIT_RUNNING_USER_AND_GROUP
value: 'true'
{{ end }}
{{- if .Values.labels.enable }}
- name: KUBERNETES_LABELS
value: {{ .Values.labels.labelsJson | toJson | quote}}
{{ end }}
value: {{ .Values.labels.syntax | toJson | quote }}
{{ end -}}
{{ if .Values.toleration.enable }}
- name: KUBERNETES_TOLERATIONS_JSON
value: {{ .Values.toleration.syntax | toJson | quote }}
{{ end -}}
{{ if .Values.nodeSelector.enable }}
- name: KUBERNETES_NODE_SELECTOR_JSON
value: {{ .Values.nodeSelector.syntax | toJson | quote }}
{{ end -}}
{{ if .Values.resourceLimit.enable }}
- name: KUBERNETES_RESOURCES_LIMITS_CPU
value: {{ .Values.resourceLimit.CPU | quote }}
Expand Down
24 changes: 21 additions & 3 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,32 @@ nginx_ingress:
credentialName: "wildcard-credential"
web_expose_subdomain: "mydomain.local"

# Labels to add to resources created by Crane
# Labels to add to resources created by Crane, must be in JSON format.
labels:
enable: no
labelsJson: {"label_1": "label_1_value", "label_2": "label2value"}
syntax: {"label_1": "label_1_value", "label_2": "label2value"}

#Set to specify that the crane container passes tolerations and node selector elements to child containers.
toleration:
enable: no
syntax: [{ "effect": "NoSchedule", "key": "lifecycle", "operator": "Equal", "value": "spot" }]

#Used to configure the k8s nodeSelector field to match specific node labels for the Crane engine deployment. Must be in JSON format.
nodeSelector:
enable: no
syntax: {"label_1": "label_1_value", "label_2": "label_2_value"}

#For functional test only
# The user-defined port where to run Doduo (BlazeMeter Grid Proxy). By default, Doduo listens on port 8000.
doduoPort:
# The public certificate for the domain used to run the BlazeMeter Grid proxy over HTTPS. Value in string format.
tlsCertGrid:
#The private key for the domain used to run the BlazeMeter Grid proxy over HTTPS. Value in string format.
tlsKeyGrid:

# CPU limits for resources created by agent.
# Memory limits for resources created by agent.
resourceLimit:
enable: no
CPU: "800m"
MEM: "4Gi"
MEM: "4Gi"

0 comments on commit 51b7f9d

Please sign in to comment.