From 35cc794f4c136f6a3bc6e2abe7781607985d6ccf Mon Sep 17 00:00:00 2001 From: Chris Blumentritt Date: Thu, 7 Mar 2024 15:44:49 -0600 Subject: [PATCH 1/3] Adds loki helm install examples Signed-off-by: Chris Blumentritt --- helm-configs/loki/README.md | 27 +++++++++++++++++++ .../loki-helm-minio-overrides-example.yaml | 6 +++++ .../loki/loki-helm-s3-overrides-example.yaml | 19 +++++++++++++ .../loki-helm-swift-overrides-example.yaml | 18 +++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 helm-configs/loki/README.md create mode 100644 helm-configs/loki/loki-helm-minio-overrides-example.yaml create mode 100644 helm-configs/loki/loki-helm-s3-overrides-example.yaml create mode 100644 helm-configs/loki/loki-helm-swift-overrides-example.yaml diff --git a/helm-configs/loki/README.md b/helm-configs/loki/README.md new file mode 100644 index 00000000..24d3ca60 --- /dev/null +++ b/helm-configs/loki/README.md @@ -0,0 +1,27 @@ +# Setting up Loki + +## Add the grafana helm repo +```bash +helm repo add grafana https://grafana.github.io/helm-charts +helm repo update +``` + +## Install the helm chart + +You will need to make changes depending on how you want to configure loki. Example files are included in this directory choose one relevant to your deploy + +```bash +helm upgrade --install --values my-loki-helm-overrides.yaml loki grafana/loki --create-namespace --namespace grafana +``` + +### Swift notes + +If you plan on using swift as a backend for log storage see the [loki-helm-swift-overrides-example.yaml](loki-helm-swift-overrides-example.yaml) + +### S3 notes + +If you plan on using s3 as a backend for log storage see the [loki-helm-s3-overrides-example.yaml](loki-helm-s3-overrides-example.yaml) + +### minio notes + +If you plan on using minio as a backend for log storage see the [loki-helm-minio-overrides-example.yaml](loki-helm-minio-overrides-example.yaml) diff --git a/helm-configs/loki/loki-helm-minio-overrides-example.yaml b/helm-configs/loki/loki-helm-minio-overrides-example.yaml new file mode 100644 index 00000000..2a77a6ab --- /dev/null +++ b/helm-configs/loki/loki-helm-minio-overrides-example.yaml @@ -0,0 +1,6 @@ +global: + dnsService: "coredns" +minio: + enabled: true +loki: + auth_enabled: false diff --git a/helm-configs/loki/loki-helm-s3-overrides-example.yaml b/helm-configs/loki/loki-helm-s3-overrides-example.yaml new file mode 100644 index 00000000..0595acc3 --- /dev/null +++ b/helm-configs/loki/loki-helm-s3-overrides-example.yaml @@ -0,0 +1,19 @@ +global: + dnsService: "coredns" +minio: + enabled: false +loki: + auth_enabled: false + storage: + bucketNames: + chunks: < CHUNKS BUCKET NAME > # TODO: Update with relevant bucket name for chunks + ruler: < RULER BUCKET NAME > # TODO: Update with relevant bucket name for ruler + admin: < ADMIN BUCKET NAME > # TODO: Update with relevant bucket name for admin + type: s3 + s3: + endpoint: < ENDPOINT URL > # TODO: Update with valid enpoint URL + region: < REGION > # TODO: Update with valid region + secretAccessKey: < SECRET ACCESS KEY > # TODO: Update with valid secret access key + accessKeyId: < ACCESS KEY ID > # TODO: Update with access key id + s3ForcePathStyle: false + insecure: [ true | false ] # TODO: True if valid cert or false if not diff --git a/helm-configs/loki/loki-helm-swift-overrides-example.yaml b/helm-configs/loki/loki-helm-swift-overrides-example.yaml new file mode 100644 index 00000000..7f5f060b --- /dev/null +++ b/helm-configs/loki/loki-helm-swift-overrides-example.yaml @@ -0,0 +1,18 @@ +global: + dnsService: "coredns" +minio: + enabled: false +loki: + auth_enabled: false + storage: + bucketNames: + chunks: chunks + ruler: ruler + admin: admin + type: swift + swift: + auth_url: https://identity.api.rackspacecloud.com/v1.0 + username: < USERNAME > # TODO: Update with valid username + password: < PASSWORD > # TODO: Update with valid password + container_name: < CONTAINER > # TODO: Update with valid container + region_name: < REGION > # TODO: Update with valid region From 0360769be9b94e64c0bb3c52f3e6339e529b75a7 Mon Sep 17 00:00:00 2001 From: Chris Blumentritt Date: Thu, 7 Mar 2024 16:51:39 -0600 Subject: [PATCH 2/3] Using Secret instead of ConfigMap to store loki config By default loki helm chart stores the config in a ConfigMap. For backends that require credentials this is unsafe. Setting the `configStorageType` to secret will store the entire loki config in a Secret. Signed-off-by: Chris Blumentritt --- helm-configs/loki/README.md => docs/loki.md | 0 helm-configs/loki/loki-helm-minio-overrides-example.yaml | 1 + helm-configs/loki/loki-helm-s3-overrides-example.yaml | 1 + helm-configs/loki/loki-helm-swift-overrides-example.yaml | 1 + 4 files changed, 3 insertions(+) rename helm-configs/loki/README.md => docs/loki.md (100%) diff --git a/helm-configs/loki/README.md b/docs/loki.md similarity index 100% rename from helm-configs/loki/README.md rename to docs/loki.md diff --git a/helm-configs/loki/loki-helm-minio-overrides-example.yaml b/helm-configs/loki/loki-helm-minio-overrides-example.yaml index 2a77a6ab..c77ada3a 100644 --- a/helm-configs/loki/loki-helm-minio-overrides-example.yaml +++ b/helm-configs/loki/loki-helm-minio-overrides-example.yaml @@ -4,3 +4,4 @@ minio: enabled: true loki: auth_enabled: false + configStorageType: Secret diff --git a/helm-configs/loki/loki-helm-s3-overrides-example.yaml b/helm-configs/loki/loki-helm-s3-overrides-example.yaml index 0595acc3..09730acf 100644 --- a/helm-configs/loki/loki-helm-s3-overrides-example.yaml +++ b/helm-configs/loki/loki-helm-s3-overrides-example.yaml @@ -4,6 +4,7 @@ minio: enabled: false loki: auth_enabled: false + configStorageType: Secret storage: bucketNames: chunks: < CHUNKS BUCKET NAME > # TODO: Update with relevant bucket name for chunks diff --git a/helm-configs/loki/loki-helm-swift-overrides-example.yaml b/helm-configs/loki/loki-helm-swift-overrides-example.yaml index 7f5f060b..5e4155be 100644 --- a/helm-configs/loki/loki-helm-swift-overrides-example.yaml +++ b/helm-configs/loki/loki-helm-swift-overrides-example.yaml @@ -4,6 +4,7 @@ minio: enabled: false loki: auth_enabled: false + configStorageType: Secret storage: bucketNames: chunks: chunks From 6c7d3d3badec0d9e9cd89d55d017dafb8c4a55ef Mon Sep 17 00:00:00 2001 From: Chris Blumentritt Date: Fri, 8 Mar 2024 14:39:44 -0600 Subject: [PATCH 3/3] Adding loki github workflow Signed-off-by: Chris Blumentritt --- .github/workflows/helm-loki.yaml | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/helm-loki.yaml diff --git a/.github/workflows/helm-loki.yaml b/.github/workflows/helm-loki.yaml new file mode 100644 index 00000000..fe569d17 --- /dev/null +++ b/.github/workflows/helm-loki.yaml @@ -0,0 +1,38 @@ +name: Helm GitHub Actions for loki + +on: + pull_request: + paths: + - helm-configs/loki/** + - .github/workflows/helm-loki.yaml +jobs: + helm: + name: Helm + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: azure/setup-helm@v3 + with: + version: latest + token: "${{ secrets.GITHUB_TOKEN }}" + id: helm + - name: Kubectl Install + working-directory: /usr/local/bin/ + run: | + if [ ! -f /usr/local/bin/kubectl ]; then + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x ./kubectl + fi + - name: Run Helm Template + run: | + ${{ steps.helm.outputs.helm-path }} repo add grafana https://grafana.github.io/helm-charts + ${{ steps.helm.outputs.helm-path }} repo update + ${{ steps.helm.outputs.helm-path }} template --values ${{ github.workspace }}/helm-configs/loki/loki-helm-minio-overrides-example.yaml \ + --namespace grafana \ + loki grafana/loki > /tmp/rendered.yaml + - name: Return helm Build + uses: actions/upload-artifact@v2 + with: + name: helm-loki-artifact + path: /tmp/rendered.yaml