Skip to content

Commit

Permalink
Merge pull request #20 from yurchenkosv/master
Browse files Browse the repository at this point in the history
Add ingress rules for different hostnames, set namespace using .Release.Namespace
  • Loading branch information
diafour committed Sep 18, 2018
2 parents f88c909 + 4202dce commit 483d580
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 53 deletions.
2 changes: 1 addition & 1 deletion charts/loghouse/templates/basic-auth.yaml
Expand Up @@ -4,5 +4,5 @@ data:
kind: Secret
metadata:
name: basic-auth
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
type: Opaque
Expand Up @@ -84,6 +84,6 @@ data:
</yandex>
metadata:
name: clickhouse-config
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
addonmanager.kubernetes.io/mode: Reconcile
10 changes: 5 additions & 5 deletions charts/loghouse/templates/clickhouse/clickhouse-ingress.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: clickhouse
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
kubernetes.io/ingress.class: "nginx"
{{- if .Values.ingress.enable_https }}
Expand All @@ -16,17 +16,17 @@ metadata:
{{- end }}
spec:
rules:
- host: {{ .Values.ingress.clickhouse_host }}
- host: {{ .Values.ingress.clickhouse.host }}
http:
paths:
- path: /
- path: {{ .Values.ingress.clickhouse.path }}
backend:
serviceName: clickhouse
servicePort: http
{{- if .Values.ingress.enable_https }}
tls:
- hosts:
- {{ .Values.ingress.clickhouse_host }}
secretName: clickhouse
- {{ .Values.ingress.clickhouse.host }}
secretName: {{ .Values.ingress.clickhouse.tls_secret_name}}se
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/loghouse/templates/clickhouse/clickhouse-pvc.yaml
Expand Up @@ -4,7 +4,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.storage.pvc.name }}
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
volume.beta.kubernetes.io/mount-options: "discard"
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/clickhouse/clickhouse-svc.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: clickhouse
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
selector:
component: clickhouse
Expand Down
6 changes: 3 additions & 3 deletions charts/loghouse/templates/clickhouse/clickhouse.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: clickhouse-server
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
revisionHistoryLimit: 1
replicas: 1
Expand Down Expand Up @@ -101,8 +101,8 @@ spec:
effect: {{ .Values.tolerations.effect | quote }}
{{- end }}
{{- end }}
{{- if .Values.nodeSelector }}
{{- if .Values.clickhouse.node_selector }}
nodeSelector:
{{ .Values.nodeSelector.key }}: {{ .Values.nodeSelector.value }}
{{ .Values.clickhouse.node_selector.key }}: {{ .Values.clickhouse.node_selector.value }}
{{- end }}

7 changes: 6 additions & 1 deletion charts/loghouse/templates/fluentd/fluentd-configmap.yaml
Expand Up @@ -134,6 +134,11 @@ data:
</record>
remove_keys _TRANSPORT, PRIORITY, SYSLOG_FACILITY, _UID, _GID, _CAP_EFFECTIVE, _SYSTEMD_SLICE, _BOOT_ID, _MACHINE_ID, _HOSTNAME, SYSLOG_IDENTIFIER, _PID, _COMM, _EXE, _CMDLINE, _SYSTEMD_CGROUP, _SYSTEMD_UNIT, MESSAGE
</filter>
<filter **>
@type record_modifier
whitelist_keys timestamp, nsec, source, namespace, host, pod_name, container_name, stream, labels.names, labels.values, string_fields.names, string_fields.values, number_fields.names, number_fields.values, boolean_fields.names, boolean_fields.values, null_fields.names
</filter>
<match **>
@type exec
Expand All @@ -149,7 +154,7 @@ data:

metadata:
name: fluentd-config
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
addonmanager.kubernetes.io/mode: Reconcile

8 changes: 4 additions & 4 deletions charts/loghouse/templates/fluentd/fluentd-roles.yaml
Expand Up @@ -3,14 +3,14 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
k8s-app: fluentd
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fluentd
labels:
Expand All @@ -29,7 +29,7 @@ rules:
- "list"
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fluentd
labels:
Expand All @@ -39,7 +39,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: fluentd
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
apiGroup: ""
roleRef:
kind: ClusterRole
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/fluentd/fluentd.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fluentd
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
k8s-app: fluentd
kubernetes.io/cluster-service: "true"
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse-configmap.yaml
Expand Up @@ -3,7 +3,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: loghouse-user-config
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
addonmanager.kubernetes.io/mode: Reconcile
data:
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse-cronjob.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: {{ template "CronJob.apiVersion" $ }}
kind: CronJob
metadata:
name: {{ .Chart.Name }}-tables
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
schedule: "59 23 * * *"
concurrencyPolicy: Forbid
Expand Down
10 changes: 5 additions & 5 deletions charts/loghouse/templates/loghouse/loghouse-ingress.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: loghouse
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
{{- if .Values.ingress.annotations }}
{{- range .Values.ingress.annotations }}
Expand All @@ -22,17 +22,17 @@ metadata:
{{- end }}
spec:
rules:
- host: {{ .Values.ingress.loghouse_host }}
- host: {{ .Values.ingress.loghouse.host }}
http:
paths:
- path: /
- path: {{ .Values.ingress.loghouse.path }}
backend:
serviceName: loghouse
servicePort: http
{{- if .Values.ingress.enable_https }}
tls:
- hosts:
- {{ .Values.ingress.loghouse_host }}
secretName: loghouse
- {{ .Values.ingress.loghouse.host }}
secretName: {{ .Values.ingress.loghouse.tls_secret_name}}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse-init-db.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Chart.Name }}-init-db
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install
"helm.sh/weight": "-5"
Expand Down
Expand Up @@ -2,7 +2,7 @@ apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Chart.Name }}-init-tables
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/weight": "5"
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse-nginx.yaml
Expand Up @@ -3,7 +3,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: loghouse-nginx-conf
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
labels:
addonmanager.kubernetes.io/mode: Reconcile
data:
Expand Down
8 changes: 4 additions & 4 deletions charts/loghouse/templates/loghouse/loghouse-rbac.yaml
Expand Up @@ -2,9 +2,9 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: loghouse
namespace: {{ .Values.namespace | quote }}
namespace: {{ .Release.Namespace | quote }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: loghouse
Expand All @@ -17,7 +17,7 @@ rules:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: loghouse
Expand All @@ -28,4 +28,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: loghouse
namespace: {{ .Values.namespace | quote }}
namespace: {{ .Release.Namespace | quote }}
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse-svc.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: loghouse
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
selector:
component: loghouse
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/loghouse/loghouse.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: loghouse
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
revisionHistoryLimit: 1
replicas: 1
Expand Down
5 changes: 0 additions & 5 deletions charts/loghouse/templates/namespace.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions charts/loghouse/templates/tabix/tabix-ingress.yaml
Expand Up @@ -3,7 +3,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tabix
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/auth-type: basic
Expand All @@ -19,17 +19,17 @@ metadata:
{{- end }}
spec:
rules:
- host: {{ .Values.ingress.tabix_host }}
- host: {{ .Values.ingress.tabix.host }}
http:
paths:
- path: /
- path: {{ .Values.ingress.tabix.path }}
backend:
serviceName: tabix
servicePort: http
{{- if .Values.ingress.enable_https }}
tls:
- hosts:
- {{ .Values.ingress.tabix_host }}
secretName: tabix
- {{ .Values.ingress.tabix.host }}
secretName: {{ .Values.tabix.tls_secret_name }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/loghouse/templates/tabix/tabix-svc.yaml
Expand Up @@ -4,7 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: tabix
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
selector:
component: tabix
Expand Down
2 changes: 1 addition & 1 deletion charts/loghouse/templates/tabix/tabix.yaml
Expand Up @@ -4,7 +4,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: tabix
namespace: {{ .Values.namespace }}
namespace: {{ .Release.Namespace }}
spec:
revisionHistoryLimit: 1
replicas: 1
Expand Down
23 changes: 16 additions & 7 deletions charts/loghouse/values.yaml
@@ -1,6 +1,3 @@
# Namespace in Kubernetes for setup loghouse
namespace: loghouse

# Basic-auth string. Generated by command:
# echo "PASSWORD" | htpasswd -ni USERNAME | base64 -w0
# Example:
Expand All @@ -14,10 +11,19 @@ clickhouse_pass_original: password
# Settings for ingress
ingress:
enable: true
enable_https: false
clickhouse_host: clickhouse.domain.com
loghouse_host: loghouse.domain.com
tabix_host: tabix.domain.com
enable_https: true
clickhouse:
host: clickhouse.domain.com
path: "/"
tls_secret_name: clickhouse
loghouse:
host: loghouse.domain.com
path: "/"
tls_secret_name: loghouse
tabix:
host: tabix.domain.com
path: "/"
tls_secret_name: loghouse
# annotations:
# - 'kubernetes.io/ingress.class: traefik'
# - 'traefik.frontend.passHostHeader: "true"'
Expand Down Expand Up @@ -61,6 +67,9 @@ install_master: false
imagePullPolicy: Always

clickhouse:
node_selector:
key: 'node-role/logging'
value: 'clickhouse'
server: clickhouse
port: 9000
user: default
Expand Down

0 comments on commit 483d580

Please sign in to comment.