
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 changes. Test Plan: PASS: build-pkgs -c -p metrics-server-helm/stx-metrics-server-helm PASS: upload/apply/remove/delete/update metrics-server. PASS: Install metrics-server 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: Use 'system application-apply metrics-server' when there is a change to be applied to 'app.starlingx.component' and verify if the pod is restarted. 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. Story: 2010612 Task: 49098 Change-Id: I9c732fface93ba426b1a1f0421aefaf8a7a10f0a Signed-off-by: David Barbosa Bastos <david.barbosabastos@windriver.com>
130 lines
3.7 KiB
Diff
130 lines
3.7 KiB
Diff
From 84565d75db7481edd3c27a29c010afb4fb688b4c Mon Sep 17 00:00:00 2001
|
|
From: Luiz Felipe Kina <LuizFelipe.EiskeKina@windriver.com>
|
|
Date: Thu, 21 Sep 2023 15:24:19 -0300
|
|
Subject: [PATCH 1/2] Add sample app to metrics-server
|
|
|
|
---
|
|
templates/sample-app-cluster-role-binding.yml | 16 ++++++++++++
|
|
templates/sample-app-cluster-role.yml | 17 +++++++++++++
|
|
templates/sample-app-deployment.yml | 25 +++++++++++++++++++
|
|
templates/sample-app-service-account.yml | 9 +++++++
|
|
values.yaml | 9 +++++++
|
|
5 files changed, 76 insertions(+)
|
|
create mode 100644 templates/sample-app-cluster-role-binding.yml
|
|
create mode 100644 templates/sample-app-cluster-role.yml
|
|
create mode 100644 templates/sample-app-deployment.yml
|
|
create mode 100644 templates/sample-app-service-account.yml
|
|
|
|
diff --git a/templates/sample-app-cluster-role-binding.yml b/templates/sample-app-cluster-role-binding.yml
|
|
new file mode 100644
|
|
index 0000000..cffc2f1
|
|
--- /dev/null
|
|
+++ b/templates/sample-app-cluster-role-binding.yml
|
|
@@ -0,0 +1,16 @@
|
|
+{{- if .Values.sampleApp.create -}}
|
|
+apiVersion: rbac.authorization.k8s.io/v1
|
|
+kind: ClusterRoleBinding
|
|
+metadata:
|
|
+ labels:
|
|
+ app: metric-server-test-app
|
|
+ name: access-metrics-api
|
|
+roleRef:
|
|
+ apiGroup: rbac.authorization.k8s.io
|
|
+ kind: ClusterRole
|
|
+ name: access-metrics-api
|
|
+subjects:
|
|
+- kind: ServiceAccount
|
|
+ name: metric-server-test-app
|
|
+ namespace: metrics-server
|
|
+{{- end }}
|
|
diff --git a/templates/sample-app-cluster-role.yml b/templates/sample-app-cluster-role.yml
|
|
new file mode 100644
|
|
index 0000000..c78fb28
|
|
--- /dev/null
|
|
+++ b/templates/sample-app-cluster-role.yml
|
|
@@ -0,0 +1,17 @@
|
|
+{{- if .Values.sampleApp.create -}}
|
|
+apiVersion: rbac.authorization.k8s.io/v1
|
|
+kind: ClusterRole
|
|
+metadata:
|
|
+ labels:
|
|
+ app: metric-server-test-app
|
|
+ name: access-metrics-api
|
|
+rules:
|
|
+- apiGroups:
|
|
+ - metrics.k8s.io
|
|
+ resources:
|
|
+ - pods
|
|
+ - nodes
|
|
+ verbs:
|
|
+ - get
|
|
+ - list
|
|
+{{- end }}
|
|
\ No newline at end of file
|
|
diff --git a/templates/sample-app-deployment.yml b/templates/sample-app-deployment.yml
|
|
new file mode 100644
|
|
index 0000000..26de1cc
|
|
--- /dev/null
|
|
+++ b/templates/sample-app-deployment.yml
|
|
@@ -0,0 +1,25 @@
|
|
+{{- if .Values.sampleApp.create -}}
|
|
+apiVersion: apps/v1
|
|
+kind: Deployment
|
|
+metadata:
|
|
+ name: metric-server-test-app-deployment
|
|
+ namespace: metrics-server
|
|
+spec:
|
|
+ selector:
|
|
+ matchLabels:
|
|
+ app: metric-server-test-app
|
|
+ replicas: 1
|
|
+ template:
|
|
+ metadata:
|
|
+ labels:
|
|
+ app: metric-server-test-app
|
|
+ spec:
|
|
+ containers:
|
|
+ - name: sample-app
|
|
+ image: {{ printf "%s:%s" .Values.sampleApp.image.repository (.Values.sampleApp.image.tag | default "latest") }}
|
|
+ imagePullPolicy: IfNotPresent
|
|
+ env:
|
|
+ - name: TOKEN_PATH
|
|
+ value: /var/run/secrets/kubernetes.io/serviceaccount/token
|
|
+ serviceAccountName: metric-server-test-app
|
|
+{{- end -}}
|
|
diff --git a/templates/sample-app-service-account.yml b/templates/sample-app-service-account.yml
|
|
new file mode 100644
|
|
index 0000000..8c799c2
|
|
--- /dev/null
|
|
+++ b/templates/sample-app-service-account.yml
|
|
@@ -0,0 +1,9 @@
|
|
+{{- if .Values.sampleApp.create -}}
|
|
+apiVersion: v1
|
|
+kind: ServiceAccount
|
|
+metadata:
|
|
+ labels:
|
|
+ app: metric-server-test-app
|
|
+ name: metric-server-test-app
|
|
+ namespace: metrics-server
|
|
+{{- end }}
|
|
diff --git a/values.yaml b/values.yaml
|
|
index fba10aa..b31a5fb 100644
|
|
--- a/values.yaml
|
|
+++ b/values.yaml
|
|
@@ -180,3 +180,12 @@ topologySpreadConstraints: []
|
|
deploymentAnnotations: {}
|
|
|
|
schedulerName: ""
|
|
+
|
|
+# If you want to deploy a sample app application to test metrics server
|
|
+# Set the create value to true
|
|
+sampleApp:
|
|
+ create: false
|
|
+ image:
|
|
+ repository: docker.io/starlingx/stx-metrics-server-sample-app
|
|
+ tag: stx.7.0-v1.0.0
|
|
+
|
|
--
|
|
2.34.1
|
|
|