Add platform label to NFD application pods or namespace
Add support to 'app.starlingx.io/component' to be overwritten by user override, with possible values being 'platform' and 'application'. With 'platform' being the default value. This change will also restart the pods if the label in namespace change. Also, the opportunity was taken to restructure the helm folders following a new standard: - Provide a top level hierarchy for helm charts to differentiate between upstream and custom charts: helm-charts/{custom,upstream} - stx-APP-helm now contains only manifests and final application packaging rules. No custom helm charts should be delivered here. - Use StarlingX debian git revcount packaging mechanisms to derive the semver BUILD version for upstream helm charts which maintains the upstream chart version and adds a versioned BUILD extension. <version core> ::= <major> "." <minor> "." <patch> <valid semver> ::= <version core> "+" <build> Chart version (MAJOR.MINOR.PATCH+STX.REV) is passed to 'helm package' command to force the version, where REV == 'git revcount' - Update 'stx-node-feature-discovery' to: - Update the build dependencies to include the new helm chart package and remove dependency on helm - Update the rules to remove building the node-feature-discovery chart and automatically update the chart versions in the fluxCD helmrelease.yaml files. Additional changes and cleanup: - Remove 'helm dep' commands from chart Makefile as no chart dependencies are present - Fix formatting in 'node-feature-discovery-helm' and 'stx-node-feature-discovery' changelogs to avoid dpkg-genchanges errors. Test Plan: PASS: build-pkgs -c -p node-feature-discovery-helm PASS: build-pkgs -c -p stx-node-feature-discovery-helm PASS: upload/apply/remove/delete/update node-feature-discovery. PASS: Install node-feature-discovery and check if pods have the label 'app.starlingx.io/component' with the value 'platform'. PASS: Change the value of the isApplicationLabel to true using "system helm-override-update" and check, if after re-applying the app, the label 'app.starlingx.component' changes to application' in the pods. PASS: If "isApplicationLabel" is updated with a value other than true or false, the label on the pods "app.starlingx.io/component" will not change. PASS: Build all packages generating an application tarball verifying all versions on the charts and application make sense. PASS: Introduce temporary chart changes and ensure that the versions increment as expected. Story: 2010612 Task: 49460 Signed-off-by: David Bastos <david.barbosabastos@windriver.com> Change-Id: I8739f2bab77b3a6d273217792321cea32473a8cd
This commit is contained in:
parent
3f3ccf99b1
commit
837aa1b1fc
@ -1,2 +1,3 @@
|
||||
helm-charts/upstream/node-feature-discovery-helm
|
||||
python3-k8sapp-node-feature-discovery
|
||||
stx-node-feature-discovery-helm
|
||||
|
@ -0,0 +1,5 @@
|
||||
node-feature-discovery-helm (0.15-0) unstable; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- David Bastos <david.barbosabastos@windriver.com> Fri, 29 Dec 2023 20:07:42 +0000
|
@ -0,0 +1,15 @@
|
||||
Source: node-feature-discovery-helm
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
helm
|
||||
Standards-Version: 4.5.1
|
||||
Homepage: https://www.starlingx.io
|
||||
|
||||
Package: node-feature-discovery-helm
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}
|
||||
Description: StarlingX Ceph CSI Helm Charts
|
||||
This package contains helm charts for the Ceph CSI application.
|
@ -0,0 +1,41 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: node-feature-discovery-helm
|
||||
Source: https://opendev.org/starlingx/app-node-feature-discovery/
|
||||
|
||||
Files: *
|
||||
Copyright: (c) 2024 Wind River Systems, Inc
|
||||
License: Apache-2
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
On Debian-based systems the full text of the Apache version 2.0 license
|
||||
can be found in `/usr/share/common-licenses/Apache-2.0'.
|
||||
|
||||
# If you want to use GPL v2 or later for the /debian/* files use
|
||||
# the following clauses, or change it to suit. Delete these two lines
|
||||
Files: debian/*
|
||||
Copyright: 2024 Wind River Systems, Inc
|
||||
License: Apache-2
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
On Debian-based systems the full text of the Apache version 2.0 license
|
||||
can be found in `/usr/share/common-licenses/Apache-2.0'.
|
@ -0,0 +1 @@
|
||||
usr/lib/helm/*
|
@ -0,0 +1,104 @@
|
||||
From 32840e40963db71394cd19782188fd8b5fd51624 Mon Sep 17 00:00:00 2001
|
||||
From: David Bastos <david.barbosabastos@windriver.com>
|
||||
Date: Wed, 24 Jan 2024 16:18:20 -0300
|
||||
Subject: [PATCH] Add label platform/application to pods
|
||||
|
||||
Add support to 'app.starlingx.io/component' to be overwritten
|
||||
by user override, with possible values being 'platform' and
|
||||
'application'. With 'platform' being the default value. This
|
||||
change will also restart the pods if the label in namespace
|
||||
change.
|
||||
|
||||
Signed-off-by: David Bastos <david.barbosabastos@windriver.com>
|
||||
---
|
||||
templates/master.yaml | 2 ++
|
||||
templates/nfd-gc.yaml | 2 ++
|
||||
templates/topologyupdater.yaml | 2 ++
|
||||
templates/worker.yaml | 2 ++
|
||||
values.yaml | 2 ++
|
||||
5 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/templates/master.yaml b/templates/master.yaml
|
||||
index 53a291e..5de9904 100644
|
||||
--- a/templates/master.yaml
|
||||
+++ b/templates/master.yaml
|
||||
@@ -21,10 +21,12 @@ spec:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "node-feature-discovery.selectorLabels" . | nindent 8 }}
|
||||
+ app.starlingx.io/component: {{ ternary "application" "platform" .Values.isApplicationLabel}}
|
||||
role: master
|
||||
{{- with .Values.master.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
+ configchecksum: {{ toYaml .Values.isApplicationLabel | sha256sum | trunc 63 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
diff --git a/templates/nfd-gc.yaml b/templates/nfd-gc.yaml
|
||||
index 1e0e123..ccdfa7d 100644
|
||||
--- a/templates/nfd-gc.yaml
|
||||
+++ b/templates/nfd-gc.yaml
|
||||
@@ -21,10 +21,12 @@ spec:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "node-feature-discovery.selectorLabels" . | nindent 8 }}
|
||||
+ app.starlingx.io/component: {{ ternary "application" "platform" .Values.isApplicationLabel}}
|
||||
role: gc
|
||||
{{- with .Values.gc.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
+ configchecksum: {{ toYaml .Values.isApplicationLabel | sha256sum | trunc 63 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "node-feature-discovery.gc.serviceAccountName" . }}
|
||||
diff --git a/templates/topologyupdater.yaml b/templates/topologyupdater.yaml
|
||||
index f51c10e..26f9986 100644
|
||||
--- a/templates/topologyupdater.yaml
|
||||
+++ b/templates/topologyupdater.yaml
|
||||
@@ -20,10 +20,12 @@ spec:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "node-feature-discovery.selectorLabels" . | nindent 8 }}
|
||||
+ app.starlingx.io/component: {{ ternary "application" "platform" .Values.isApplicationLabel}}
|
||||
role: topology-updater
|
||||
{{- with .Values.topologyUpdater.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
+ configchecksum: {{ toYaml .Values.isApplicationLabel | sha256sum | trunc 63 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "node-feature-discovery.topologyUpdater.serviceAccountName" . }}
|
||||
diff --git a/templates/worker.yaml b/templates/worker.yaml
|
||||
index f49f9bd..b827e0a 100644
|
||||
--- a/templates/worker.yaml
|
||||
+++ b/templates/worker.yaml
|
||||
@@ -20,10 +20,12 @@ spec:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "node-feature-discovery.selectorLabels" . | nindent 8 }}
|
||||
+ app.starlingx.io/component: {{ ternary "application" "platform" .Values.isApplicationLabel}}
|
||||
role: worker
|
||||
{{- with .Values.worker.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
+ configchecksum: {{ toYaml .Values.isApplicationLabel | sha256sum | trunc 63 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
diff --git a/values.yaml b/values.yaml
|
||||
index d4919bc..942f641 100644
|
||||
--- a/values.yaml
|
||||
+++ b/values.yaml
|
||||
@@ -6,6 +6,8 @@ image:
|
||||
# tag
|
||||
imagePullSecrets: []
|
||||
|
||||
+isApplicationLabel: false
|
||||
+
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
namespaceOverride: ""
|
||||
--
|
||||
2.34.1
|
||||
|
@ -0,0 +1 @@
|
||||
0001-Add-label-platform-application-to-pods.patch
|
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/make -f
|
||||
# export DH_VERBOSE = 1
|
||||
|
||||
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
|
||||
export PATCH_VERSION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
|
||||
export CHART_BASE_VERSION = "0.15.0"
|
||||
export CHART_VERSION = $(CHART_BASE_VERSION)+STX.$(PATCH_VERSION)
|
||||
|
||||
export ROOT = debian/tmp
|
||||
export APP_FOLDER = $(ROOT)/usr/lib/helm
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
mkdir -p node-feature-discovery/node-feature-discovery
|
||||
mv Makefile node-feature-discovery
|
||||
|
||||
for i in crds templates values.yaml README.md Chart.yaml; do \
|
||||
mv $$i node-feature-discovery/node-feature-discovery; \
|
||||
done
|
||||
|
||||
cd node-feature-discovery && make CHART_VERSION=$(CHART_VERSION) node-feature-discovery
|
||||
|
||||
override_dh_auto_install:
|
||||
# Install the app tar file.
|
||||
install -d -m 755 $(APP_FOLDER)
|
||||
install -p -D -m 755 node-feature-discovery/node-feature-discovery*.tgz $(APP_FOLDER)
|
||||
|
||||
override_dh_auto_test:
|
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
debname: node-feature-discovery-helm
|
||||
debver: 0.15-0
|
||||
dl_path:
|
||||
name: node-feature-discovery-0.15.0.tgz
|
||||
url: https://github.com/kubernetes-sigs/node-feature-discovery/releases/download/v0.15.0/node-feature-discovery-chart-0.15.0.tgz
|
||||
md5sum: 760a9e9f8e3db3706106a03cef0534db
|
||||
src_files:
|
||||
- node-feature-discovery-helm/files/Makefile
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
GITREVCOUNT:
|
||||
BASE_SRCREV: 524479ff99a11c6ab7fab04ba4f672fa5f5f6e61
|
||||
SRC_DIR: ${MY_REPO}/stx/app-node-feature-discovery/helm-charts/upstream/node-feature-discovery-helm
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -9,19 +9,19 @@
|
||||
SHELL := /bin/bash
|
||||
TASK := build
|
||||
|
||||
EXCLUDES := doc tests tools logs tmp
|
||||
CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
|
||||
EXCLUDES := helm-toolkit doc tests tools logs tmp
|
||||
CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
|
||||
|
||||
.PHONY: $(EXCLUDES) $(CHARTS)
|
||||
|
||||
all: $(CHARTS)
|
||||
|
||||
$(CHARTS):
|
||||
@if [ -d $@ ]; then \
|
||||
echo; \
|
||||
echo "===== Processing [$@] chart ====="; \
|
||||
$(MAKE) $(TASK)-$@; \
|
||||
fi
|
||||
@if [ -d $@ ]; then \
|
||||
echo; \
|
||||
echo "===== Processing [$@] chart ====="; \
|
||||
make $(TASK)-$@; \
|
||||
fi
|
||||
|
||||
init-%:
|
||||
if [ -f $*/Makefile ]; then make -C $*; fi
|
||||
@ -30,12 +30,11 @@ lint-%: init-%
|
||||
if [ -d $* ]; then helm lint $*; fi
|
||||
|
||||
build-%: lint-%
|
||||
if [ -d $* ]; then helm package $*; fi
|
||||
if [ -d $* ]; then helm package --version $(CHART_VERSION) $*; fi
|
||||
|
||||
clean:
|
||||
@echo "Clean all build artifacts"
|
||||
rm -f */templates/_partials.tpl */templates/_globals.tpl
|
||||
rm -f *tgz */charts/*tgz */requirements.lock
|
||||
rm -rf */charts */tmpcharts
|
||||
|
||||
%:
|
@ -3,11 +3,11 @@ Section: libs
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
helm,
|
||||
build-info,
|
||||
node-feature-discovery-helm,
|
||||
procps,
|
||||
python3-k8sapp-node-feature-discovery,
|
||||
python3-k8sapp-node-feature-discovery-wheels,
|
||||
build-info
|
||||
Standards-Version: 4.5.1
|
||||
Homepage: https://www.starlingx.io
|
||||
|
||||
@ -16,4 +16,4 @@ Section: libs
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}
|
||||
Description: StarlingX Node Feature Discovery Application FluxCD Helm Charts
|
||||
This package contains Fluxcd helm charts for the node feature discovery application.
|
||||
This package contains FluxCD manifests for the node feature discovery application.
|
||||
|
@ -10,57 +10,54 @@ export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
|
||||
|
||||
export APP_NAME = node-feature-discovery
|
||||
export APP_VERSION = $(RELEASE)-$(REVISION)
|
||||
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
|
||||
export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz
|
||||
export HELM_FOLDER = /usr/lib/helm
|
||||
export HELM_REPO = stx-platform
|
||||
export STAGING_FLUXCD = staging-fluxcd
|
||||
export FLUXCD_NFD_PKG = helm-charts-node-feature-discovery-0.15.0.tar.gz
|
||||
export STAGING = staging
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
|
||||
############
|
||||
# FLUXCD #
|
||||
############
|
||||
mkdir -p fluxcd
|
||||
cd fluxcd ; \
|
||||
mkdir -p $(APP_NAME); \
|
||||
tar xvfz ../$(FLUXCD_NFD_PKG) ; \
|
||||
mv -f helm-charts/* $(APP_NAME)
|
||||
|
||||
# Create the TGZ file.
|
||||
cp files/Makefile fluxcd
|
||||
cd fluxcd && $(MAKE) $(APP_NAME)
|
||||
|
||||
# Setup the staging directory.
|
||||
mkdir -p $(STAGING_FLUXCD)
|
||||
cp files/metadata.yaml $(STAGING_FLUXCD)
|
||||
mkdir -p $(STAGING_FLUXCD)/charts
|
||||
cp fluxcd/*.tgz $(STAGING_FLUXCD)/charts
|
||||
mkdir -p $(STAGING)
|
||||
cp files/metadata.yaml $(STAGING)
|
||||
cp -Rv fluxcd-manifests $(STAGING)
|
||||
mkdir -p $(STAGING)/charts
|
||||
cp /usr/lib/helm/*.tgz $(STAGING)/charts
|
||||
|
||||
# Adjust the helmrelease yamls based on the chart versions
|
||||
for c in $(STAGING)/charts/*; do \
|
||||
chart=$$(basename $$c .tgz); \
|
||||
chart_name=$${chart%-*}; \
|
||||
chart_version=$${chart##*-}; \
|
||||
echo "Found $$chart; name: $$chart_name, version: $$chart_version"; \
|
||||
chart_manifest=$$(find $(STAGING)/fluxcd-manifests -name helmrelease.yaml -exec grep -q $$chart_name {} \; -print); \
|
||||
echo "Updating manifest: $$chart_manifest"; \
|
||||
sed -i "s/REPLACE_HELM_CHART_VERSION/$$chart_version/g" $$chart_manifest; \
|
||||
grep version $$chart_manifest; \
|
||||
done
|
||||
|
||||
# Populate metadata.
|
||||
sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING_FLUXCD)/metadata.yaml
|
||||
sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml
|
||||
sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING_FLUXCD)/metadata.yaml
|
||||
sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING)/metadata.yaml
|
||||
sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING)/metadata.yaml
|
||||
sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING)/metadata.yaml
|
||||
|
||||
# Copy the plugins: installed in the buildroot
|
||||
mkdir -p $(STAGING_FLUXCD)/plugins
|
||||
cp /plugins/*.whl $(STAGING_FLUXCD)/plugins
|
||||
mkdir -p $(STAGING)/plugins
|
||||
cp /plugins/*.whl $(STAGING)/plugins
|
||||
|
||||
cp -R fluxcd-manifests $(STAGING_FLUXCD)/
|
||||
|
||||
# calculate checksum of all files in app_staging
|
||||
cd $(STAGING_FLUXCD) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
|
||||
tar cfz $(APP_TARBALL_FLUXCD) -C $(STAGING_FLUXCD)/ .
|
||||
# Create the app package.
|
||||
cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
|
||||
tar cfz $(APP_TARBALL) -C $(STAGING)/ .
|
||||
|
||||
# Cleanup staging
|
||||
rm -rf $(STAGING_FLUXCD)
|
||||
rm -rf $(STAGING)
|
||||
|
||||
override_dh_auto_install:
|
||||
# Install the app tar file.
|
||||
install -d -m 755 $(APP_FOLDER)
|
||||
install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER)
|
||||
install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER)
|
||||
|
||||
override_dh_auto_test:
|
||||
|
||||
|
@ -2,12 +2,6 @@
|
||||
debname: stx-node-feature-discovery-helm
|
||||
debver: 1.1-0
|
||||
src_path: stx-node-feature-discovery-helm
|
||||
dl_files:
|
||||
helm-charts-node-feature-discovery-0.15.0.tar.gz:
|
||||
topdir: helm-charts
|
||||
url: https://github.com/kubernetes-sigs/node-feature-discovery/releases/download/v0.15.0/node-feature-discovery-chart-0.15.0.tgz
|
||||
md5sum: 760a9e9f8e3db3706106a03cef0534db
|
||||
sha256sum: 8a5a7a2c6fa20723488ebc97d3148f9110b836d0b07eeaa5f47edfd2f1cd9ce0
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
GITREVCOUNT:
|
||||
|
@ -15,7 +15,7 @@ spec:
|
||||
chart:
|
||||
spec:
|
||||
chart: node-feature-discovery
|
||||
version: 0.15.0
|
||||
version: REPLACE_HELM_CHART_VERSION
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: stx-platform
|
||||
|
Loading…
x
Reference in New Issue
Block a user