Skip to content

Commit

Permalink
shortlink-common: add ingress template
Browse files Browse the repository at this point in the history
Signed-off-by: Login Victor <batazor@evrone.com>
  • Loading branch information
batazor committed Sep 4, 2022
1 parent 036cecf commit db5335c
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: sync-kafka-to-elasticsearch
annotations:
"helm.sh/hook": post-install
spec:
generators:
- list:
Expand Down
2 changes: 0 additions & 2 deletions ops/Helm/addons/argocd/templates/shortlink/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ kind: AppProject
metadata:
name: shortlink
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install
# Finalizer that ensures that project is not deleted until it is not referenced by any application
finalizers:
- resources-finalizer.argocd.argoproj.io
Expand Down
3 changes: 1 addition & 2 deletions ops/Helm/addons/cert-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

email: mymail@gmail.com

annotations:
"helm.sh/hook": post-install
annotations: {}

cert-manager:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install
spec:
selector:
istio: ingress # use Istio default gateway implementation
Expand Down
8 changes: 3 additions & 5 deletions ops/Helm/addons/gateway/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ ingress-nginx:
defaultBackend:
enabled: true

# If true, create & use Pod Security Policy resources
# https://kubernetes.io/docs/concepts/policy/pod-security-policy/
podSecurityPolicy:
enabled: false

# nginx configuration
# Ref: https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md
controller:
Expand All @@ -30,6 +25,9 @@ ingress-nginx:
# is merged
hostNetwork: false

ingressClassResource:
default: true

# DaemonSet or Deployment
##
kind: Deployment
Expand Down
2 changes: 0 additions & 2 deletions ops/Helm/addons/mq/kafka/templates/kafka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: {{ include "helpers.fullname" . }}
annotations:
"helm.sh/hook": post-install
spec:
kafka:
version: 3.2.0
Expand Down
7 changes: 5 additions & 2 deletions ops/Helm/addons/mq/rabbitmq/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
dependencies:
- name: shortlink-common
repository: file://../../../shortlink-common
version: 0.2.0
- name: rabbitmq-cluster-operator
repository: https://charts.bitnami.com/bitnami
version: 2.7.1
digest: sha256:fe75efdbda31fb37789ebea366d61c7c247192c3e4c7ec3da1b680ed706d45cd
generated: "2022-09-01T20:28:15.189405148+03:00"
digest: sha256:da675b9a3dcd788a9acdd91bb14c640dbe40cffcc9d525f3b1981f4bec4615d6
generated: "2022-09-04T21:31:45.371511794+03:00"
3 changes: 3 additions & 0 deletions ops/Helm/addons/mq/rabbitmq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ engine: gotpl
type: application # It is the type of chart (optional)
deprecated: false # Whether this chart is deprecated (optional, boolean)
dependencies:
- name: shortlink-common
version: 0.2.0
repository: "file://../../../shortlink-common"
- name: rabbitmq-cluster-operator
version: 2.7.1
repository: https://charts.bitnami.com/bitnami
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions ops/Helm/addons/mq/rabbitmq/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{/* vim: set filetype=mustache: */}}

{{ template "shortlink-common.Ingress" . }}
2 changes: 0 additions & 2 deletions ops/Helm/addons/mq/rabbitmq/templates/rabbitmq-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: {{ .Values.rabbitmq.clusterName }}
annotations:
"helm.sh/hook": post-install
spec:
replicas: 1
terminationGracePeriodSeconds: 60
Expand Down
79 changes: 17 additions & 62 deletions ops/Helm/addons/mq/rabbitmq/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,65 +24,20 @@ rabbitmq-cluster-operator:
serviceMonitor:
enabled: true

#
# auth:
# username: admin
# password: admin
# erlangCookie: randomCookie
#
# podSecurityContext:
# enabled: true
#
# persistence:
# enabled: false
#
# extraVolumeMounts:
# - name: tmp
# mountPath: /tmp
# readOnly: false
# - name: opt
# mountPath: /opt/bitnami/rabbitmq
# readOnly: false
#
# extraVolumes:
# - name: tmp
# emptyDir: {}
# - name: opt
# emptyDir: {}
#
# initContainers:
# - name: data-copy
# image: bitnami/rabbitmq
# imagePullPolicy: IfNotPresent
# volumeMounts:
# - name: opt
# mountPath: "/mnt/opt/bitnami/rabbitmq"
# command:
# - /bin/bash
# args:
# - -ec
# - cp -r -v "/opt/bitnami/rabbitmq/." "/mnt/opt/bitnami/rabbitmq"
#
# ingress:
# enabled: true
# annotations:
# kubernetes.io/ingress.class: nginx
# cert-manager.io/cluster-issuer: cert-manager-production
# nginx.ingress.kubernetes.io/enable-modsecurity: "true"
# nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"
# nginx.ingress.kubernetes.io/enable-opentracing: "true"
# nginx.ingress.kubernetes.io/rewrite-target: /$1
# nginx.ingress.kubernetes.io/use-regex: "true"
#
# hostname: architecture.ddns.net
# path: /rabbitmq/?(.*)
#
# # For Kubernetes >= 1.18 you should specify the pathType (determines how Ingress paths should be matched)
# # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#better-path-matching-with-path-types
# pathType: Prefix
#
# tls: true
# certManager: true
#
#
#
ingress:
enabled: true
type: nginx
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: cert-manager-production
nginx.ingress.kubernetes.io/enable-modsecurity: "true"
nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"
nginx.ingress.kubernetes.io/enable-opentracing: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: "true"

hostname: architecture.ddns.net
path: /rabbitmq/?(.*)
service:
name: shortlink
port: 15672
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ metadata:
name: config-alertmanager
labels:
alertmanagerConfig: shortlink
annotations:
"helm.sh/hook": post-install
spec:
route:
groupBy: ['job']
Expand Down
2 changes: 0 additions & 2 deletions ops/Helm/addons/rook-ceph/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
name: rook-ceph
annotations:
"helm.sh/hook": post-install
spec:
cephVersion:
# The container image used to launch the Ceph daemon pods (mon, mgr, osd, mds, rgw).
Expand Down
4 changes: 0 additions & 4 deletions ops/Helm/addons/rook-ceph/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
name: replicapool
annotations:
"helm.sh/hook": post-install
spec:
failureDomain: host
replicated:
Expand All @@ -14,8 +12,6 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-ceph-block
annotations:
"helm.sh/hook": post-install
# Change "rook-ceph" provisioner prefix to match the operator namespace if needed
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
Expand Down
2 changes: 1 addition & 1 deletion ops/Helm/shortlink-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2 # The chart API version (requir
appVersion: "1.0.0" # The version of the app that this contains (optional)
name: shortlink-common # The name of the chart (required)
description: Shortlink common templates # A single-sentence description of this project (optional)
version: 0.1.0 # A SemVer 2 version (required)
version: 0.2.0 # A SemVer 2 version (required)
kubeVersion: ">= 1.22.0 || >= v1.22.0-0" # A SemVer range of compatible Kubernetes versions (optional)
keywords:
- shortlink
Expand Down
7 changes: 7 additions & 0 deletions ops/Helm/shortlink-common/templates/_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{/* vim: set filetype=mustache: */}}

{{- define "shortlink-common.Ingress" }}
{{- if and .Values.ingress.enabled (eq .Values.ingress.type "nginx") -}}
{{ template "shortlink-common.nginxIngress" . }}
{{- end }}
{{- end }}
37 changes: 37 additions & 0 deletions ops/Helm/shortlink-common/templates/_ingress_nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{/* vim: set filetype=mustache: */}}

{{- define "shortlink-common.nginxIngress" }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "helpers.fullname" . }}
labels:
{{- include "helpers.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: nginx
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.ingress.hostname }}
http:
paths:
- path: {{ .Values.ingress.path }}
pathType: {{ default "Prefix" .Values.ingress.pathType }}
backend:
service:
name: {{ .Values.ingress.service.name }}
port:
number: {{ .Values.ingress.service.port }}
{{- end }}

0 comments on commit db5335c

Please sign in to comment.