Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check minimal k8s version before installation #1240

Merged
merged 3 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ deploy/helm/sumologic/charts
deploy/helm/sumologic/charts/*
deploy/helm/sumologic/requirements.lock

# Helm chart lock file
deploy/helm/sumologic/Chart.lock

# vagrant ignores
.vagrant
ubuntu-bionic-18.04-cloudimg-console.log
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/conf/metrics/metrics.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@label @DATAPOINT
</match>
<label @DATAPOINT>
{{- if and (eq .Capabilities.KubeVersion.Major "1") (gt (int (regexFind "^\\d+" .Capabilities.KubeVersion.Minor)) 13) (lt (int (regexFind "^\\d+" .Capabilities.KubeVersion.Minor)) 17) }}
{{- if and (eq .Capabilities.KubeVersion.Major "1") (gt (int (include "kubernetes.minor" .)) 13) (lt (int (include "kubernetes.minor" .)) 17) }}
<filter prometheus.metrics**> # NOTE: Remove this filter if you are running Kubernetes 1.13 or below.
@type grep
<exclude>
Expand Down
12 changes: 12 additions & 0 deletions deploy/helm/sumologic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -925,3 +925,15 @@ Example:
{{- $_ := set $local "first" false -}}
{{- end -}}
{{- end -}}


{{/*
Returns kubernetes minor version as integer (without additional chars like +)

Example:

{{ include "kubernetes.minor" . }}
*/}}
{{- define "kubernetes.minor" -}}
{{- print (regexFind "^\\d+" .Capabilities.KubeVersion.Minor) -}}
{{- end -}}
6 changes: 6 additions & 0 deletions deploy/helm/sumologic/templates/checks.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{/* Check if kubernetes version is less or equal 1.16 */}}
{{- if not .Values.sumologic.setup.force -}}
{{- if and (eq .Capabilities.KubeVersion.Major "1") (lt (int (include "kubernetes.minor" .)) 16) -}}
{{- fail "At least k8s 1.16 is required. Please update your k8s version or set sumologic.setup.force to true" -}}
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ sumologic:
create: false

setup:
## uncomment to force collection installation (disables k8s version verification)
# force: true
job:
image:
repository: public.ecr.aws/sumologic/kubernetes-setup
Expand Down