Skip to content

Commit fc9ee72

Browse files
authored
optional gw replicas field (signalfx#2199)
1 parent 73fb114 commit fc9ee72

File tree

6 files changed

+76
-5
lines changed

6 files changed

+76
-5
lines changed

.chloggen/replica-optional.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, operator, chart, other)
4+
component: gateway
5+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
6+
note: Make replicaCount optional for the gateway deployment to allow HPA to manage replicas without conflicts
7+
# One or more tracking issues related to the change
8+
issues: [2198]

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ dep-update: ## Fetch Helm chart dependency repositories, build the Helm chart wi
6262
helm repo add jetstack https://charts.jetstack.io || exit 1; \
6363
fi ;\
6464
helm repo update open-telemetry jetstack || exit 1; \
65-
DEP_OK=true ;\
66-
if ! helm dependencies list $$DIR | grep open-telemetry | grep -q ok ; then DEP_OK=false ; fi ;\
67-
if ! helm dependencies list $$DIR | grep jetstack | grep -q ok ; then DEP_OK=false ; fi ;\
68-
if [ "$$DEP_OK" = "false" ] ; then helm dependencies update $$DIR || exit 1; fi ;\
65+
if helm dependencies list $$DIR | grep -q missing ; then \
66+
echo "Dependencies missing, updating..."; \
67+
helm dependencies update $$DIR || exit 1; \
68+
else \
69+
echo "All dependencies are up to date."; \
70+
fi ;\
6971
if [ -f "$$LOCK_FILE" ] ; then \
7072
echo "Removing Chart.lock file post-update..."; \
7173
rm -f "$$LOCK_FILE" || exit 1; \

helm-charts/splunk-otel-collector/templates/deployment-gateway.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ metadata:
1616
{{- toYaml .Values.gateway.annotations | nindent 4 }}
1717
{{- end }}
1818
spec:
19+
{{- if not (kindIs "invalid" .Values.gateway.replicaCount) }}
1920
replicas: {{ .Values.gateway.replicaCount }}
21+
{{- end }}
2022
selector:
2123
matchLabels:
2224
app: {{ template "splunk-otel-collector.name" . }}

helm-charts/splunk-otel-collector/values.schema.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,10 @@
10721072
"type": "boolean"
10731073
},
10741074
"replicaCount": {
1075-
"type": "integer"
1075+
"type": [
1076+
"integer",
1077+
"null"
1078+
]
10761079
},
10771080
"ports": {
10781081
"type": "object",

helm-charts/splunk-otel-collector/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ gateway:
812812
enabled: false
813813

814814
# Number of collector replicas
815+
# Set to null if using HorizontalPodAutoscaler to avoid conflicts
815816
replicaCount: 3
816817

817818
# The ports exposed by the collector container.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
suite: splunk-otel-collector.gatewayDeployment
2+
values:
3+
- ./values/basic.yaml
4+
release:
5+
name: test-release
6+
namespace: test-ns
7+
templates:
8+
- deployment-gateway.yaml
9+
- configmap-gateway.yaml
10+
11+
tests:
12+
- it: should not render gateway deployment when gateway.enabled is false
13+
set:
14+
gateway:
15+
enabled: false
16+
asserts:
17+
- hasDocuments:
18+
count: 0
19+
20+
- it: should render gateway deployment with default replicaCount
21+
template: deployment-gateway.yaml
22+
set:
23+
gateway:
24+
enabled: true
25+
asserts:
26+
- isKind:
27+
of: Deployment
28+
- equal:
29+
path: spec.replicas
30+
value: 3
31+
32+
- it: should render gateway deployment with custom replicaCount
33+
template: deployment-gateway.yaml
34+
set:
35+
gateway:
36+
enabled: true
37+
replicaCount: 5
38+
asserts:
39+
- isKind:
40+
of: Deployment
41+
- equal:
42+
path: spec.replicas
43+
value: 5
44+
45+
- it: should not set replicas field when replicaCount is null (for HPA usage)
46+
template: deployment-gateway.yaml
47+
set:
48+
gateway:
49+
enabled: true
50+
replicaCount: null
51+
asserts:
52+
- isKind:
53+
of: Deployment
54+
- isNull:
55+
path: spec.replicas

0 commit comments

Comments
 (0)