Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Kubernetes Monitoring Helm Chart
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Monitoring
helm-charts
Kubernetes Monitoring Helm Chart
Commits
8f534f3d
Commit
8f534f3d
authored
7 months ago
by
Guillermo Facundo Colunga
Browse files
Options
Downloads
Patches
Plain Diff
repo: refactor ci/repo to create a release on harbor on new repo tags
parent
757c3376
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Qa->Master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+40
-98
40 additions, 98 deletions
.gitlab-ci.yml
Chart.yaml
+2
-2
2 additions, 2 deletions
Chart.yaml
with
42 additions
and
100 deletions
.gitlab-ci.yml
+
40
−
98
View file @
8f534f3d
image
:
gitlab-registry.cern.ch/linuxsupport/alma9-base
include
:
-
project
:
'
ci-tools/container-image-ci-templates'
file
:
'
helm.gitlab-ci.yml'
ref
:
master
stages
:
-
lint
-
test
-
build
-
tag
-
release
-
deploy
docs_lint
:
stage
:
lint
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
script
:
-
dnf install -y python-pip
-
python3 -m pip install linkcheckmd
...
...
@@ -17,6 +24,9 @@ docs_lint:
yaml_lint
:
stage
:
lint
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
script
:
-
dnf install -y epel-release
-
dnf install -y yamllint
...
...
@@ -24,6 +34,9 @@ yaml_lint:
helm_lint
:
stage
:
lint
rules
:
-
if
:
'
$CI_COMMIT_TAG'
when
:
never
image
:
alpine/helm
script
:
-
helm dep update .
...
...
@@ -32,112 +45,41 @@ helm_lint:
version_test
:
stage
:
test
rules
:
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"master"
||
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"qa"'
changes
:
paths
:
-
Chart.yaml
-
values.yaml
-
templates/*
-
if
:
'
$CI_COMMIT_TAG'
script
:
|
dnf install -y python3-pip
pip install yq
MASTER_VERSION=$(curl https://gitlab.cern.ch/monitoring/helm-charts/kubernetes-monitoring/-/raw/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME/Chart.yaml?ref_type=heads | yq .version)
LOCAL_VERSION=$(cat Chart.yaml | yq .version)
if [ $MASTER_VERSION == $LOCAL_VERSION ]; then
echo "Please, update Chart.yaml version before merge."
exit -1
# Installing helm...
dnf install -y diffutils wget tar
wget https://get.helm.sh/helm-v3.15.3-linux-386.tar.gz
tar -zxvf helm-v3.15.3-linux-386.tar.gz
mv linux-386/helm /usr/local/bin/helm
rm helm-v3.15.3-linux-386.tar.gz
rm -rf linux-386
# Check if the tag already exists in harbor to avoid overrides.
if helm pull oci://registry.cern.ch/monit/cern-it-monitoring-kubernetes --version $CI_COMMIT_TAG; then
# Command was successful (exit code 0), so the tag exists
echo "The tag $TAG already exists in harbor. Please update it."
exit 1 # Exit with non-zero status to indicate tag exists
else
echo "Chart version changed from $MASTER_VERSION to $LOCAL_VERSION."
# Command failed (non-zero exit code), so the tag does not exist
echo "The tag $TAG does not exist in harbor. All ok..."
exit 0 # Exit with 0 status
fi
helm_test
:
stage
:
test
helm_deploy
:
stage
:
deploy
needs
:
-
version_test
rules
:
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"master"'
changes
:
paths
:
-
Chart.yaml
-
values.yaml
-
templates/*
-
if
:
'
$CI_COMMIT_TAG'
script
:
|
dnf install -y python3-pip
pip install yq
dnf install -y python3-setuptools
dnf install -y gcc
dnf install -y python3-devel
dnf install -y epel-release
dnf install -y diffutils wget tar
wget https://get.helm.sh/helm-v3.15.3-linux-386.tar.gz
tar -zxvf helm-v3.15.3-linux-386.tar.gz
mv linux-386/helm /usr/local/bin/helm
rm helm-v3.15.3-linux-386.tar.gz
rm -rf linux-386
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
rm kubectl
pip install python-openstackclient
pip install python-magnumclient
dnf install openssl
export OS_AUTH_URL=$CI_OS_AUTH_URL
export OS_PROJECT_ID=$CI_OS_PROJECT_ID
export OS_PROJECT_NAME=$CI_OS_PROJECT_NAME
export OS_USER_DOMAIN_NAME=$CI_OS_USER_DOMAIN_NAME
export OS_USERNAME=$CI_OS_USERNAME
export OS_PASSWORD=$CI_OS_PASSWORD
export OS_REGION_NAME=$CI_OS_REGION_NAME
export OS_INTERFACE=$CI_OS_INTERFACE
export OS_IDENTITY_API_VERSION=$CI_OS_IDENTITY_API_VERSION
echo "OpenStack configured as:"
echo "OS_AUTH_URL $OS_AUTH_URL"
echo "OS_PROJECT_ID $OS_PROJECT_ID"
echo "OS_PROJECT_NAME $OS_PROJECT_NAME"
echo "OS_USER_DOMAIN_NAME $OS_USER_DOMAIN_NAME"
echo "OS_USERNAME $OS_USERNAME"
echo "OS_PASSWORD $OS_PASSWORD"
echo "OS_REGION_NAME $OS_REGION_NAME"
echo "OS_INTERFACE $OS_INTERFACE"
echo "OS_IDENTITY_API_VERSION $OS_IDENTITY_API_VERSION"
CLUSTER_NAME=test-cluster-$(openssl rand -hex 2)
echo "Creating cluster $CLUSTER_NAME..."
openstack coe cluster create \
--cluster-template kubernetes-1.30.2-1 \
--node-count 1 \
--flavor m2.medium \
--merge-labels \
--labels eos_enabled=false \
--labels cern_enabled=false \
$CLUSTER_NAME
sleep 10
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
while [ "${STATUS}" != "CREATE_COMPLETE" ] && [ "${STATUS}" != "CREATE_FAILED" ]
do
STATUS=$(openstack coe cluster show $CLUSTER_NAME -c status -f value)
echo "Current cluster status ... $STATUS $(date)"
sleep 10
done
echo "Cluster $CLUSTER_NAME CREATED. Configuring credentials."
openstack coe cluster config --force $CLUSTER_NAME 2> /dev/null || true
echo "Exporting Kubeconfig..."
export KUBECONFIG=$(pwd)/config
echo "Installing and testing helm chart"
LOCAL_VERSION=$(cat Chart.yaml | yq -r .version)
kubectl delete -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/bundle.yaml || true
helm dependency update
sed -i "s/^version:.*/version: ${CI_COMMIT_TAG}/" Chart.yaml
helm package .
ls -all
helm install cern-it-kubernetes-monitoring-crds https://gitlab.cern.ch/monitoring/helm-charts/kubernetes-monitoring-crds/-/archive/v0.1.0/kubernetes-monitoring-crds-v0.1.0.tar.gz -n monitoring --create-namespace
helm install cern-it-kubernetes-monitoring ./cern-it-kubernetes-monitoring-$LOCAL_VERSION.tgz -f values.yaml -n monitoring --create-namespace
helm test --logs cern-it-kubernetes-monitoring -n monitoring
echo "Deleting temporal cluster."
openstack coe cluster delete $CLUSTER_NAME
echo $REGISTRY_PASSWORD | helm registry login https://registry.cern.ch/v2/ -u $REGISTRY_USER --password-stdin
helm push cern-it-monitoring-kubernetes-$CI_COMMIT_TAG.tgz oci://registry.cern.ch/monit
This diff is collapsed.
Click to expand it.
Chart.yaml
+
2
−
2
View file @
8f534f3d
apiVersion
:
v2
name
:
cern-it-kubernetes-monitoring
name
:
cern-it-monitoring-kubernetes
version
:
0.0.0
# DO NOT UPDATE MANUALLY!
type
:
application
version
:
0.2.0
kubeVersion
:
"
>=1.27.0-0"
description
:
Helm Chart provided by IT Monitoring Service to install and configure required components to gather and send monitoring data from kubernetes clusters to central service.
home
:
https://cern.ch/monitoring
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment