Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/alertmanager-snmp-notifier/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ home: https://github.com/maxwo/snmp_notifier
sources:
- https://github.com/maxwo/snmp_notifier
type: application
version: 2.1.0
version: 2.2.0
# renovate: github-releases=maxwo/snmp_notifier
appVersion: v2.1.0
kubeVersion: ">=1.23.0-0"
Expand Down
24 changes: 24 additions & 0 deletions charts/alertmanager-snmp-notifier/ci/httproute-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
## Test case: httproute
snmpNotifier:
snmpDestinations:
- 127.0.0.1:162

route:
main:
enabled: true
hostnames:
- "an.example.com"
parentRefs:
- name: contour
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: my-header-name
value: my-new-header-value
additionalRules:
- filters:
- type: RequestHeaderModifier
requestHeaderModifier:
remove: ["x-request-id"]
11 changes: 11 additions & 0 deletions charts/alertmanager-snmp-notifier/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Allow the release namespace to be overridden
*/}}
{{- define "alertmanager-snmp-notifier.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
47 changes: 47 additions & 0 deletions charts/alertmanager-snmp-notifier/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- range $name, $route := .Values.route }}
{{- if $route.enabled }}
---
apiVersion: {{ $route.apiVersion | default "gateway.networking.k8s.io/v1" }}
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
{{- with $route.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
name: {{ include "alertmanager-snmp-notifier.fullname" $ }}
namespace: {{ include "alertmanager-snmp-notifier.namespace" $ }}
labels:
{{- include "alertmanager-snmp-notifier.labels" $ | nindent 4 }}
{{- with $route.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $route.parentRefs }}
parentRefs: {{ toYaml . | nindent 4 }}
{{- end }}
{{- with $route.hostnames }}
hostnames: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- with $route.additionalRules }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- if $route.httpsRedirect }}
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
{{- else }}
- name: {{ $route.name | default $name }}
backendRefs:
- name: {{ include "alertmanager-snmp-notifier.fullname" $ }}
port: {{ $.Values.service.port }}
{{- with $route.filters }}
filters: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
56 changes: 55 additions & 1 deletion charts/alertmanager-snmp-notifier/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ snmpNotifier:
snmpDestinations:
- snmp-server:162

# SNMP authentication secrets, that may be instanciated by the chart, or may use an already created secret
# SNMP authentication secrets, that may be instantiated by the chart, or may use an already created secret
# snmpCommunity: public
# snmpAuthenticationUsername: my_authentication_username
# snmpAuthenticationPassword: my_authentication_password
Expand Down Expand Up @@ -92,6 +92,9 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

## Provide a namespace to substitute for the namespace on resources
namespaceOverride: ""

service:
type: ClusterIP
port: 9464
Expand All @@ -116,6 +119,57 @@ ingress:
# hosts:
# - snmp-notifier.local

## A HTTPRoute (Gateway API) resource is an alternative to Ingress for routing
## external HTTP traffic to the SNMP notifier Service.
## ref: https://gateway-api.sigs.k8s.io/api-types/httproute/
route:
main:
## Enable this route
enabled: false

## ApiVersion set by default to "gateway.networking.k8s.io/v1"
apiVersion: ""
## kind set by default to HTTPRoute
kind: ""

## Optional name for the default rule in the rendered HTTPRoute.
name: ""

## Annotations to attach to the HTTPRoute resource
annotations: {}
## Labels to attach to the HTTPRoute resource
labels: {}

## ParentRefs refers to resources this HTTPRoute is to be attached to (Gateways)
parentRefs: []
# - name: contour
# sectionName: http

## Hostnames (templated) defines a set of hostnames that should match against the HTTP Host
## header to select a HTTPRoute used to process the request
hostnames: []
# - my.example.com

## additionalRules (templated) allows adding custom rules to the route
additionalRules: []

## Filters define the filters that are applied to requests that match
## this rule
filters: []

## Matches define conditions used for matching the rule against incoming
## HTTP requests
matches:
- path:
type: PathPrefix
value: /

## httpsRedirect adds a filter for redirecting to https (HTTP 301 Moved Permanently).
## To redirect HTTP traffic to HTTPS, you need to have a Gateway with both HTTP and HTTPS listeners.
## Matches and filters do not take effect if enabled.
## Ref. https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/
httpsRedirect: false

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down