Skip to content

Commit

Permalink
Merge pull request '[Add] Kubernetes-Prometheus v0.14.0 and Add Versi…
Browse files Browse the repository at this point in the history
…on Script' (#409) from add/kube-prom-v0.14.0 into master

Reviewed-on: https://gitea.obmondo.com/EnableIT/KubeAid/pulls/409
  • Loading branch information
Klavs Klavsen committed Sep 13, 2024
2 parents 436449f + 976335c commit a21d4d8
Show file tree
Hide file tree
Showing 1,251 changed files with 350,767 additions and 0 deletions.
8 changes: 8 additions & 0 deletions build/kube-prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ If `kube_prometheus_version` variable isn't present in the jsonnet vars file, it

Note that you have to clone your kubeaid-config git repository seperately.

## Adding versions

If there's a kube-prometheus version which isn't already added in KubeAid, run the `add-version.sh` script to add it. All you need is to specify the version/tag, and no customer jsonnet file is required.

```sh
./build/kube-prometheus/add-version.sh <version-tag>
```

## Cleaning up

During the [Upgrading process](#upgrading) if you encounter error related to broken version dependencies, or the version/release vendor dirs are messed up, you can just delete the entire version dir and follow the [Upgrading process](#upgrading) again. This freshly fetches the version and its dependencies, and builds manifests in your kubeaid-config repository.
Expand Down
56 changes: 56 additions & 0 deletions build/kube-prometheus/add-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# This script sets up a new version directory for jsonnet-bundler dependencies.
# It performs the following tasks:
# 1. Checks for correct usage and ensures the script is run from the correct (root of KubeAid repo) location.
# 2. Verifies that the 'jb' command (jsonnet-bundler) is installed.
# 3. Checks if a directory for the specified version already exists.
# 4. Creates the directory if it does not exist.
# 5. Initializes jsonnet-bundler and installs the required dependencies for the specified version.
# Usage: ./build/kube-prometheus/script.sh <version-tag>

set -euo pipefail

# Ensure correct usage
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <version-tag>"
exit 1
fi

# sanity checks
BUILDPATH=build/kube-prometheus/
if [ ! -e "$BUILDPATH" ]; then
echo "I cannot find $BUILDPATH - this script MUST be run from root of git repo"
exit 1
fi

# Check if 'jb' is installed
if ! command -v jb &> /dev/null; then
echo "'jb' command not found. Please install jsonnet-bundler."
exit 1
fi

VERSION=$1
INSTALLPATH="${BUILDPATH}/libraries/${VERSION}"

# Check if the version directory already exists
if [[ -e "$INSTALLPATH" ]]; then
echo "Version $VERSION already exists. Exiting."
exit 1
fi

# Create the new version directory
mkdir -p "$INSTALLPATH"

# Navigate to the new directory and initialize jb
cd "$INSTALLPATH" || { echo "Failed to change directory to $INSTALLPATH"; exit 1; }

# Initialize jsonnet-bundler and install dependencies
jb init
jb install "github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@${VERSION}"
jb install "github.com/bitnami-labs/sealed-secrets/contrib/prometheus-mixin@main"
jb install "github.com/ceph/ceph/monitoring/ceph-mixin@main"
jb install "gitlab.com/uneeq-oss/cert-manager-mixin@master"
jb install "github.com/grafana/jsonnet-libs/opensearch-mixin@master"

echo "Version ${VERSION} added successfully."
51 changes: 51 additions & 0 deletions build/kube-prometheus/libraries/v0.14.0/jsonnetfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"version": 1,
"dependencies": [
{
"source": {
"git": {
"remote": "https://github.com/bitnami-labs/sealed-secrets.git",
"subdir": "contrib/prometheus-mixin"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/ceph/ceph.git",
"subdir": "monitoring/ceph-mixin"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/grafana/jsonnet-libs.git",
"subdir": "opensearch-mixin"
}
},
"version": "master"
},
{
"source": {
"git": {
"remote": "https://github.com/prometheus-operator/kube-prometheus.git",
"subdir": "jsonnet/kube-prometheus"
}
},
"version": "v0.14.0"
},
{
"source": {
"git": {
"remote": "https://gitlab.com/uneeq-oss/cert-manager-mixin.git",
"subdir": ""
}
},
"version": "master"
}
],
"legacyImports": true
}
Loading

0 comments on commit a21d4d8

Please sign in to comment.