mirror of
https://github.com/valitydev/helmsdeep.git
synced 2024-11-06 08:55:21 +00:00
Add hooker chart (#36)
This commit is contained in:
parent
d0cfa181d9
commit
48efe80c7c
7
config/hooker/entrypoint.sh
Normal file
7
config/hooker/entrypoint.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
java \
|
||||||
|
"-XX:OnOutOfMemoryError=kill %p" -XX:+HeapDumpOnOutOfMemoryError \
|
||||||
|
${@} \
|
||||||
|
--spring.config.additional-location=/vault/secrets/application.properties
|
15
config/hooker/values.yaml
Normal file
15
config/hooker/values.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
podAnnotations:
|
||||||
|
vault.hashicorp.com/role: "db-app-hook"
|
||||||
|
vault.hashicorp.com/agent-inject: "true"
|
||||||
|
vault.hashicorp.com/agent-inject-secret-application.properties: "database/creds/db-app-hook"
|
||||||
|
vault.hashicorp.com/agent-inject-template-application.properties: |
|
||||||
|
{{- with secret "database/creds/db-app-hook" -}}
|
||||||
|
spring.datasource.url=jdbc:postgresql://postgres-postgresql:5432/hook?sslmode=disable
|
||||||
|
spring.datasource.username={{ .Data.username }}
|
||||||
|
spring.datasource.password={{ .Data.password }}
|
||||||
|
spring.flyway.url=jdbc:postgresql://postgres-postgresql:5432/hook?sslmode=disable
|
||||||
|
spring.flyway.user={{ .Data.username }}
|
||||||
|
spring.flyway.password={{ .Data.password }}
|
||||||
|
{{- end }}
|
@ -7,3 +7,4 @@ initdbScripts:
|
|||||||
rbk-dbs.sql: |
|
rbk-dbs.sql: |
|
||||||
CREATE DATABASE keycloak;
|
CREATE DATABASE keycloak;
|
||||||
CREATE DATABASE shumway;
|
CREATE DATABASE shumway;
|
||||||
|
CREATE DATABASE hook;
|
||||||
|
@ -24,6 +24,21 @@ data:
|
|||||||
GRANT ALL ON ALL SEQUENCES IN SCHEMA shm TO \"{{name}}\";" \
|
GRANT ALL ON ALL SEQUENCES IN SCHEMA shm TO \"{{name}}\";" \
|
||||||
default_ttl="1h" \
|
default_ttl="1h" \
|
||||||
max_ttl="240h"
|
max_ttl="240h"
|
||||||
|
vault write database/config/hook \
|
||||||
|
plugin_name=postgresql-database-plugin \
|
||||||
|
allowed_roles="*" \
|
||||||
|
connection_url="postgresql://{{username}}:{{password}}@postgres-postgresql.default:5432/hook?sslmode=disable" \
|
||||||
|
username="postgres" \
|
||||||
|
password="uw2dFhY9EP"
|
||||||
|
vault write database/roles/db-app-hook \
|
||||||
|
db_name=hook \
|
||||||
|
creation_statements="Create schema if not exists hook;
|
||||||
|
CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}';
|
||||||
|
GRANT CREATE ON DATABASE hook TO \"{{name}}\";
|
||||||
|
GRANT ALL ON schema hook TO \"{{name}}\";
|
||||||
|
GRANT ALL ON ALL TABLES IN SCHEMA hook TO \"{{name}}\";" \
|
||||||
|
default_ttl="1h" \
|
||||||
|
max_ttl="24h"
|
||||||
|
|
||||||
vault auth enable kubernetes
|
vault auth enable kubernetes
|
||||||
vault write auth/kubernetes/config \
|
vault write auth/kubernetes/config \
|
||||||
@ -40,5 +55,8 @@ data:
|
|||||||
vault policy write db-app /vault-init/db-policy.hcl
|
vault policy write db-app /vault-init/db-policy.hcl
|
||||||
db-policy.hcl: |
|
db-policy.hcl: |
|
||||||
path "database/creds/db-app" {
|
path "database/creds/db-app" {
|
||||||
capabilities = ["read"]
|
capabilities = ["read"]
|
||||||
|
}
|
||||||
|
path "database/creds/db-app-hook" {
|
||||||
|
capabilities = ["read"]
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,11 @@ releases:
|
|||||||
set:
|
set:
|
||||||
- name: entrypoint
|
- name: entrypoint
|
||||||
file: config/shumway/entrypoint.sh
|
file: config/shumway/entrypoint.sh
|
||||||
|
- name: hooker
|
||||||
|
<<: *default
|
||||||
|
set:
|
||||||
|
- name: entrypoint
|
||||||
|
file: config/hooker/entrypoint.sh
|
||||||
- name: dominant
|
- name: dominant
|
||||||
<<: *default
|
<<: *default
|
||||||
needs:
|
needs:
|
||||||
@ -230,3 +235,15 @@ releases:
|
|||||||
file: config/api-common/keys/token-encryption-keys/1.jwk
|
file: config/api-common/keys/token-encryption-keys/1.jwk
|
||||||
- name: wapiPrivkey
|
- name: wapiPrivkey
|
||||||
file: config/api-common/keys/capi.privkey.pem
|
file: config/api-common/keys/capi.privkey.pem
|
||||||
|
- name: proxy-mocketbank
|
||||||
|
<<: *default
|
||||||
|
set:
|
||||||
|
- name: knownCards
|
||||||
|
file: config/proxy-mocketbank/cards.csv
|
||||||
|
- name: errorMapping
|
||||||
|
file: config/proxy-mocketbank/errors.json
|
||||||
|
- name: prometheus
|
||||||
|
<<: *default
|
||||||
|
chart: stable/prometheus-operator
|
||||||
|
namespace: monitoring
|
||||||
|
createNamespace: true
|
||||||
|
23
services/hooker/.helmignore
Normal file
23
services/hooker/.helmignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
6
services/hooker/Chart.yaml
Normal file
6
services/hooker/Chart.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: hooker
|
||||||
|
description: Service for sending webhooks
|
||||||
|
type: application
|
||||||
|
version: 2.0.56
|
||||||
|
appVersion: ef17ab6aa814411c38b0774837d19bf33b3a1d35
|
69
services/hooker/templates/_helpers.tpl
Normal file
69
services/hooker/templates/_helpers.tpl
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- if contains $name .Release.Name }}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "hooker.chart" . }}
|
||||||
|
{{ include "hooker.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "hooker.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "hooker.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Configs hash
|
||||||
|
*/}}
|
||||||
|
{{- define "hooker.propertiesHash" -}}
|
||||||
|
{{- include (print $.Template.BasePath "/configmap.yaml") . | sha256sum -}}
|
||||||
|
{{- end -}}
|
10
services/hooker/templates/configmap.yaml
Normal file
10
services/hooker/templates/configmap.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "hooker.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.labels" . | nindent 4 }}
|
||||||
|
data:
|
||||||
|
entrypoint.sh: |
|
||||||
|
{{- .Values.entrypoint | nindent 4 }}
|
88
services/hooker/templates/deployment.yaml
Normal file
88
services/hooker/templates/deployment.yaml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "hooker.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "hooker.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.selectorLabels" . | nindent 8 }}
|
||||||
|
annotations:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
hooker/properties-hash: {{ include "hooker.propertiesHash" . }}
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: {{ .Values.imagePullSecrets.name }}
|
||||||
|
serviceAccountName: {{ include "hooker.serviceAccountName" . }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8022
|
||||||
|
protocol: TCP
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: http
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: http
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /opt/hooker/entrypoint.sh
|
||||||
|
subPath: entrypoint.sh
|
||||||
|
readOnly: true
|
||||||
|
command: ["/opt/hooker/entrypoint.sh"]
|
||||||
|
args:
|
||||||
|
- -jar
|
||||||
|
- /opt/hooker/hooker.jar
|
||||||
|
- --spring.datasource.hikari.data-source-properties.prepareThreshold=0
|
||||||
|
- --spring.datasource.hikari.leak-detection-threshold=5300
|
||||||
|
- --spring.datasource.hikari.max-lifetime=300000
|
||||||
|
- --spring.datasource.hikari.idle-timeout=30000
|
||||||
|
- --spring.datasource.hikari.minimum-idle=2
|
||||||
|
- --spring.datasource.hikari.maximum-pool-size={{ .Values.datasource.poolsize }}
|
||||||
|
- --kafka.bootstrap-servers={{ .Values.kafka.bootstrapServers }}
|
||||||
|
- --kafka.topics.invoice.enabled=true
|
||||||
|
- --kafka.topics.customer.enabled=true
|
||||||
|
- --kafka.topics.invoice.concurrency={{ .Values.kafka.topicInvoiceConcurrency }}
|
||||||
|
- --kafka.topics.customer.concurrency={{ .Values.kafka.topicCustomerConcurrency }}
|
||||||
|
- --kafka.topics.invoice.id={{ .Values.kafka.topicInvoiceName }}
|
||||||
|
- --kafka.topics.customer.id={{ .Values.kafka.topicCustomerName }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: {{ include "hooker.fullname" . }}
|
||||||
|
items:
|
||||||
|
- key: entrypoint.sh
|
||||||
|
path: entrypoint.sh
|
||||||
|
mode: 0755
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
15
services/hooker/templates/service.yaml
Normal file
15
services/hooker/templates/service.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "hooker.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: 8022
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "hooker.selectorLabels" . | nindent 4 }}
|
12
services/hooker/templates/serviceaccount.yaml
Normal file
12
services/hooker/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "hooker.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
15
services/hooker/templates/tests/test-connection.yaml
Normal file
15
services/hooker/templates/tests/test-connection.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "hooker.fullname" . }}-test-connection"
|
||||||
|
labels:
|
||||||
|
{{- include "hooker.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wget
|
||||||
|
image: busybox
|
||||||
|
command: ['wget']
|
||||||
|
args: ['{{ include "hooker.fullname" . }}:{{ .Values.service.port }}']
|
||||||
|
restartPolicy: Never
|
65
services/hooker/values.yaml
Normal file
65
services/hooker/values.yaml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
image:
|
||||||
|
repository: dr2.rbkmoney.com/rbkmoney/hooker
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
replicaCount: 3
|
||||||
|
|
||||||
|
imagePullSecrets:
|
||||||
|
name: dr2reg
|
||||||
|
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: true
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 8022
|
||||||
|
|
||||||
|
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
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
|
|
||||||
|
kafka:
|
||||||
|
bootstrapServers: kafka-headless:9092
|
||||||
|
topicInvoiceConcurrency: 7
|
||||||
|
topicCustomerConcurrency: 2
|
||||||
|
topicInvoiceName: mg-events-invoice
|
||||||
|
topicCustomerName: mg-events-customer
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
poolsize: 20
|
Loading…
Reference in New Issue
Block a user