Fix helm charts when pass values file. (#2222)
This commit is contained in:
parent
01e9dd31a9
commit
835eac7835
|
|
@ -1,4 +1,5 @@
|
|||
# This file defines the config for "ct" (chart tester) used by the helm linting GitHub workflow
|
||||
all: true
|
||||
lint-conf: charts/.ci/lint-config.yaml
|
||||
chart-repos:
|
||||
- jetstack=https://charts.jetstack.io
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@ spec:
|
|||
runnerGroup: {{ . }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and (kindIs "int64" .Values.minRunners) (kindIs "int64" .Values.maxRunners) }}
|
||||
{{- if and (or (kindIs "int64" .Values.minRunners) (kindIs "float64" .Values.minRunners)) (or (kindIs "int64" .Values.maxRunners) (kindIs "float64" .Values.maxRunners)) }}
|
||||
{{- if gt .Values.minRunners .Values.maxRunners }}
|
||||
{{- fail "maxRunners has to be greater or equal to minRunners" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if kindIs "int64" .Values.maxRunners }}
|
||||
{{- if lt .Values.maxRunners 0 }}
|
||||
{{- if or (kindIs "int64" .Values.maxRunners) (kindIs "float64" .Values.maxRunners) }}
|
||||
{{- if lt (.Values.maxRunners | int) 0 }}
|
||||
{{- fail "maxRunners has to be greater or equal to 0" }}
|
||||
{{- end }}
|
||||
maxRunners: {{ .Values.maxRunners | int }}
|
||||
{{- end }}
|
||||
|
||||
{{- if kindIs "int64" .Values.minRunners }}
|
||||
{{- if lt .Values.minRunners 0 }}
|
||||
{{- if or (kindIs "int64" .Values.minRunners) (kindIs "float64" .Values.minRunners) }}
|
||||
{{- if lt (.Values.minRunners | int) 0 }}
|
||||
{{- fail "minRunners has to be greater or equal to 0" }}
|
||||
{{- end }}
|
||||
minRunners: {{ .Values.minRunners | int }}
|
||||
|
|
|
|||
|
|
@ -495,6 +495,33 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunnersValidation_OnlyMax(t
|
|||
assert.Nil(t, ars.Spec.MinRunners, "MinRunners should be nil")
|
||||
}
|
||||
|
||||
func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunners_FromValuesFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Path to the helm chart we will test
|
||||
helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set")
|
||||
require.NoError(t, err)
|
||||
|
||||
testValuesPath, err := filepath.Abs("../tests/values.yaml")
|
||||
require.NoError(t, err)
|
||||
|
||||
releaseName := "test-runners"
|
||||
namespaceName := "test-" + strings.ToLower(random.UniqueId())
|
||||
|
||||
options := &helm.Options{
|
||||
ValuesFiles: []string{testValuesPath},
|
||||
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
|
||||
}
|
||||
|
||||
output := helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/autoscalingrunnerset.yaml"})
|
||||
|
||||
var ars v1alpha1.AutoscalingRunnerSet
|
||||
helm.UnmarshalK8SYaml(t, output, &ars)
|
||||
|
||||
assert.Equal(t, 5, *ars.Spec.MinRunners, "MinRunners should be 5")
|
||||
assert.Equal(t, 10, *ars.Spec.MaxRunners, "MaxRunners should be 10")
|
||||
}
|
||||
|
||||
func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
githubConfigUrl: https://github.com/actions/actions-runner-controller
|
||||
githubConfigSecret:
|
||||
github_token: test
|
||||
maxRunners: 10
|
||||
minRunners: 5
|
||||
Loading…
Reference in New Issue