Merge pull request 'openbao_logs_second_way' (#16) from openbao_logs_second_way into shipping_openbao_logs

Reviewed-on: #16
This commit is contained in:
Michal.Wrobel 2025-03-18 09:17:40 +00:00
commit 779df9fb9c
3 changed files with 89 additions and 1 deletions

View file

@ -0,0 +1,29 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: openbao-alloy-configmap
namespace: argocd
labels:
env: dev
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD
path: "stacks/ref-implementation/openbao-alloy-configmap"
destination:
server: "https://kubernetes.default.svc"
namespace: openbao
syncPolicy:
syncOptions:
- CreateNamespace=true
automated:
selfHeal: true
retry:
limit: -1
backoff:
duration: 15s
factor: 1
maxDuration: 15s

View file

@ -0,0 +1,32 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sidecar-container-alloy-config
data:
config.yaml: |
logging {
level = "info"
format = "logfmt"
}
loki.write "local_loki" {
endpoint {
url = "http://loki-loki-distributed-gateway/loki/api/v1/push"
}
}
discovery.kubernetes "pod" {
role = "pod"
}
discovery.relabel "openbao_pod_logs" {
targets = discovery.kubernetes.pod.targets
rule {
source_labels = ["__meta_kubernetes_pod_name"]
action = "keep"
regex = "openbao-0"
}
forward_to = [loki.write.local_loki.receiver]
}

View file

@ -1,4 +1,31 @@
server:
extraContainers:
- name: grafana-alloy
image: grafana/alloy:latest
ports:
- containerPort: 12345
# volumeMounts:
# - name: sidecar-container-alloy-config
# mountPath: /etc/alloy/config.yaml
# subPath: config.yaml
# args:
# - --config.file=/etc/alloy/config.yaml
volumeMounts:
- name: alloy-data
mountPath: /var/lib/alloy/data
securityContext:
runAsUser: 1000
fsGroup: 1000
volumes:
- name: alloy-data
emptyDir: {}
# volumes:
# - name: sidecar-container-alloy-config
# configMap:
# name: sidecar-container-alloy-config
postStart:
- sh
- -c
@ -16,4 +43,4 @@ server:
bao audit enable file file_path=stdout
rm /tmp/init.txt
ui:
enabled: true
enabled: true