Skip to content

Commit

Permalink
fix: add flower
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Kheifets <[email protected]>
  • Loading branch information
ikheifets-splunk committed Dec 9, 2024
1 parent 527bd84 commit c97b876
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if .Values.flower.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: flower
namespace: sc4snmp
spec:
replicas: 1
selector:
matchLabels:
app: flower
template:
metadata:
labels:
app: flower
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: flower
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
[
"celery", "flower",
]
env:
{{- include "environmental-variables" . | nindent 12 }}
ports:
- containerPort: 5555

volumeMounts:
- name: config
mountPath: "/app/config"
readOnly: true
- name: pysnmp-cache-volume
mountPath: "/.pysnmp/"
readOnly: false
- name: tmp
mountPath: "/tmp/"
readOnly: false
volumes:
- name: config
configMap:
name: {{ include "splunk-connect-for-snmp.name" . }}-config
items:
- key: "config.yaml"
path: "config.yaml"
- name: pysnmp-cache-volume
emptyDir: {}
- name: tmp
emptyDir: {}

{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.flower.enabled }}
apiVersion: v1
kind: Service
metadata:
name: flower-svc
namespace: sc4snmp

spec:
selector:
app: flower
ports:
- protocol: TCP
port: {{ .Values.flower.port | default 80 }}
targetPort: 5555
type: LoadBalancer
{{- if .Values.flower.loadBalancerIP }}
externalIPs:
- {{ .Values.flower.loadBalancerIP }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/splunk-connect-for-snmp/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
"pysnmpDebug": {
"type": "string"
},
"flower": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"loadBalancerIP": {
"type": "string"
},
"port": {
"type": "integer"
}
}
},
"UI": {
"type": "object",
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions charts/splunk-connect-for-snmp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ UI:
# valuesFileDirectory directory regardless of valuesFileName proper configuration.
keepSectionFiles: false

flower:
enabled: false
port: 80
loadBalancerIP: ''

################################################################################
# Splunk Cloud / Splunk Enterprise configuration.
################################################################################
Expand Down
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ celery)
worker-sender)
celery -A splunk_connect_for_snmp.poller worker -l "$LOG_LEVEL" -Q send --autoscale=6,"$WORKER_CONCURRENCY"
;;
flower)
celery -A splunk_connect_for_snmp.poller flower
;;
*)
celery "$2"
;;
Expand Down
70 changes: 68 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ JSON-log-formatter ="^0.5.1"
pysnmplib = {git = "https://github.com/pysnmp/pysnmp.git", branch = "main"}
urllib3 = "^1.26.17"
jsonschema = "4.23.0"
flower = "^2.0.1"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
Expand Down

0 comments on commit c97b876

Please sign in to comment.