Skip to content

Commit

Permalink
Fix service generation in gateway (signalfx#143)
Browse files Browse the repository at this point in the history
targetPort wasn't getting set correctly. Turn on gateway-only generation.
  • Loading branch information
jrcamp authored May 20, 2021
1 parent b3fcb50 commit d6c6189
Show file tree
Hide file tree
Showing 9 changed files with 407 additions and 11 deletions.
27 changes: 17 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@ render:
--namespace default \
--values rendered/values.yaml \
--set metricsEnabled=false,tracesEnabled=false,logsEnabled=false,$${i}Enabled=true \
--output-dir "$$dir" default helm-charts/splunk-otel-collector; \
--output-dir "$$dir" \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector; \
done

# All telemetry types but no gateway, only agent.
dir=rendered/manifests/agent-only; \
mkdir -p "$$dir"; \
helm template --namespace default --values rendered/values.yaml --output-dir "$$dir" \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector

# XXX: Disable for now, reenable on otel-logs branch.
# # All telemetry types but no agent, only gateway.
# mkdir -p rendered/manifests/gateway-only
# helm template --namespace default --values rendered/values.yaml --output-dir rendered/manifests/gateway-only \
# --set otelAgent.enabled=false,otelCollector.enabled=true,otelK8sClusterReceiver.enabled=false,fluentd.enabled=false \
# default helm-charts/splunk-otel-collector
# mv rendered/manifests/gateway-only/splunk-otel-collector/templates/* rendered/manifests/gateway-only
# rm -rf rendered/manifests/gateway-only/splunk-otel-collector
# All telemetry types but no agent, only gateway.
dir=rendered/manifests/gateway-only; \
mkdir -p "$$dir"; \
helm template \
--namespace default \
--values rendered/values.yaml \
--output-dir "$$dir" \
--set otelAgent.enabled=false,otelCollector.enabled=true,otelK8sClusterReceiver.enabled=false,logsEnabled=false \
default helm-charts/splunk-otel-collector; \
mv "$$dir"/splunk-otel-collector/templates/* "$$dir"; \
rm -rf "$$dir"/splunk-otel-collector
2 changes: 1 addition & 1 deletion helm-charts/splunk-otel-collector/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- range $key, $port := .Values.otelCollector.ports }}
- name: {{ $key }}
port: {{ $port.containerPort }}
targetPort: {{ $port.targetPort }}
targetPort: {{ $key }}
protocol: {{ $port.protocol }}
{{- end }}
selector:
Expand Down
78 changes: 78 additions & 0 deletions rendered/manifests/gateway-only/clusterRole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
# Source: splunk-otel-collector/templates/clusterRole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: default-splunk-otel-collector
labels:
app: splunk-otel-collector
chart: splunk-otel-collector-0.25.0
release: default
heritage: Helm
rules:
- apiGroups:
- ""
resources:
- events
- namespaces
- namespaces/status
- nodes
- nodes/spec
- nodes/stats
- nodes/proxy
- pods
- pods/status
- persistentvolumeclaims
- persistentvolumes
- replicationcontrollers
- replicationcontrollers/status
- resourcequotas
- services
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- replicasets
- statefulsets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- daemonsets
- deployments
- replicasets
verbs:
- get
- list
- watch
- apiGroups:
- batch
resources:
- jobs
- cronjobs
verbs:
- get
- list
- watch
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
- list
- watch
19 changes: 19 additions & 0 deletions rendered/manifests/gateway-only/clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Source: splunk-otel-collector/templates/clusterRoleBinding.yaml
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: default-splunk-otel-collector
labels:
app: splunk-otel-collector
chart: splunk-otel-collector-0.25.0
release: default
heritage: Helm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: default-splunk-otel-collector
subjects:
- kind: ServiceAccount
name: default-splunk-otel-collector
namespace: default
113 changes: 113 additions & 0 deletions rendered/manifests/gateway-only/configmap-otel-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
# Source: splunk-otel-collector/templates/configmap-otel-collector.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: default-splunk-otel-collector-otel-collector
labels:
app: splunk-otel-collector
chart: splunk-otel-collector-0.25.0
release: default
heritage: Helm
data:
relay: |
exporters:
sapm:
access_token: ${SPLUNK_ACCESS_TOKEN}
endpoint: https://ingest.CHANGEME.signalfx.com/v2/trace
signalfx:
access_token: ${SPLUNK_ACCESS_TOKEN}
api_url: https://api.CHANGEME.signalfx.com
ingest_url: https://ingest.CHANGEME.signalfx.com
extensions:
health_check: null
http_forwarder:
egress:
endpoint: https://api.CHANGEME.signalfx.com
zpages: null
processors:
batch: null
k8s_tagger:
extract:
metadata:
- namespace
- node
- podName
- podUID
memory_limiter:
ballast_size_mib: ${SPLUNK_BALLAST_SIZE_MIB}
check_interval: 5s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
resource/add_cluster_name:
attributes:
- action: upsert
key: k8s.cluster.name
value: CHANGEME
receivers:
fluentforward:
endpoint: 0.0.0.0:8006
jaeger:
protocols:
grpc:
endpoint: 0.0.0.0:14250
thrift_http:
endpoint: 0.0.0.0:14268
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:55681
prometheus:
config:
scrape_configs:
- job_name: otel-collector
scrape_interval: 10s
static_configs:
- targets:
- ${K8S_POD_IP}:8888
sapm:
endpoint: 0.0.0.0:7276
signalfx:
access_token_passthrough: true
endpoint: 0.0.0.0:9943
zipkin:
endpoint: 0.0.0.0:9411
service:
extensions:
- health_check
- http_forwarder
- zpages
pipelines:
logs:
exporters:
- signalfx
processors:
- memory_limiter
- batch
receivers:
- signalfx
metrics:
exporters:
- signalfx
processors:
- memory_limiter
- batch
- resource/add_cluster_name
receivers:
- otlp
- prometheus
- signalfx
traces:
exporters:
- sapm
processors:
- memory_limiter
- batch
- k8s_tagger
- resource/add_cluster_name
receivers:
- otlp
- jaeger
- zipkin
- sapm
102 changes: 102 additions & 0 deletions rendered/manifests/gateway-only/deployment-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
# Source: splunk-otel-collector/templates/deployment-collector.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: default-splunk-otel-collector
labels:
app: splunk-otel-collector
component: otel-collector
chart: splunk-otel-collector-0.25.0
release: default
heritage: Helm
spec:
replicas: 3
selector:
matchLabels:
app: splunk-otel-collector
component: otel-collector
release: default
template:
metadata:
labels:
app: splunk-otel-collector
component: otel-collector
release: default
annotations:
checksum/config: e7c1e7d65304132c391296b84cab212fda9d6d5cbdb4be982a64e94443183f89
spec:
serviceAccountName: default-splunk-otel-collector
containers:
- name: otel-collector
command:
- /otelcol
- --config=/conf/relay.yaml
- --metrics-addr=0.0.0.0:8888
image: quay.io/signalfx/splunk-otel-collector:0.25.0
imagePullPolicy: IfNotPresent
env:
- name: SPLUNK_MEMORY_TOTAL_MIB
value: "8192"
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: K8S_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: SPLUNK_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: splunk-otel-collector
key: splunk_access_token
ports:
- name: fluentforward
containerPort: 8006
protocol: TCP
- name: http-forwarder
containerPort: 6060
protocol: TCP
- name: jaeger-grpc
containerPort: 14250
protocol: TCP
- name: jaeger-thrift
containerPort: 14268
protocol: TCP
- name: otlp
containerPort: 4317
protocol: TCP
- name: sapm
containerPort: 7276
protocol: TCP
- name: signalfx
containerPort: 9943
protocol: TCP
- name: zipkin
containerPort: 9411
protocol: TCP
readinessProbe:
httpGet:
path: /
port: 13133
livenessProbe:
httpGet:
path: /
port: 13133
resources:
limits:
cpu: 4
memory: 8Gi
volumeMounts:
- mountPath: /conf
name: collector-configmap
terminationGracePeriodSeconds: 600
volumes:
- name: collector-configmap
configMap:
name: default-splunk-otel-collector-otel-collector
items:
- key: relay
path: relay.yaml
15 changes: 15 additions & 0 deletions rendered/manifests/gateway-only/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Source: splunk-otel-collector/templates/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: splunk-otel-collector
labels:
app: splunk-otel-collector
chart: splunk-otel-collector-0.25.0
release: default
heritage: Helm
type: Opaque
data:
splunk_access_token: Q0hBTkdFTUU=
splunk_hec_token: Q0hBTkdFTUU=
Loading

0 comments on commit d6c6189

Please sign in to comment.