Skip to content

Commit

Permalink
Make minor README changes and properly package images and charts on t…
Browse files Browse the repository at this point in the history
…agged commits in main
  • Loading branch information
andreev-io committed Jan 24, 2025
1 parent a8461dd commit 18eaab4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/kubenetmon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,24 @@ jobs:
build-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
attestations: write
id-token: write
outputs:
image-tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Extract metadata (tags, labels) for Docker
- name: Determine Docker metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: gchr.io/clickhouse/kubenetmon
images: ghcr.io/clickhouse/kubenetmon
tags: |
type=sha
type=ref,event=tag
- name: Build Docker image
id: build
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@v5
with:
context: .
push: false
Expand All @@ -87,8 +82,8 @@ jobs:

helm-test:
name: Test chart
runs-on: ubuntu-latest
needs: build-docker-image
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -163,10 +158,7 @@ jobs:
name: Publish Docker image
needs: [golangci, test, build-docker-image, helm-test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -189,8 +181,11 @@ jobs:
- name: Generate Version
id: version
run: |
# Use short commit SHA as the version
VERSION="0.1.0-$(git rev-parse --short HEAD)"
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION="${{ github.ref_name }}"
else
VERSION=$(git describe --tags --always 2>/dev/null || echo "0.1.0-$(git rev-parse --short HEAD)")
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Push to GitHub Container Registry
Expand All @@ -204,10 +199,7 @@ jobs:
name: Package and publish Helm charts
needs: [golangci, test, build-docker-image, helm-test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
packages: write
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -219,6 +211,17 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Update chart version and app version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION="${{ github.ref_name }}"
STRIPPED_VERSION="${VERSION#v}"
sed -i "s/^version:.*/version: $STRIPPED_VERSION/" deploy/helm/*/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: $VERSION/" deploy/helm/*/Chart.yaml
else
sed -i "s/^appVersion:.*/appVersion: ${{ github.sha }}/" deploy/helm/*/Chart.yaml
fi
- name: Run chart-releaser
uses: helm/[email protected]
with:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ The final component, ClickHouse, which we use as the destination of our data and

First, create a ClickHouse service in [ClickHouse Cloud](clickhouse.cloud). You can try it out for free with a $300 credit! In the new service (or an existing one, if you are already running ClickHouse), create `default.network_flows_0` table with this query (you can also find it in `test/network_flows_0.sql`):
```
CREATE TABLE default.network_flows_0
CREATE TABLE default.network_flows_1
(
`date` Date CODEC(Delta(2), ZSTD(1)),
`intervalStartTime` DateTime CODEC(Delta(4), ZSTD(1)),
`intervalSeconds` UInt16 CODEC(Delta(2), ZSTD(1)),
`environment` LowCardinality(String) CODEC(ZSTD(1)),
`proto` LowCardinality(String) CODEC(ZSTD(1)),
`connectionClass` LowCardinality(String) CODEC(ZSTD(1)),
`connectionFlags` Map(String, Bool) CODEC(ZSTD(1)),
`direction` LowCardinality(String) CODEC(ZSTD(1)),
`connectionFlags` Map(LowCardinality(String), Bool) CODEC(ZSTD(1)),
`direction` Enum('out' = 1, 'in' = 2) CODEC(ZSTD(1)),
`localCloud` LowCardinality(String) CODEC(ZSTD(1)),
`localRegion` LowCardinality(String) CODEC(ZSTD(1)),
`localCluster` LowCardinality(String) CODEC(ZSTD(1)),
`localCell` LowCardinality(String) CODEC(ZSTD(1)),
`localAvailabilityZone` LowCardinality(String) CODEC(ZSTD(1)),
`localNode` String CODEC(ZSTD(1)),
`localInstanceID` String CODEC(ZSTD(1)),
`localNamespace` String CODEC(ZSTD(1)),
`localNamespace` LowCardinality(String) CODEC(ZSTD(1)),
`localPod` String CODEC(ZSTD(1)),
`localIPv4` IPv4 CODEC(Delta(4), ZSTD(1)),
`localPort` UInt16 CODEC(Delta(2), ZSTD(1)),
Expand All @@ -56,7 +56,7 @@ CREATE TABLE default.network_flows_0
`remoteAvailabilityZone` LowCardinality(String) CODEC(ZSTD(1)),
`remoteNode` String CODEC(ZSTD(1)),
`remoteInstanceID` String CODEC(ZSTD(1)),
`remoteNamespace` String CODEC(ZSTD(1)),
`remoteNamespace` LowCardinality(String) CODEC(ZSTD(1)),
`remotePod` String CODEC(ZSTD(1)),
`remoteIPv4` IPv4 CODEC(Delta(4), ZSTD(1)),
`remotePort` UInt16 CODEC(Delta(2), ZSTD(1)),
Expand Down Expand Up @@ -85,7 +85,7 @@ helm upgrade --install --wait backend --namespace default --set redis.enabled=tr
helm upgrade --install --wait frontend --namespace default --set redis.enabled=true podinfo/podinfo
```

We now install `kubenetmon-server`. `kubenetmon-server` expects an environment, cluster name, cloud provider name (`aws`, `gcp`, or `azure`), and region, so we provide these. We are going to supply also connection credentials for our ClickHouse instance:
We now install `kubenetmon-server`. `kubenetmon-server` expects an environment, cluster name, cloud provider name (`aws`, `gcp`, or `azure`), and region, so we provide these. We are also going to supply connection credentials for our ClickHouse instance:
```
helm install kubenetmon-server kubenetmon-server/kubenetmon-server-1.0.0.tgz --namespace kubenetmon-server \
--set image.repository=ghcr.io/clickhouse/kubenetmon \
Expand Down
10 changes: 5 additions & 5 deletions test/network_flows_0.sql
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
CREATE TABLE default.network_flows_0
CREATE TABLE default.network_flows_1
(
`date` Date CODEC(Delta(2), ZSTD(1)),
`intervalStartTime` DateTime CODEC(Delta(4), ZSTD(1)),
`intervalSeconds` UInt16 CODEC(Delta(2), ZSTD(1)),
`environment` LowCardinality(String) CODEC(ZSTD(1)),
`proto` LowCardinality(String) CODEC(ZSTD(1)),
`connectionClass` LowCardinality(String) CODEC(ZSTD(1)),
`connectionFlags` Map(String, Bool) CODEC(ZSTD(1)),
`direction` LowCardinality(String) CODEC(ZSTD(1)),
`connectionFlags` Map(LowCardinality(String), Bool) CODEC(ZSTD(1)),
`direction` Enum('out' = 1, 'in' = 2) CODEC(ZSTD(1)),
`localCloud` LowCardinality(String) CODEC(ZSTD(1)),
`localRegion` LowCardinality(String) CODEC(ZSTD(1)),
`localCluster` LowCardinality(String) CODEC(ZSTD(1)),
`localCell` LowCardinality(String) CODEC(ZSTD(1)),
`localAvailabilityZone` LowCardinality(String) CODEC(ZSTD(1)),
`localNode` String CODEC(ZSTD(1)),
`localInstanceID` String CODEC(ZSTD(1)),
`localNamespace` String CODEC(ZSTD(1)),
`localNamespace` LowCardinality(String) CODEC(ZSTD(1)),
`localPod` String CODEC(ZSTD(1)),
`localIPv4` IPv4 CODEC(Delta(4), ZSTD(1)),
`localPort` UInt16 CODEC(Delta(2), ZSTD(1)),
Expand All @@ -27,7 +27,7 @@ CREATE TABLE default.network_flows_0
`remoteAvailabilityZone` LowCardinality(String) CODEC(ZSTD(1)),
`remoteNode` String CODEC(ZSTD(1)),
`remoteInstanceID` String CODEC(ZSTD(1)),
`remoteNamespace` String CODEC(ZSTD(1)),
`remoteNamespace` LowCardinality(String) CODEC(ZSTD(1)),
`remotePod` String CODEC(ZSTD(1)),
`remoteIPv4` IPv4 CODEC(Delta(4), ZSTD(1)),
`remotePort` UInt16 CODEC(Delta(2), ZSTD(1)),
Expand Down

0 comments on commit 18eaab4

Please sign in to comment.