Skip to content

Commit

Permalink
Merge pull request #58 from srl-labs/fix/replicas-values
Browse files Browse the repository at this point in the history
fix: replicas value, simpler values setup always assume sane defaults
  • Loading branch information
carlmontanari authored Oct 19, 2023
2 parents ae1e7d5 + ff05537 commit 5baa382
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions charts/clabernetes/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ spec:
matchLabels:
clabernetes/app: {{ .Values.appName }}
release: {{ .Release.Name }}
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.manager.replicaCount }}
strategy:
rollingUpdate:
maxSurge: 1
{{- if (eq (int .Values.replicaCount) 1) }}
{{- if (eq (int .Values.manager.replicaCount) 1) }}
maxUnavailable: 0
{{- else }}
maxUnavailable: 1
Expand Down Expand Up @@ -138,10 +138,8 @@ spec:
fieldPath: metadata.namespace
- name: CLIENT_OPERATION_TIMEOUT_MULTIPLIER
value: "{{ .Values.manager.clientOperationTimeoutMultiplier }}"
{{- if .Values.manager.inClusterDNSSuffixOverride }}
- name: IN_CLUSTER_DNS_SUFFIX_OVERRIDE
value: {{ .Values.manager.inClusterDNSSuffixOverride }}
{{- end }}
- name: IN_CLUSTER_DNS_SUFFIX
value: {{ .Values.manager.inClusterDNSSuffix }}
- name: MANAGER_LOGGER_LEVEL
value: {{ .Values.manager.managerLogLevel }}
- name: CONTROLLER_LOGGER_LEVEL
Expand Down
2 changes: 1 addition & 1 deletion charts/clabernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ manager:
clientOperationTimeoutMultiplier: 1
managerLogLevel: info
controllerLogLevel: info
# inClusterDNSSuffixOverride: domain.or.whatever
inClusterDNSSuffix: svc.cluster.local

# pod affinity settings, directly inserted into manager deployment spec; if not provided basic
# common-sense anti-affinity is applied.
Expand Down
6 changes: 3 additions & 3 deletions constants/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const (
// operation timeout.
ClientOperationTimeoutMultiplierEnv = "CLIENT_OPERATION_TIMEOUT_MULTIPLIER"

// InClusterDNSSuffixOverrideEnv is the env var specifying an optional DNS suffix to replace the
// default value of 'svc.cluster.local".
InClusterDNSSuffixOverrideEnv = "IN_CLUSTER_DNS_SUFFIX_OVERRIDE"
// InClusterDNSSuffixEnv is the env var specifying the DNS suffix to use to resolve in cluster
// services, typically 'svc.cluster.local".
InClusterDNSSuffixEnv = "IN_CLUSTER_DNS_SUFFIX"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion controllers/topology/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func serviceConforms(
// override value.
func GetServiceDNSSuffix() string {
return clabernetesutil.GetEnvStrOrDefault(
clabernetesconstants.InClusterDNSSuffixOverrideEnv,
clabernetesconstants.InClusterDNSSuffixEnv,
clabernetesconstants.DefaultInClusterDNSSuffix,
)
}
2 changes: 1 addition & 1 deletion util/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// if casting fails or the environment variable is not set.
func GetEnvStrOrDefault(k, d string) string {
v, ok := os.LookupEnv(k)
if ok {
if ok && v != "" {
return v
}

Expand Down

0 comments on commit 5baa382

Please sign in to comment.