Skip to content

Commit

Permalink
Generate Helm chart as a release artifact
Browse files Browse the repository at this point in the history
This helps with several things: it's no longer necessary to download an
archive of the entire repo, and it's impossible to have a mismatch
between the version of the chart being used, the release version, and
the links the documentation.
  • Loading branch information
juliogreff committed Aug 4, 2020
1 parent fe75253 commit 9c7f1fc
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
-
name: Generate Plugin manifest
run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}}
-
name: Generate Chart tarball
run: ./hack/release/generate-chart-tarball.sh ${{steps.tag.outputs.tag}}
-
name: OLM RedHat bundle
run: ./hack/generate-olm-bundle.sh ${{steps.tag.outputs.tag}}
Expand All @@ -43,6 +46,7 @@ jobs:
files: |
dist/datadog-plugin.yaml
dist/*.zip
dist/*.tar.gz
env:
COMMIT_TAG: ${{steps.tag.outputs.tag}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions chart/datadog-agent-with-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: datadog-agent-with-operator
description: A Helm chart for Kubernetes
type: application
version: 0.0.1
appVersion: 0.1.3
version: PLACEHOLDER_VERSION
appVersion: PLACEHOLDER_VERSION
4 changes: 2 additions & 2 deletions chart/datadog-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: "0.1.3"
appVersion: "PLACEHOLDER_VERSION"
description: Datadog Operator
name: datadog-operator
version: 0.2.1
version: "PLACEHOLDER_VERSION"
2 changes: 1 addition & 1 deletion chart/datadog-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
replicaCount: 1
image:
repository: datadog/operator
tag: 0.2.1
tag: "PLACEHOLDER_VERSION"
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
Expand Down
14 changes: 6 additions & 8 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ Using the Datadog Operator requires the following prerequisites:
In order to deploy a Datadog agent with the operator in the minimum number of steps, the [`datadog-agent-with-operator`](https://github.com/DataDog/datadog-operator/tree/master/chart/datadog-agent-with-operator) helm chart can be used.
Here are the steps:

1. Download the [Datadog Operator project zip ball][3] and unzip it. Source code can be found at [`DataDog/datadog-operator`][4]. Go into the `datadog-operator-<tag>` folder.
1. [Download the chart][3]:

```shell
curl -L https://github.com/DataDog/datadog-operator/archive/master.tar.gz | tar xvz
cd datadog-operator-master
curl -Lo datadog-agent-with-operator.tar.gz https://github.com/DataDog/datadog-operator/releases/latest/download/datadog-agent-with-operator.tar.gz
```

2. Create a file with the spec of your agent. The simplest configuration is:
Expand All @@ -34,11 +33,11 @@ Here are the steps:
name: "datadog/agent:latest"
```

Replace `<DATADOG_API_KEY>` and `<DATADOG_APP_KEY>` with your [Datadog API and application keys][5]
Replace `<DATADOG_API_KEY>` and `<DATADOG_APP_KEY>` with your [Datadog API and application keys][4]

3. Deploy the Datadog agent with the above configuration file:
```shell
helm install --set-file agent_spec=/path/to/your/datadog-agent.yaml datadog chart/datadog-agent-with-operator
helm install --set-file agent_spec=/path/to/your/datadog-agent.yaml datadog datadog-agent-with-operator.tar.gz
```

## Cleanup
Expand All @@ -52,6 +51,5 @@ helm delete datadog

[1]: https://helm.sh
[2]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[3]: https://github.com/DataDog/datadog-operator/archive/master.tar.gz
[4]: https://github.com/DataDog/datadog-operator
[5]: https://app.datadoghq.com/account/settings#api
[3]: https://github.com/DataDog/datadog-operator/releases/latest/download/datadog-agent-with-operator.tar.gz
[4]: https://app.datadoghq.com/account/settings#api
28 changes: 28 additions & 0 deletions hack/release/generate-chart-tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

source "$(dirname $0)/../os-env.sh"

TAG=""
if [ $# -gt 0 ]; then
TAG=$1
echo "TAG=$TAG"
else
echo "First parameter should be the new TAG"
exit 1
fi
VERSION=${TAG:1}

GIT_ROOT=$(git rev-parse --show-toplevel)
PLUGIN_NAME=kubectl-datadog
OUTPUT_FOLDER=$GIT_ROOT/dist
TARBALL_NAME="$PLUGIN_NAME_$VERSION.tar.gz"

cp -Lr $GIT_ROOT/chart/* $OUTPUT_FOLDER/

for CHART in datadog-operator datadog-agent-with-operator
do
$SED "s/PLACEHOLDER_VERSION/$VERSION/g" $OUTPUT_FOLDER/$CHART/Chart.yaml
$SED "s/PLACEHOLDER_VERSION/$VERSION/g" $OUTPUT_FOLDER/$CHART/values.yaml
tar -zcvf $OUTPUT_FOLDER/$CHART.tar.gz -C $OUTPUT_FOLDER $CHART
done

0 comments on commit 9c7f1fc

Please sign in to comment.