Create an 'LMA-Infra' Composite

This composite deploys the logging and prometheus operators
such that they are ready to collect logs and metrics from a k8s cluster.
The operators can be extended by introducing custom resources, allowing
any application running in the cluster to use these services

Note: Due to [0], this composite cannot be successfully deployed in the
initinfra-target phase, so a separate 'lma-infra' phase is introduced

[0] https://github.com/airshipit/airshipctl/issues/474

Change-Id: Ia20cc7bdaeb2b2f52ba4bcdc8e55a202ef4b0110
This commit is contained in:
Steven Fitzpatrick 2021-03-02 18:07:29 +00:00
parent 1144e50bae
commit 772b18afd9
14 changed files with 162 additions and 2 deletions

View File

@ -0,0 +1,5 @@
# LMA Infra
This composite deploys the logging-operator and kube-prometheus-stack,
configured to provide basic LMA facilities to a cluster. Application Logs and
metrics can be collected by supplying the operators CRs.

View File

@ -0,0 +1,11 @@
resources:
- namespace.yaml
- ../../function/logging-operator
- ../../function/kube-prometheus-stack
namespace: lma-infra
patches:
- path: patches/kube-prometheus-stack.yaml
- path: patches/logging-operator.yaml
- path: patches/logging-spec.yaml

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: lma-infra

View File

@ -0,0 +1,42 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: kube-prometheus-stack
spec:
releaseName: lma-infra-monitoring
values:
fullnameOverride: lma-infra-monitoring
grafana:
enabled: false
prometheus:
prometheusSpec:
serviceMonitorSelectorNilUsesHelmValues: false
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
prometheusOperator:
admissionWebhooks:
patch:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
alertmanager:
alertmanagerSpec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
prometheus-node-exporter:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
kube-state-metrics:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

View File

@ -0,0 +1,15 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: logging-operator
spec:
dependsOn:
- name: kube-prometheus-stack
values:
fullnameOverride: lma-infra-logging-operator
monitoring:
serviceMonitor:
enabled: true
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

View File

@ -0,0 +1,47 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: logging-operator-logging
spec:
releaseName: lma-infra-logging
dependsOn:
- name: logging-operator
# Reference values at
# https://github.com/banzaicloud/logging-operator/blob/master/charts/logging-operator-logging/values.yaml
values:
controlNamespace: lma-infra
loggingRef: lma-infra-logging
nameOverride: lma-infra-logging
fullnameOverride: lma-infra-logging
fluentbit:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
metrics:
serviceMonitor: true
fluentd:
fluentLogDestination: stdout
disablePvc: true
metrics:
serviceMonitor: true
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
clusterFlows:
- name: all-pods
spec:
globalOutputRefs:
- elasticsearch
clusterOutputs:
- name: elasticsearch
spec:
elasticsearch:
host: elasticsearch-elasticsearch-cluster.default.svc.cluster.local
port: 9200
scheme: https
ssl_verify: false
ssl_version: TLSv1_2
buffer:
timekey: 1m
timekey_wait: 30s
timekey_use_utc: true

View File

@ -0,0 +1,19 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: logging-operator-logging
spec:
releaseName: logging-operator-logging
interval: 5m
chart:
spec:
chart: logging-operator-logging
sourceRef:
kind: HelmRepository
name: banzaicloud
version: 3.8.3
interval: 1m
timeout: 5m
# Reference values at
# https://github.com/banzaicloud/logging-operator/blob/master/charts/logging-operator-logging/values.yaml
values: {}

View File

@ -2,7 +2,6 @@ apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: logging-operator
namespace: logging
spec:
releaseName: logging-operator
interval: 5m

View File

@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- helmrepository.yaml
- helmrelease.yaml
- helmrelease-operator.yaml
- helmrelease-logging.yaml
namespace: logging

View File

@ -0,0 +1,2 @@
resources:
- ../../../../composite/lma-infra

View File

@ -1,2 +1,3 @@
resources:
- ../../../../../airshipctl/manifests/phases/
- lma-infra-target.yaml

View File

@ -0,0 +1,11 @@
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: lma-infra-target
clusterName: target-cluster
config:
executorRef:
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
name: kubernetes-apply
documentEntryPoint: target/lma-infra

View File

@ -3,5 +3,6 @@ resources:
- ../../../../../../airshipctl/manifests/function/hwcc
- ../../../../function/clusterctl
- ../../../../../../airshipctl/manifests/composite/flux-helm/
commonLabels:
airshipit.org/stage: initinfra

View File

@ -28,3 +28,5 @@ kubectl \
label node $NODENAME node-type=controlplane
./tools/deployment/31_deploy_initinfra_target_node.sh
airshipctl phase run lma-infra-target --debug