Compare commits

..

131 commits

Author SHA1 Message Date
509a07b39d configuration added 2025-03-26 14:58:55 +01:00
1f429f079b loki.source.syslog "tcp_socket" {
listener {
          address = "0.0.0.0:1514"
          labels   = { component = "loki.source.syslog", protocol = "tcp" }
        }
        forward_to = [loki.write.local_loki.receiver]
      }
2025-03-26 13:55:46 +01:00
574fe29565 labels = { component = "loki.source.syslog", protocol = "tcp" } 2025-03-26 13:46:08 +01:00
992749c6fc loki.source.kubernetes "all_pod_logs" {
targets    = discovery.relabel.pod_logs.output
        forward_to = [loki.write.local_loki.receiver]
      }
2025-03-26 13:16:02 +01:00
2fda5818ec create: false
name: alloy-config
  key: config.alloy
2025-03-26 13:03:23 +01:00
a1925e083b - name: "tcpsocket" 2025-03-26 12:56:03 +01:00
21ce529abe create: false
name: alloy-config
    key: config.alloy
2025-03-26 12:50:13 +01:00
ecf2ed5787 extraPorts:
- name: "tcp_socket"
      port: 1514
      targetPort: 1514
      protocol: "TCP"
      appProtocol: "tcp"
2025-03-26 12:43:02 +01:00
e8c6aeb3c2 address = "0.0.0.0:1514" 2025-03-26 12:38:39 +01:00
bfc8972580 forward_to = [loki.write.local_loki.receiver] 2025-03-26 12:34:48 +01:00
d64ecf325b address = "0.0.0.0:12345" 2025-03-26 12:30:30 +01:00
c16ad82150 # extraPorts:
#   - name: "tcp_socket"
  #     port: 1514
  #     targetPort: 1514
  #     protocol: "TCP"
  #     appProtocol: "tcp"
2025-03-26 12:28:37 +01:00
e901ac85fc extraPorts:
- name: "tcp_socket"
      port: 1514
      targetPort: 1514
      protocol: "TCP"
      appProtocol: "tcp"
2025-03-26 11:53:11 +01:00
08a4037929 extraPorts:
- name: "tcp_socket"
    port: 1514
    targetPort: 1514
    protocol: "TCP"
    appProtocol: "tcp"
2025-03-26 11:46:02 +01:00
2a8bdd0f6d loki.source.syslog "tcp_socket" {
listener {
          address = "0.0.0.0:1514"
        }
        forward_to = [loki.write.local_loki.receiver]
      }
2025-03-26 11:01:33 +01:00
5c9b4c679d sleep 60 2025-03-25 15:16:07 +01:00
d941d12bcd mkdir pupa 2025-03-25 15:02:50 +01:00
c34d538073 /var/log/openbao/openbao/*.log { 2025-03-25 14:08:02 +01:00
42be001b3c bao audit enable -path="file" file file_path=/openbao/logs/openbao/openbao.log 2025-03-25 13:59:25 +01:00
278cf798f4 apiVersion: v1
kind: ConfigMap
metadata:
  name: openbao-logrotate-config
  namespace: openbao
data:
  openbao: |
    /var/log/openbao/*.log {
    size 5k
    rotate 7
    compress
    missingok
    notifempty
    postrotate
        kill -SIGHUP $(pidof bao)
    endscript
    }
2025-03-25 13:52:55 +01:00
5c197fd0f1 sidecar container detached 2025-03-25 13:26:28 +01:00
bb3c6cf438 /openbao/logs/openbao/openbao.log 2025-03-25 13:19:15 +01:00
2372cefe0b # bao audit enable -path="file" file file_path=/openbao/logs/openbao.log 2025-03-25 13:13:39 +01:00
be7881e2ec test 2025-03-25 13:03:29 +01:00
c6e71f8aeb logging setup 2025-03-25 12:51:00 +01:00
547938acd4 - name: host-log
hostPath:
        path: /var/log
        type: Directory
2025-03-25 11:18:52 +01:00
320e67a1d2 no liveness probe 2025-03-24 14:50:16 +01:00
71a5463237 rm /tmp/init.txt
bao audit enable -path="stdout" file file_path=stdout
      bao audit enable -path="file" file file_path=/openbao/logs/openbao.log
2025-03-24 14:20:54 +01:00
4620a92aee # rm /tmp/init.txt 2025-03-24 13:57:39 +01:00
5086db7cba 100 2025-03-24 13:50:33 +01:00
2c5cad03c8 sleep 10 2025-03-24 13:50:07 +01:00
aae508014a cat /tmp/init.txt | grep "Key " | awk '{print $NF}' | xargs -I{} bao operator unseal {}
echo $(grep "Initial Root Token:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/initial_token.txt
      echo $(grep "Unseal Key 1:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key1.txt
      echo $(grep "Unseal Key 2:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key2.txt
      echo $(grep "Unseal Key 3:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key3.txt
      echo $(grep "Unseal Key 4:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key4.txt
      echo $(grep "Unseal Key 5:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key5.txt
      bao login $(grep "Initial Root Token:" /tmp/init.txt | awk '{print $NF}')
      rm /tmp/init.txt
2025-03-24 13:41:47 +01:00
8d7a7cb1bf bao operator init >> /tmp/init.txt 2025-03-24 13:38:15 +01:00
8f28c30364 ### 2025-03-24 13:33:13 +01:00
dcce720122 # bao audit enable -path="stdout" file file_path=stdout
# bao audit enable -path="file" file file_path=/openbao/logs/openbao.log
2025-03-24 13:32:40 +01:00
f39c8c979b livenessProbe:
enabled: true
    execCommand:
      - /bin/sh
      - -c
      - bao status
2025-03-24 13:12:46 +01:00
d41a27305e livenessProbe:
enabled: true
2025-03-24 12:54:27 +01:00
4601d2f25d those command were deleted 2025-03-20 16:18:43 +01:00
5f5ac62b0b touch /shared/main.alive; trap 'rm -f /shared/main.alive; exit 0' TERM; while true; do sleep 1; done 2025-03-20 16:14:03 +01:00
3937c98d00 /openbao/logs/alive/main.alive 2025-03-20 16:03:21 +01:00
d21c543f2c log-sidecar removed 2025-03-20 15:50:04 +01:00
64677a02d1 url = "http://loki-loki-distributed-gateway.monitoring.svc.cluster.local/loki/api/v1/push" 2025-03-20 15:14:01 +01:00
350398cb23 path_targets = [{"__path__" = "/openbao/logs/*"}] 2025-03-20 14:44:48 +01:00
02c739524b config.alloy 2025-03-20 14:39:03 +01:00
3db4058181 - key: "config.yaml"
path: "/config.alloy"
                - key: "config.yaml"
                  path: "/pupa/config.alloy"
2025-03-20 14:34:51 +01:00
d866169744 - name: config-volume
mountPath: /etc/alloy
              items:
                - key: "config.yaml"
                  path: "config.alloy"
2025-03-20 14:28:27 +01:00
267a04fee5 mountPath: /etc/alloy
items:
                - key: "config.yaml"
                  path: "config.alloy"
2025-03-20 14:23:57 +01:00
c376f6d0c6 - --config.file=/var/lib/alloy/config/config.yaml 2025-03-20 14:09:45 +01:00
39eab1ef93 - name: config-volume
configMap:
        name: sidecar-container-alloy-config
2025-03-20 14:00:59 +01:00
ec2fc47ea2 mountPath: /var/lib/alloy 2025-03-20 13:52:04 +01:00
2058f6a36b mountPath: /var/lib 2025-03-20 13:48:12 +01:00
87522c11db /var 2025-03-20 13:39:35 +01:00
88df4ea8f4 runAsUser: 100 2025-03-20 13:30:37 +01:00
6385e39067 /openbao/logs/pupa2 2025-03-20 13:12:50 +01:00
005f7503ce mountPath: /var/lib/alloy/data 2025-03-20 13:05:44 +01:00
140dddd955 mountPath: /var/lib/alloy/data 2025-03-20 12:58:23 +01:00
285e823936 path_targets = [{"__path__" = "/var/log/*"}] 2025-03-20 12:55:00 +01:00
c9c67a9d54 name changes 2025-03-20 12:36:57 +01:00
0dbf646477 alloy is back 2025-03-20 12:36:18 +01:00
5843e9498b targets = local.file_match.openbao_file_logs.targets 2025-03-20 11:33:08 +01:00
3e1b284e3b local.file_match "openbao_file_logs" {
path_targets = [{"__path__" = "/openbao/logs/*"}]
        sync_period = "5s"
      }

      loki.source.file "openbao_logs" {
        targets    = local.file_match.openbao_file_logs.output
        forward_to = [loki.write.local_loki.receiver]
      }
2025-03-20 11:26:21 +01:00
a5ec02205a bao audit enable -path="stdout" file file_path=stdout
bao audit enable -path="file" file file_path=/openbao/logs/openbao.log
2025-03-20 11:03:57 +01:00
974e0182cc # touch /openbao/logs/openbao.log
# bao audit enable file file_path=/openbao/logs/openbao.log
2025-03-20 10:45:12 +01:00
d51e0859a9 touch /openbao/logs/openbao.log 2025-03-19 16:34:32 +01:00
1bf5b468bc bao audit enable file file_path=/openbao/logs/openbao.log 2025-03-19 16:25:16 +01:00
e7d693465d mountPath: /openbao/logs 2025-03-19 15:02:47 +01:00
12d35ad1e9 touch /var/log/openbao.log
chmod 644 /var/log/openbao.log
      chown openbao:openbao /var/log/openbao.log
      bao audit enable file file_path=/var/log/openbao.log removed
2025-03-19 14:48:25 +01:00
5ffb47d1ca volumeMounts:
- mountPath: /var/log/test
      name: log-storage
      readOnly: false
2025-03-19 14:44:29 +01:00
e72e440e51 volumeMounts:
- mountPath: /var/log/test
      name: plugins
      readOnly: false
2025-03-19 14:40:57 +01:00
ff72720654 volumes:
- name: log-storage
      emptyDir: {}
2025-03-19 14:35:18 +01:00
ac4d10d619 # volumeMounts:
#   - mountPath: /
  #     name: plugins
  #     readOnly: false
2025-03-19 14:30:00 +01:00
d946b419e7 volumeMounts:
- mountPath: /
      name: plugins
      readOnly: false
2025-03-19 14:27:04 +01:00
da3624d82a volumeMounts:
- mountPath: /var/log/test
      name: plugins
      readOnly: false
2025-03-19 14:20:57 +01:00
cba0a236f5 volumes:
- name: log-storage
      path: /var/log/test
2025-03-19 14:14:07 +01:00
0971384fd2 emptyDir: {}
volumeMounts:
        - name: log-storage
          mountPath: /var/log/test
2025-03-19 14:06:21 +01:00
4d93d50874 volumes:
- name: log-storage
      path: /var/log/test
2025-03-19 13:58:20 +01:00
8f7ccf5fa7 mountPath: /var/log/test 2025-03-19 13:53:13 +01:00
1938cc8f44 - name: init-log-permissions
image: busybox
      command: ["sh", "-c", "chown -R 1000:1000 /var/log && chmod -R 775 /var/log"]
      volumeMounts:
        - mountPath: /var/log
          name: log-storage
2025-03-19 13:24:40 +01:00
80ca890f5f - name: init-log-permissions
image: busybox
      command: ["sh", "-c", "chown -R 1000:1000 /var/log && chmod -R 775 /var/log"]
      securityContext:
        runAsUser: 0
      volumeMounts:
        - mountPath: /var/log
          name: log-storage
2025-03-19 13:20:34 +01:00
18d03cee74 runAsUser: 1 2025-03-19 11:47:50 +01:00
7efc8124b0 runAsUser: 0 2025-03-19 11:39:53 +01:00
3cd6a846b2 securityContext:
runAsUser: 1001
2025-03-19 11:35:16 +01:00
3d39948468 command: ["/bin/sh", "-c", "
while true; do
            echo 'Hello'
          sleep 5;
          done
        "]
2025-03-19 11:18:38 +01:00
055713e4a5 command: ["/bin/sh", "-c", "
while true; do
            echo 'Hello'
          sleep 5;
          done
        "]
2025-03-19 11:02:44 +01:00
0b5b2b25fd touch /var/log/openbao.log
chmod 644 /var/log/openbao.log
      chown openbao:openbao /var/1og/openbao_audit.log
      bao audit enable file file_path=/var/log/openbao.log
2025-03-19 10:47:00 +01:00
3bb9b4b059 while true; do
echo 'Hello'
          sleep 5;
          done
        "]
2025-03-19 10:33:33 +01:00
fb0eebef13 no exit 2025-03-19 10:26:14 +01:00
1c71f8555d # while kill -0 $(pidof openbao) 2>/dev/null; do sleep 1; done;
# echo 'OpenBao has crashed - giving Alloy time to collect logs...' >> var/log/openbao.log;
          # sleep 20;
          # echo 'Sidecar exiting.';
          # exit 1;
2025-03-19 10:25:44 +01:00
abdbcff9fd while kill -0 $(pidof openbao) 2>/dev/null; do sleep 1; done;
echo 'OpenBao has crashed - giving Alloy time to collect logs...' >> var/log/openbao.log;
          sleep 20;
          echo 'Sidecar exiting.';
          exit 1;
2025-03-19 10:18:19 +01:00
ac3988f9ac touch /var/log/openbao.log
chmod 644 /var/log/openbao.log
      chown openbao:openbao /var/1og/openbao_audit.log
      bao audit enable file file_path=/var/log/openbao.log removed
2025-03-18 14:34:59 +01:00
52f484d463 touch /var/log/openbao.log
chmod 644 /var/log/openbao.log
      chown openbao:openbao /var/1og/openbao_audit.log
      bao audit enable file file_path=/var/log/openbao.log
2025-03-18 14:28:14 +01:00
46d6a22b65 bao audit enable file file_path=/var/log/openbao.log 2025-03-18 14:21:41 +01:00
bc189a53e0 image: alpine:latest 2025-03-18 13:38:40 +01:00
e4611e967e busybox 2025-03-18 13:35:34 +01:00
57779745e9 curlimages/curl:latest 2025-03-18 13:12:09 +01:00
ef22f9e7be ["/bin/sh", "-c", "while kill -0 $(pidof main-container) 2>/dev/null; do sleep 1; done; echo 'OpenBao has crashed - giving Alloy time to collect logs...'; sleep 20"] 2025-03-18 12:59:08 +01:00
8db5e5950d # volumeMounts:
#   - name: alloy-data
      #     mountPath: /var/lib/alloy/data
      # securityContext:
      #   runAsUser: 0
2025-03-18 12:47:09 +01:00
43b172d8d4 user 0 2025-03-18 12:14:27 +01:00
b7de02d293 # extraContainers:
#   - name: grafana-alloy
  #     image: grafana/alloy:latest
  #     ports:
  #       - containerPort: 12345
2025-03-18 12:04:53 +01:00
815f6a2822 # volumeMounts:
#   - name: alloy-data
      #     mountPath: /var/lib/alloy/data
2025-03-18 12:00:36 +01:00
93fe631736 fsGroup: 1000
runAsGroup: 1000
        runAsNonRoot: true
        runAsUser: 100
2025-03-18 11:51:26 +01:00
67876f18b9 runAsUser: 0 2025-03-18 11:39:10 +01:00
779df9fb9c Merge pull request 'openbao_logs_second_way' (#16) from openbao_logs_second_way into shipping_openbao_logs
Reviewed-on: DevFW-CICD/stacks#16
2025-03-18 09:17:40 +00:00
e993c274b0 runAsUser: 1000 # Run as non-root user
fsGroup: 1000
2025-03-17 15:41:18 +01:00
46072b8f81 runAsUser: 0 2025-03-17 15:34:43 +01:00
8617e200ea securityContext:
runAsUser: 1000
        fsGroup: 1000
2025-03-17 15:30:50 +01:00
c30cf9f380 /tmp/alloy/data 2025-03-17 15:26:17 +01:00
872c9dc8e5 volumes:
- name: alloy-data
      emptyDir: {}
2025-03-17 15:13:12 +01:00
27dc5966e9 # args:
#    - --config.file=/etc/alloy/config.yaml
2025-03-17 15:05:10 +01:00
aeca6100f5 /etc/alloy/config.yaml 2025-03-17 14:49:33 +01:00
4e673f674d extraVolumes deprecated 2025-03-17 14:37:58 +01:00
be1c3cee7a test 2025-03-17 14:31:26 +01:00
f0632db48b extraContainers:
- name: grafana-alloy
     image: grafana/alloy:latest
     ports:
       - containerPort: 12345
     volumeMounts:
       - name: sidecar-container-alloy-config
         mountPath: /etc/alloy
         subPath: config.yaml
     args:
       - --config.file=/etc/alloy/config.yaml
2025-03-17 14:23:11 +01:00
7b77d870c6 extraVolumes:
- name: sidecar-container-alloy-config
      configMap:
        name: sidecar-container-alloy-config
2025-03-17 14:17:13 +01:00
deaed1bdcc path: "stacks/ref-implementation/openbao-alloy-configmap" 2025-03-17 14:12:18 +01:00
2890437647 ref-implementation/openbao/sidecar-container-alloy-configmap 2025-03-17 14:07:43 +01:00
f873cd8aef new directory for the configmap 2025-03-17 14:00:05 +01:00
3eec895f67 test 2025-03-17 13:46:53 +01:00
4b553dd258 config map separately 2025-03-17 13:31:43 +01:00
f1d940561d adjustment of openbao.ymal 2025-03-17 13:15:47 +01:00
e2ad485759 sidecar container added 2025-03-17 12:55:46 +01:00
29d4ca9fe6 removing alloy as a separate pod in the same namespace 2025-03-13 15:50:17 +01:00
de8dc94e28 operations/helm/charts/alloy path fixed 2025-03-13 15:16:02 +01:00
48a28127ce testing 2025-03-13 15:14:39 +01:00
83e1215d7d adding a side-car logging container for openbao 2025-03-13 15:09:06 +01:00
28916f2278 Merge branch 'alloy_implementation' into shipping_openbao_logs
# Conflicts:
#	.gitignore
2025-03-13 14:59:45 +01:00
a4502f2ecb provisional solution for the shipping done 2025-03-13 14:01:45 +01:00
3dd9b7a544 rm /tmp/init.txt moved a few lines down 2025-03-13 13:52:29 +01:00
5518e9e2d7 echo deleted 2025-03-13 13:24:44 +01:00
bc90465579 echos for testing 2025-03-13 13:15:19 +01:00
524d0c67e0 bao audit enable file file_path=stdout 2025-03-13 13:03:08 +01:00
35 changed files with 320 additions and 575 deletions

View file

@ -1,29 +0,0 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: forgejo-access-token
namespace: argocd
spec:
secretStoreRef:
name: gitea
kind: ClusterSecretStore
refreshInterval: "0"
target:
name: forgejo-access-token
template:
engineVersion: v2
data:
forgejo_username: "{{.FORGEJO_ACCESS_USERNAME}}"
forgejo_token: "{{.FORGEJO_ACCESS_TOKEN}}"
metadata:
labels:
app.kubernetes.io/part-of: argocd
data:
- secretKey: FORGEJO_ACCESS_USERNAME
remoteRef:
key: forgejo-access-token
property: username
- secretKey: FORGEJO_ACCESS_TOKEN
remoteRef:
key: forgejo-access-token
property: token

View file

@ -1,24 +0,0 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: auth-generic-oauth-secret
namespace: argocd
spec:
secretStoreRef:
name: keycloak
kind: ClusterSecretStore
refreshInterval: "0"
target:
name: auth-generic-oauth-secret
template:
engineVersion: v2
data:
client_secret: "{{.ARGOCD_CLIENT_SECRET}}"
metadata:
labels:
app.kubernetes.io/part-of: argocd
data:
- secretKey: ARGOCD_CLIENT_SECRET
remoteRef:
key: keycloak-clients
property: ARGOCD_CLIENT_SECRET

View file

@ -1,54 +0,0 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: argocd-config
namespace: argocd
spec:
template:
metadata:
generateName: argocd-config-
spec:
restartPolicy: OnFailure
containers:
- name: push
image: docker.io/library/ubuntu:22.04
env:
- name: FORGEJO_USER
valueFrom:
secretKeyRef:
name: forgejo-access-token
key: forgejo_username
- name: FORGEJO_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-access-token
key: forgejo_token
command: ["/bin/bash", "-c"]
args:
- |
#! /bin/bash
apt -qq update
apt -qq install git wget -y
if [[ "$(uname -m)" == "x86_64" ]]; then
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64
install yq_linux_amd64 /usr/local/bin/yq
rm yq_linux_amd64
else
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_arm64
install yq_linux_arm64 /usr/local/bin/yq
rm yq_linux_arm64
fi
git config --global user.email "bot@bots.de"
git config --global user.name "bot"
git clone https://${FORGEJO_USER}:${FORGEJO_TOKEN}@{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder.git
cd edfbuilder
yq eval '.configs.cm."oidc.config" = "name: Keycloak\nissuer: https://{{{ .Env.DOMAIN }}}/keycloak/realms/cnoe\nclientID: argocd\nclientSecret: $auth-generic-oauth-secret:client_secret\nrequestedScopes: [\"openid\", \"profile\", \"email\", \"groups\"]"' -i stacks/core/argocd/values.yaml
git add stacks/core/argocd/values.yaml
git commit -m "adds Forgejo SSO config"
git push
backoffLimit: 99

View file

@ -16,12 +16,12 @@ spec:
name: in-cluster name: in-cluster
namespace: argocd namespace: argocd
sources: sources:
- repoURL: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/argocd-helm.git - repoURL: https://github.com/argoproj/argo-helm
path: charts/argo-cd path: charts/argo-cd
# TODO: RIRE Can be updated when https://github.com/argoproj/argo-cd/issues/20790 is fixed and merged # TODO: RIRE Can be updated when https://github.com/argoproj/argo-cd/issues/20790 is fixed and merged
# As logout make problems, it is suggested to switch from path based routing to an own argocd domain, # As logout make problems, it is suggested to switch from path based routing to an own argocd domain,
# similar to the CNOE amazon reference implementation and in our case, Forgejo # similar to the CNOE amazon reference implementation and in our case, Forgejo
targetRevision: argo-cd-7.8.14-depends targetRevision: argo-cd-7.7.5
helm: helm:
valueFiles: valueFiles:
- $values/stacks/core/argocd/values.yaml - $values/stacks/core/argocd/values.yaml

View file

@ -5,7 +5,6 @@ configs:
params: params:
server.insecure: true server.insecure: true
server.basehref: /argocd server.basehref: /argocd
server.rootpath: /argocd
cm: cm:
application.resourceTrackingMethod: annotation application.resourceTrackingMethod: annotation
timeout.reconciliation: 60s timeout.reconciliation: 60s
@ -21,7 +20,6 @@ configs:
clusters: clusters:
- "*" - "*"
accounts.provider-argocd: apiKey accounts.provider-argocd: apiKey
url: https://{{{ .Env.DOMAIN }}}/argocd
rbac: rbac:
policy.csv: 'g, provider-argocd, role:admin' policy.csv: 'g, provider-argocd, role:admin'

View file

@ -1,25 +1,23 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: mailhog name: crossplane-compositions
namespace: argocd namespace: argocd
labels: labels:
env: dev env: dev
finalizers:
- resources-finalizer.argocd.argoproj.io
spec: spec:
project: default project: default
source:
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD
path: "stacks/ref-implementation/mailhog"
destination:
server: "https://kubernetes.default.svc"
namespace: mailhog
syncPolicy: syncPolicy:
syncOptions:
- CreateNamespace=true
automated: automated:
selfHeal: true selfHeal: true
retry: syncOptions:
limit: -1 - CreateNamespace=true
destination:
name: in-cluster
namespace: crossplane-system
source:
path: stacks/core/crossplane-compositions
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD
directory:
recurse: true

View file

@ -0,0 +1,30 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: edfbuilders.edfbuilder.crossplane.io
spec:
connectionSecretKeys:
- kubeconfig
group: edfbuilder.crossplane.io
names:
kind: EDFBuilder
listKind: EDFBuilderList
plural: edfbuilders
singular: edfbuilders
versions:
- name: v1alpha1
served: true
referenceable: true
schema:
openAPIV3Schema:
description: A EDFBuilder is a composite resource that represents a K8S Cluster with edfbuilder Installed
type: object
properties:
spec:
type: object
properties:
repoURL:
type: string
description: URL to ArgoCD stack of stacks repo
required:
- repoURL

View file

@ -1,29 +1,23 @@
{{{ if eq .Env.CLUSTER_TYPE "kind" }}}
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: forgejo-sso name: crossplane-providers
namespace: argocd namespace: argocd
labels: labels:
env: dev env: dev
finalizers:
- resources-finalizer.argocd.argoproj.io
spec: spec:
project: default project: default
source:
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD
path: "stacks/core/forgejo-sso"
destination:
server: "https://kubernetes.default.svc"
namespace: gitea
syncPolicy: syncPolicy:
syncOptions:
- CreateNamespace=true
automated: automated:
selfHeal: true selfHeal: true
retry: syncOptions:
limit: -1 - CreateNamespace=true
backoff: destination:
duration: 15s name: in-cluster
factor: 1 namespace: crossplane-system
maxDuration: 15s source:
path: stacks/core/crossplane-providers
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD
{{{ end }}}

View file

@ -0,0 +1,9 @@
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata:
name: crossplane-contrib-function-patch-and-transform
spec:
package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.7.0
packagePullPolicy: IfNotPresent # Only download the package if it isnt in the cache.
revisionActivationPolicy: Automatic # Otherwise our Provider never gets activate & healthy
revisionHistoryLimit: 1

View file

@ -0,0 +1,14 @@
apiVersion: argocd.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: argocd-provider
spec:
serverAddr: argocd-server.argocd.svc.cluster.local:80
insecure: true
plainText: true
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: argocd-credentials
key: authToken

View file

@ -0,0 +1,9 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-argocd
spec:
package: xpkg.upbound.io/crossplane-contrib/provider-argocd:v0.9.1
packagePullPolicy: IfNotPresent # Only download the package if it isnt in the cache.
revisionActivationPolicy: Automatic # Otherwise our Provider never gets activate & healthy
revisionHistoryLimit: 1

View file

@ -0,0 +1,14 @@
apiVersion: kind.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: kind-provider
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: kind-credentials
key: credentials
endpoint:
# the url is managed by crossplane-edfbuilder
url: https://DOCKER_HOST:SERVER_PORT/api/v1/kindserver

View file

@ -0,0 +1,9 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-kind
spec:
package: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/provider-kind:v0.1.0
packagePullPolicy: IfNotPresent # Only download the package if it isnt in the cache.
revisionActivationPolicy: Automatic # Otherwise our Provider never gets activate & healthy
revisionHistoryLimit: 1

View file

@ -0,0 +1,9 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-shell
spec:
package: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/provider-shell:v0.1.1
packagePullPolicy: IfNotPresent # Only download the package if it isnt in the cache.
revisionActivationPolicy: Automatic # Otherwise our Provider never gets activate & healthy
revisionHistoryLimit: 1

View file

@ -0,0 +1,23 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: crossplane
namespace: argocd
labels:
env: dev
spec:
project: default
syncPolicy:
automated:
selfHeal: true
syncOptions:
- CreateNamespace=true
destination:
name: in-cluster
namespace: crossplane-system
source:
chart: crossplane
repoURL: https://charts.crossplane.io/stable
targetRevision: 1.18.0
helm:
releaseName: crossplane

View file

@ -28,18 +28,19 @@ spec:
# https://forgejo.org/docs/v1.21/admin/actions/#offline-registration # https://forgejo.org/docs/v1.21/admin/actions/#offline-registration
initContainers: initContainers:
- name: runner-register - name: runner-register
image: code.forgejo.org/forgejo/runner:6.3.1 image: code.forgejo.org/forgejo/runner:6.0.1
command: command:
- "sh" - "forgejo-runner"
- "-c" - "register"
- | - "--no-interactive"
forgejo-runner \ - "--token"
register \ - $(RUNNER_SECRET)
--no-interactive \ - "--name"
--token ${RUNNER_SECRET} \ - $(RUNNER_NAME)
--name ${RUNNER_NAME} \ - "--instance"
--instance ${FORGEJO_INSTANCE_URL} \ - $(FORGEJO_INSTANCE_URL)
--labels docker:docker://node:20-bookworm,ubuntu-22.04:docker://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/catthehackerubuntu:act-22.04,ubuntu-latest:docker://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/catthehackerubuntu:act-22.04 - "--labels"
- "docker:docker://node:20-bookworm,ubuntu-22.04:docker://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/catthehackerubuntu:act-22.04,ubuntu-latest:docker://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/catthehackerubuntu:act-22.04"
env: env:
- name: RUNNER_NAME - name: RUNNER_NAME
valueFrom: valueFrom:
@ -57,7 +58,7 @@ spec:
mountPath: /data mountPath: /data
containers: containers:
- name: runner - name: runner
image: code.forgejo.org/forgejo/runner:6.3.1 image: code.forgejo.org/forgejo/runner:6.0.1
command: command:
- "sh" - "sh"
- "-c" - "-c"
@ -93,7 +94,7 @@ spec:
- name: runner-data - name: runner-data
mountPath: /data mountPath: /data
- name: daemon - name: daemon
image: docker:28.0.4-dind image: docker:27.4.1-dind
env: env:
- name: DOCKER_TLS_CERTDIR - name: DOCKER_TLS_CERTDIR
value: /certs value: /certs

View file

@ -1,26 +0,0 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: forgejo-access-token
namespace: gitea
spec:
secretStoreRef:
name: gitea
kind: ClusterSecretStore
refreshInterval: "0"
target:
name: forgejo-access-token
template:
engineVersion: v2
data:
forgejo_username: "{{.FORGEJO_ACCESS_USERNAME}}"
forgejo_token: "{{.FORGEJO_ACCESS_TOKEN}}"
data:
- secretKey: FORGEJO_ACCESS_USERNAME
remoteRef:
key: forgejo-access-token
property: username
- secretKey: FORGEJO_ACCESS_TOKEN
remoteRef:
key: forgejo-access-token
property: token

View file

@ -1,26 +0,0 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: auth-generic-oauth-secret
namespace: gitea
spec:
secretStoreRef:
name: keycloak
kind: ClusterSecretStore
refreshInterval: "0"
target:
name: auth-generic-oauth-secret
template:
engineVersion: v2
data:
key: "{{.FORGEJO_CLIENT_ID}}"
secret: "{{.FORGEJO_CLIENT_SECRET}}"
data:
- secretKey: FORGEJO_CLIENT_ID
remoteRef:
key: keycloak-clients
property: FORGEJO_CLIENT_ID
- secretKey: FORGEJO_CLIENT_SECRET
remoteRef:
key: keycloak-clients
property: FORGEJO_CLIENT_SECRET

View file

@ -1,76 +0,0 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: forgejo-config
namespace: gitea
spec:
template:
metadata:
generateName: forgejo-config-
spec:
restartPolicy: OnFailure
containers:
- name: push
image: docker.io/library/ubuntu:22.04
env:
- name: FORGEJO_USER
valueFrom:
secretKeyRef:
name: forgejo-access-token
key: forgejo_username
- name: FORGEJO_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-access-token
key: forgejo_token
command: ["/bin/bash", "-c"]
args:
- |
#! /bin/bash
apt -qq update
apt -qq install git wget -y
if [[ "$(uname -m)" == "x86_64" ]]; then
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64
install yq_linux_amd64 /usr/local/bin/yq
rm yq_linux_amd64
else
wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_arm64
install yq_linux_arm64 /usr/local/bin/yq
rm yq_linux_arm64
fi
git config --global user.email "bot@bots.de"
git config --global user.name "giteaAdmin"
git clone https://${FORGEJO_USER}:${FORGEJO_TOKEN}@{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder.git
cd edfbuilder
yq eval ".gitea.oauth = [
{
\"name\": \"Keycloak\",
\"provider\": \"openidConnect\",
\"existingSecret\": \"auth-generic-oauth-secret\",
\"autoDiscoverUrl\": \"https://{{{ .Env.DOMAIN }}}/keycloak/realms/cnoe/.well-known/openid-configuration\"
}
] |
(.gitea.oauth[] | .name) |= (. style=\"single\")
|
(.gitea.oauth[] | .provider) |= (. style=\"single\")
|
(.gitea.oauth[] | .existingSecret) |= (. style=\"single\")
|
(.gitea.oauth[] | .autoDiscoverUrl) |= (. style=\"single\")
" -i stacks/core/forgejo/values.yaml
yq eval '.gitea.config.oauth2_client =
{
"ENABLE_AUTO_REGISTRATION" : true,
"ACCOUNT_LINKING" : "auto"
}
' -i stacks/core/forgejo/values.yaml
git add stacks/core/forgejo/values.yaml
git commit -m "adds Forgejo SSO config"
git push
backoffLimit: 99

View file

@ -16,9 +16,9 @@ spec:
name: in-cluster name: in-cluster
namespace: gitea namespace: gitea
sources: sources:
- repoURL: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/forgejo-helm.git - repoURL: https://code.forgejo.org/forgejo-helm/forgejo-helm.git
path: . path: .
targetRevision: v12.0.0-depends targetRevision: v10.1.1
helm: helm:
valueFiles: valueFiles:
- $values/stacks/core/forgejo/values.yaml - $values/stacks/core/forgejo/values.yaml

View file

@ -1,5 +1,5 @@
redis-cluster: redis-cluster:
enabled: true enabled: false
postgresql: postgresql:
enabled: false enabled: false
postgresql-ha: postgresql-ha:
@ -16,11 +16,6 @@ gitea:
admin: admin:
existingSecret: gitea-credential existingSecret: gitea-credential
config: config:
service:
DISABLE_REGISTRATION: true
other:
SHOW_FOOTER_VERSION: false
SHOW_FOOTER_TEMPLATE_LOAD_TIME: false
database: database:
DB_TYPE: sqlite3 DB_TYPE: sqlite3
session: session:
@ -32,12 +27,6 @@ gitea:
server: server:
DOMAIN: '{{{ .Env.DOMAIN_GITEA }}}' DOMAIN: '{{{ .Env.DOMAIN_GITEA }}}'
ROOT_URL: 'https://{{{ .Env.DOMAIN_GITEA }}}:443' ROOT_URL: 'https://{{{ .Env.DOMAIN_GITEA }}}:443'
mailer:
ENABLED: true
FROM: forgejo@{{{ .Env.DOMAIN_GITEA }}}
PROTOCOL: smtp
SMTP_ADDR: mailhog.mailhog.svc.cluster.local
SMTP_PORT: 1025
service: service:
ssh: ssh:

View file

@ -4,6 +4,8 @@ metadata:
annotations: annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTP nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
{{{ if eq .Env.CLUSTER_TYPE "osc" }}} {{{ if eq .Env.CLUSTER_TYPE "osc" }}}
dns.gardener.cloud/class: garden dns.gardener.cloud/class: garden
dns.gardener.cloud/dnsnames: {{{ .Env.DOMAIN }}} dns.gardener.cloud/dnsnames: {{{ .Env.DOMAIN }}}
@ -22,8 +24,8 @@ spec:
name: argocd-server name: argocd-server
port: port:
number: 80 number: 80
path: /argocd path: /argocd(/|$)(.*)
pathType: Prefix pathType: ImplementationSpecific
tls: tls:
- hosts: - hosts:
- {{{ .Env.DOMAIN }}} - {{{ .Env.DOMAIN }}}

View file

@ -1,18 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mailhog
namespace: mailhog
spec:
ingressClassName: nginx
rules:
- host: {{{ .Env.DOMAIN }}}
http:
paths:
- backend:
service:
name: mailhog
port:
number: 8025
path: /mailhog
pathType: Prefix

View file

@ -16,9 +16,9 @@ spec:
name: in-cluster name: in-cluster
namespace: ingress-nginx namespace: ingress-nginx
sources: sources:
- repoURL: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/ingress-nginx-helm.git - repoURL: https://github.com/kubernetes/ingress-nginx
path: charts/ingress-nginx path: charts/ingress-nginx
targetRevision: helm-chart-4.12.1-depends targetRevision: helm-chart-4.11.3
helm: helm:
valueFiles: valueFiles:
- $values/stacks/core/ingress-nginx/values.yaml - $values/stacks/core/ingress-nginx/values.yaml

View file

@ -1,10 +1,10 @@
alloy: alloy:
uiPathPrefix: "/alloy"
create: false create: false
name: alloy-config name: alloy-config
key: config.alloy key: config.alloy
uiPathPrefix: "/alloy"
configMap: configMap:
content: |- content: |-
@ -72,6 +72,16 @@ alloy:
} }
local.file_match "openbao_file_logs" {
path_targets = [{"__path__" = "/openbao/logs/*"}]
sync_period = "5s"
}
loki.source.file "openbao_logs" {
targets = local.file_match.openbao_file_logs.output
forward_to = [loki.write.local_loki.receiver]
}
loki.source.kubernetes "all_pod_logs" { loki.source.kubernetes "all_pod_logs" {
targets = discovery.relabel.pod_logs.output targets = discovery.relabel.pod_logs.output
forward_to = [loki.write.local_loki.receiver] forward_to = [loki.write.local_loki.receiver]

View file

@ -33,7 +33,7 @@ jobs:
#run: ./mvnw spring-boot:build-image # the original image build #run: ./mvnw spring-boot:build-image # the original image build
run: | run: |
export CONTAINER_REPO=$(echo {% raw %}${{ env.GITHUB_REPOSITORY }}{% endraw %} | tr '[:upper:]' '[:lower:]') export CONTAINER_REPO=$(echo {% raw %}${{ env.GITHUB_REPOSITORY }}{% endraw %} | tr '[:upper:]' '[:lower:]')
./mvnw com.google.cloud.tools:jib-maven-plugin:3.4.4:build -Djib.allowInsecureRegistries=true -Dimage={{{ .Env.DOMAIN_GITEA }}}/${CONTAINER_REPO}:latest -Djib.to.auth.username={% raw %}${{ secrets.PACKAGES_USER }}{% endraw %} -Djib.to.auth.password={% raw %}${{ secrets.PACKAGES_TOKEN }}{% endraw %} -Djib.from.platforms=linux/arm64,linux/amd64 ./mvnw com.google.cloud.tools:jib-maven-plugin:3.4.4:build -Djib.allowInsecureRegistries=true -Dimage={{{ .Env.DOMAIN_GITEA }}}/${CONTAINER_REPO}:latest -Djib.to.auth.username={% raw %}${{ github.actor }}{% endraw %} -Djib.to.auth.password={% raw %}${{ secrets.PACKAGES_TOKEN }}{% endraw %} -Djib.from.platforms=linux/arm64,linux/amd64
- name: Build image as tar - name: Build image as tar
run: | run: |
./mvnw com.google.cloud.tools:jib-maven-plugin:3.4.4:buildTar -Djib.allowInsecureRegistries=true ./mvnw com.google.cloud.tools:jib-maven-plugin:3.4.4:buildTar -Djib.allowInsecureRegistries=true

View file

@ -255,8 +255,6 @@ spec:
value: debug value: debug
- name: NODE_TLS_REJECT_UNAUTHORIZED - name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0" value: "0"
- name: NODE_OPTIONS
value: "--no-node-snapshot"
envFrom: envFrom:
- secretRef: - secretRef:
name: backstage-env-vars name: backstage-env-vars
@ -264,8 +262,7 @@ spec:
name: gitea-credentials name: gitea-credentials
- secretRef: - secretRef:
name: argocd-credentials name: argocd-credentials
image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/backstage-edp:1.1.0 image: ghcr.io/cnoe-io/backstage-app:9232d633b2698fffa6d0a73b715e06640d170162
imagePullPolicy: Always
name: backstage name: backstage
ports: ports:
- containerPort: 7007 - containerPort: 7007
@ -389,7 +386,7 @@ spec:
KEYCLOAK_NAME_METADATA: https://{{{ .Env.DOMAIN }}}:443/keycloak/realms/cnoe/.well-known/openid-configuration KEYCLOAK_NAME_METADATA: https://{{{ .Env.DOMAIN }}}:443/keycloak/realms/cnoe/.well-known/openid-configuration
KEYCLOAK_CLIENT_SECRET: "{{.BACKSTAGE_CLIENT_SECRET}}" KEYCLOAK_CLIENT_SECRET: "{{.BACKSTAGE_CLIENT_SECRET}}"
ARGOCD_AUTH_TOKEN: "argocd.token={{.ARGOCD_SESSION_TOKEN}}" ARGOCD_AUTH_TOKEN: "argocd.token={{.ARGOCD_SESSION_TOKEN}}"
ARGO_CD_URL: 'https://{{{ .Env.DOMAIN }}}/argocd/api/v1/' ARGO_CD_URL: 'https://argocd-server.argocd.svc.cluster.local/api/v1/'
data: data:
- secretKey: ARGOCD_SESSION_TOKEN - secretKey: ARGOCD_SESSION_TOKEN
remoteRef: remoteRef:

View file

@ -219,64 +219,6 @@ data:
] ]
} }
argocd-client-payload.json: |
{
"protocol": "openid-connect",
"clientId": "argocd",
"name": "ArgoCD Client",
"description": "Used for ArgoCD SSO",
"publicClient": false,
"authorizationServicesEnabled": false,
"serviceAccountsEnabled": false,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": true,
"standardFlowEnabled": true,
"frontchannelLogout": true,
"attributes": {
"saml_idp_initiated_sso_url_name": "",
"oauth2.device.authorization.grant.enabled": false,
"oidc.ciba.grant.enabled": false
},
"alwaysDisplayInConsole": false,
"rootUrl": "",
"baseUrl": "",
"redirectUris": [
"https://{{{ .Env.DOMAIN }}}/*"
],
"webOrigins": [
"/*"
]
}
forgejo-client-payload.json: |
{
"protocol": "openid-connect",
"clientId": "forgejo",
"name": "Forgejo Client",
"description": "Used for Forgejo SSO",
"publicClient": false,
"authorizationServicesEnabled": false,
"serviceAccountsEnabled": false,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": true,
"standardFlowEnabled": true,
"frontchannelLogout": true,
"attributes": {
"saml_idp_initiated_sso_url_name": "",
"oauth2.device.authorization.grant.enabled": false,
"oidc.ciba.grant.enabled": false
},
"alwaysDisplayInConsole": false,
"rootUrl": "",
"baseUrl": "",
"redirectUris": [
"https://{{{ .Env.DOMAIN_GITEA }}}/*"
],
"webOrigins": [
"/*"
]
}
--- ---
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
@ -441,13 +383,8 @@ spec:
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ -H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "grafana") | .id') -X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "grafana") | .id')
CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" \ CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" -H "Authorization: bearer ${KEYCLOAK_TOKEN}" -X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ curl -sS -H "Content-Type: application/json" -H "Authorization: bearer ${KEYCLOAK_TOKEN}" -X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
GRAFANA_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \ GRAFANA_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ -H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
@ -463,65 +400,16 @@ spec:
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ -H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "backstage") | .id') -X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "backstage") | .id')
CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" \ CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" -H "Authorization: bearer ${KEYCLOAK_TOKEN}" -X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ curl -sS -H "Content-Type: application/json" -H "Authorization: bearer ${KEYCLOAK_TOKEN}" -X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
BACKSTAGE_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \ BACKSTAGE_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \ -H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID} | jq -e -r '.secret') -X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID} | jq -e -r '.secret')
echo "creating ArgoCD client"
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X POST --data @/var/config/argocd-client-payload.json \
${KEYCLOAK_URL}/admin/realms/cnoe/clients
CLIENT_ID=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "argocd") | .id')
CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
ARGOCD_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID} | jq -e -r '.secret')
echo "creating Forgejo client"
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X POST --data @/var/config/forgejo-client-payload.json \
${KEYCLOAK_URL}/admin/realms/cnoe/clients
CLIENT_ID=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients | jq -e -r '.[] | select(.clientId == "forgejo") | .id')
CLIENT_SCOPE_GROUPS_ID=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/client-scopes | jq -e -r '.[] | select(.name == "groups") | .id')
curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X PUT ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID}/default-client-scopes/${CLIENT_SCOPE_GROUPS_ID}
FORGEJO_CLIENT_SECRET=$(curl -sS -H "Content-Type: application/json" \
-H "Authorization: bearer ${KEYCLOAK_TOKEN}" \
-X GET ${KEYCLOAK_URL}/admin/realms/cnoe/clients/${CLIENT_ID} | jq -e -r '.secret')
ARGOCD_PASSWORD=$(./kubectl -n argocd get secret argocd-initial-admin-secret -o go-template='{{.data.password | base64decode }}') ARGOCD_PASSWORD=$(./kubectl -n argocd get secret argocd-initial-admin-secret -o go-template='{{.data.password | base64decode }}')
ARGOCD_SESSION_TOKEN=$(curl -sS https://{{{ .Env.DOMAIN }}}/argocd/api/v1/session -H 'Content-Type: application/json' -d "{\"username\":\"admin\",\"password\":\"${ARGOCD_PASSWORD}\"}" | jq -r .token) ARGOCD_SESSION_TOKEN=$(curl -k -sS http://argocd-server.argocd.svc.cluster.local:443/api/v1/session -H 'Content-Type: application/json' -d "{\"username\":\"admin\",\"password\":\"${ARGOCD_PASSWORD}\"}" | jq -r .token)
echo \ echo \
"apiVersion: v1 "apiVersion: v1
@ -538,10 +426,7 @@ spec:
BACKSTAGE_CLIENT_ID: backstage BACKSTAGE_CLIENT_ID: backstage
GRAFANA_CLIENT_SECRET: ${GRAFANA_CLIENT_SECRET} GRAFANA_CLIENT_SECRET: ${GRAFANA_CLIENT_SECRET}
GRAFANA_CLIENT_ID: grafana GRAFANA_CLIENT_ID: grafana
ARGOCD_CLIENT_SECRET: ${ARGOCD_CLIENT_SECRET}
ARGOCD_CLIENT_ID: argocd
FORGEJO_CLIENT_SECRET: ${FORGEJO_CLIENT_SECRET}
FORGEJO_CLIENT_ID: forgejo
" > /tmp/secret.yaml " > /tmp/secret.yaml
./kubectl apply -f /tmp/secret.yaml ./kubectl apply -f /tmp/secret.yaml

View file

@ -1,54 +0,0 @@
# Mailhog
[MailHog is an email testing tool for developers](https://github.com/mailhog/MailHog).
## In cluster SMTP service
Ypu can send ESMTP emails in the cluster to `mailhog.mailhog.svc.cluster.local`, standard port `1025`, as defined in the service manifest:
```yaml
apiVersion: v1
kind: Service
metadata:
name: mailhog
spec:
ports:
- name: smtp
port: 1025
```
## Ingress
Mailhog offers both WebUi and API at `https://{{{ .Env.DOMAIN }}}/mailhog`.
The ingress definition is in `stacks/core/ingress-apps/mailhog.yaml` (BTW, why isn't this ingress file here in this folder ??) routing to the mailhog' service
```yaml
spec:
rules:
- host: {{{ .Env.DOMAIN }}}
http:
paths:
- backend:
...
path: /mailhog
```
## API
For usage of the API see https://github.com/mailhog/MailHog/blob/master/docs/APIv2.md
## Tests
```bash
kubectl run busybox --rm -it --image=busybox -- /bin/sh
# inside bsybox
wget -O- http://mailhog.mailhog.svc.cluster.local:8025/mailhog
# check smtp port
nc -zv mailhog.mailhog.svc.cluster.local 1025
# send esmtp, first install swaks
swaks --to test@example.com --from test@example.com --server mailhog:1025 --data "Subject: Test-Mail\n\nDies ist eine Test-Mail."
```

View file

@ -1,33 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mailhog-deployment
namespace: mailhog
spec:
replicas: 1
selector:
matchLabels:
app: mailhog
template:
metadata:
labels:
app: mailhog
spec:
containers:
- name: mailhog
image: mailhog/mailhog
env:
- name: MH_UI_WEB_PATH # set this to same value as in ingress stacks/core/ingress-apps/mailhog.yaml
value: mailhog
ports:
- containerPort: 1025
name: smtp
- containerPort: 8025
name: http
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "100m"

View file

@ -1,13 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: mailhog
spec:
selector:
app: mailhog
ports:
- name: smtp
port: 1025
- name: http
port: 8025
type: ClusterIP

View file

@ -1,7 +1,7 @@
apiVersion: argoproj.io/v1alpha1 apiVersion: argoproj.io/v1alpha1
kind: Application kind: Application
metadata: metadata:
name: argocd-sso name: openbao-logging-setup
namespace: argocd namespace: argocd
labels: labels:
env: dev env: dev
@ -12,10 +12,10 @@ spec:
source: source:
repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder repoURL: https://{{{ .Env.DOMAIN_GITEA }}}/giteaAdmin/edfbuilder
targetRevision: HEAD targetRevision: HEAD
path: "stacks/core/argocd-sso" path: "stacks/ref-implementation/openbao-logging"
destination: destination:
server: "https://kubernetes.default.svc" server: "https://kubernetes.default.svc"
namespace: argocd namespace: openbao
syncPolicy: syncPolicy:
syncOptions: syncOptions:
- CreateNamespace=true - CreateNamespace=true

View file

@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: openbao-logging-dir
namespace: openbao
spec:
selector:
matchLabels:
app: openbao-logging-dir
template:
metadata:
labels:
app: openbao-logging-dir
spec:
initContainers:
- name: creator
image: busybox
command: ["/bin/sh", "-c"]
args:
- |
set -e
mkdir -p /var/log/openbao
chown 100:100 /var/log/openbao
securityContext:
runAsUser: 0
volumeMounts:
- name: host-log
mountPath: /var/log
containers:
- name: running-container
image: busybox
command: ["sleep", "infinity"]
volumes:
- name: host-log
hostPath:
path: /var/log
type: Directory

View file

@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: openbao-logrotate
namespace: openbao
spec:
selector:
matchLabels:
app: openbao-logrotate
template:
metadata:
labels:
app: openbao-logrotate
spec:
containers:
- name: logrotate
image: alpine
command: ["/bin/sh", "-c"]
args:
- |
apk add --no-cache logrotate
while true; do logrotate -f /etc/logrotate.d/openbao; sleep 60; done
volumeMounts:
- name: logrotate-config
mountPath: /etc/logrotate.d/openbao
subPath: openbao
- name: host-log
mountPath: /var/log/openbao
volumes:
- name: logrotate-config
configMap:
name: openbao-logrotate-config
- name: host-log
hostPath:
path: /var/log
type: Directory
---
apiVersion: v1
kind: ConfigMap
metadata:
name: openbao-logrotate-config
namespace: openbao
data:
openbao: |
/var/log/openbao/openbao/*.log {
size 5k
rotate 7
compress
missingok
notifempty
postrotate
mkdir pupa
kill -SIGHUP $(pidof bao)
endscript
}

View file

@ -1,9 +1,21 @@
server: server:
volumes:
- name: host-log-storage
hostPath:
path: /var/log
type: Directory
volumeMounts:
- mountPath: /openbao/logs
name: host-log-storage
readOnly: false
postStart: postStart:
- sh - sh
- -c - -c
- | - |
sleep 10 sleep 10
rm -rf /openbao/data/*
bao operator init >> /tmp/init.txt bao operator init >> /tmp/init.txt
cat /tmp/init.txt | grep "Key " | awk '{print $NF}' | xargs -I{} bao operator unseal {} cat /tmp/init.txt | grep "Key " | awk '{print $NF}' | xargs -I{} bao operator unseal {}
echo $(grep "Initial Root Token:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/initial_token.txt echo $(grep "Initial Root Token:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/initial_token.txt
@ -12,6 +24,8 @@ server:
echo $(grep "Unseal Key 3:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key3.txt echo $(grep "Unseal Key 3:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key3.txt
echo $(grep "Unseal Key 4:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key4.txt echo $(grep "Unseal Key 4:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key4.txt
echo $(grep "Unseal Key 5:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key5.txt echo $(grep "Unseal Key 5:" /tmp/init.txt | awk '{print $NF}')| cat > /openbao/data/unseal_key5.txt
bao login $(grep "Initial Root Token:" /tmp/init.txt | awk '{print $NF}')
rm /tmp/init.txt rm /tmp/init.txt
bao audit enable -path="file" file file_path=/openbao/logs/openbao/openbao.log
ui: ui:
enabled: true enabled: true