Skip to content

Commit

Permalink
aws: update chart settings and CI (#48)
Browse files Browse the repository at this point in the history
* aws: update chart values
* fluent-bit: moved up one directory
* workflows: added auto-sync of releases
* workflows: added chart linting

Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens authored Apr 4, 2023
1 parent db1313e commit d5c5e16
Show file tree
Hide file tree
Showing 21 changed files with 167 additions and 41 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/cron-sync-lts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Sync latest core release
# We pull from here to prevent too much coupling to the core repo.
on:
workflow_dispatch:
schedule:
- cron: "0 23 * * *"

jobs:
sync-core-release:
runs-on: ubuntu-latest
permissions:
contents: read
# Not required as we use CI_PAT directly so we can trigger workflows
# pull-requests: write
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_PAT }}

- id: get-fb-release
run: |
curl -sSfl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/calyptia/calyptia-fluent-bit/releases/latest
LATEST_RELEASE_TAG=$(curl -sSfl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/calyptia/calyptia-fluent-bit/releases/latest|jq -r .tag_name)
echo "Found tag for latest release: $LATEST_RELEASE_TAG"
echo "tag=$LATEST_RELEASE_TAG" >> $GITHUB_OUTPUT
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.CI_PAT }}

# Note we assume a simple version update so no chart version update
- name: Run the sed on the chart file
run: |
if [[ "$NEW_CALYPTIA_FB_VERSION" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]] ; then
NEW_CALYPTIA_FB_VERSION=${BASH_REMATCH[1]}
echo "Valid version string: $NEW_CALYPTIA_FB_VERSION"
else
echo "ERROR: Invalid semver string: $NEW_CALYPTIA_FB_VERSION"
exit 1
fi
sed -i "s/^version.*$/version: $NEW_CALYPTIA_FB_VERSION/g" ./charts/fluent-bit/Chart.yaml
sed -i "s/^appVersion.*$/appVersion: v$NEW_CALYPTIA_FB_VERSION/g" ./charts/fluent-bit/Chart.yaml
echo "chart version=$NEW_CALYPTIA_FB_VERSION" >> $GITHUB_OUTPUT
echo "app version=v$NEW_CALYPTIA_FB_VERSION" >> $GITHUB_OUTPUT
env:
NEW_CALYPTIA_FB_VERSION: ${{ steps.get-fb-release.outputs.tag }}
shell: bash

- name: Generate PR
uses: peter-evans/create-pull-request@v4
with:
commit-message: 'ci: update to latest LTS version'
signoff: true
branch: ci_update_lts
delete-branch: true
title: 'ci: update to latest LTS version'
# We need workflows permission so have to use the CI_PAT
token: ${{ secrets.CI_PAT }}
labels: ci,automerge
body: |
Update LTS version
- Created by ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- Auto-generated by create-pull-request: https://github.com/peter-evans/create-pull-request
draft: false
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,45 @@ jobs:
steps:
- name: Run markdownlint
uses: actionshub/[email protected]

lint-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.11.2

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
shell: bash

- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --target-branch ${{ github.event.repository.default_branch }}
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3

- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
10 changes: 8 additions & 2 deletions charts/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ Helm's [documentation](https://helm.sh/docs) to get started.

Once Helm has been set up correctly, add the repo as follows:

```shell
helm repo add calyptia https://calyptia.github.io/charts
```

If you had already added this repo earlier, run `helm repo update` to retrieve
the latest versions of the packages. You can then run `helm search repo
<alias>` to see the charts.

To install the calyptia-core chart:

helm install calyptia-core <alias>/<chart-name>
```shell
helm install calyptia-core <alias>/<chart-name>
```

To uninstall the chart:

helm delete calyptia-core
```shell
helm delete calyptia-core
```
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: Fast and lightweight observability processor and forwarder for Linu
home: https://calyptia.com/products/lts-fluentbit/
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/fluentd/fluentbit/icon/fluentbit-icon-color.svg
type: application
version: 0.1.0
appVersion: "22.10"
version: 22.10.5
appVersion: "v22.10.5"
40 changes: 40 additions & 0 deletions charts/fluent-bit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# AWS Marketplace Calyptia Fluent Bit

A helm chart intended to be used with the [AWS marketplace version of Calyptia Fluent Bit](https://aws.amazon.com/marketplace/pp/prodview-z2en74bwhkfug).

## Usage

Ensure a service account is set up with the `arn:aws:iam::aws:policy/AWSMarketplaceMeteringRegisterUsage` policy to register usage correctly.

```shell
eksctl create cluster

eksctl utils associate-iam-oidc-provider --cluster=<clusterName> --approve

eksctl create iamserviceaccount --cluster=<clusterName> --name=eks-calyptia-fluentbit --namespace=<serviceAccountNamespace> --attach-policy-arn=arn:aws:iam::aws:policy/AWSMarketplaceMeteringRegisterUsage --approve
```

[Helm](https://helm.sh) must be installed to use the charts. Please refer to
Helm's [documentation](https://helm.sh/docs) to get started.

Once Helm has been set up correctly, add the repo as follows:

```shell
helm repo add calyptia https://calyptia.github.io/charts
```

If you had already added this repo earlier, run `helm repo update` to retrieve
the latest versions of the packages. You can then run `helm search repo
<alias>` to see the charts.

To install the calyptia-fluentbit chart:

```shell
helm install calyptia-fluentbit <alias>/<chart-name>
```

To uninstall the chart:

```shell
helm delete calyptia-fluentbit
```
30 changes: 0 additions & 30 deletions charts/fluent-bit/aws-marketplace/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ serviceAccount:
image:
amd:
repository: http://709825985650.dkr.ecr.us-east-1.amazonaws.com/calyptia/calyptia-fb
tag: 22.10.2-amd64
tag: 22.10.5
pullPolicy: Always
arn:
repository: nil
tag: nil
pullPolicy: Always

arch: amd64

metricsPort: 2020
hostNetwork: false
dnsPolicy: ClusterFirst
Expand Down
6 changes: 6 additions & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
chart-dirs:
- charts
helm-extra-args: --timeout=500s
target-branch: main

0 comments on commit d5c5e16

Please sign in to comment.