File tree Expand file tree Collapse file tree 5 files changed +48
-0
lines changed Expand file tree Collapse file tree 5 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,32 @@ jobs:
219219 exit 1
220220 fi
221221
222+ echo "*****VERIFYING CUSTOM LABELS*****"
223+
224+ # Array of resource types to check for custom labels
225+ resource_types=("deployment" "service" "serviceaccount" "configmap")
226+ failed_resources=()
227+
228+ # Loop through each resource type and verify custom labels
229+ for resource_type in "${resource_types[@]}"; do
230+ echo "Checking $resource_type for custom labels..."
231+ labels=$(kubectl get "$resource_type" -l app.kubernetes.io/name=sm-operator -o jsonpath='{.items[0].metadata.labels}')
232+ echo "$resource_type labels: $labels"
233+
234+ if ! echo "$labels" | grep -q "test-label"; then
235+ echo "::error::Custom label 'test-label' not found on $resource_type."
236+ failed_resources+=("$resource_type")
237+ fi
238+ done
239+
240+ # Exit if any resources failed the check
241+ if [ ${#failed_resources[@]} -gt 0 ]; then
242+ echo "::error::Custom labels verification failed for: ${failed_resources[*]}"
243+ exit 1
244+ fi
245+
246+ echo "Custom labels verified successfully on all resources!"
247+
222248 echo "*****CREATING AUTH SECRET*****"
223249 kubectl create secret generic bw-auth-token -n bitwarden --from-literal=token="$AUTH_TOKEN"
224250 echo "*****CREATING BW SECRET*****"
Original file line number Diff line number Diff line change 1+ # Custom labels to be applied to all resources created by the operator
2+ # These labels are used in CI testing to verify the custom label feature works correctly
3+ commonLabels :
4+ test-label : test-value
5+
16settings :
27 # How often the secrets synchronize in seconds. Minimum value is 180.
38 bwSecretsManagerRefreshInterval : 300
Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ helm.sh/chart: {{ include "sm-operator.chart" . }}
4040app.kubernetes.io/version: { { .Chart.AppVersion | quote } }
4141{ {- end } }
4242app.kubernetes.io/managed-by: { { .Release.Service } }
43+ { {- with .Values.commonLabels } }
44+ { { toYaml . } }
45+ { {- end } }
4346{ {- end } }
4447
4548{ {/*
Original file line number Diff line number Diff line change 11{
22 "$schema" : " http://json-schema.org/draft-07/schema" ,
33 "properties" : {
4+ "commonLabels" : {
5+ "type" : " object" ,
6+ "additionalProperties" : {
7+ "type" : " string"
8+ },
9+ "default" : {}
10+ },
411 "containers" : {
512 "properties" : {
613 "manager" : {
Original file line number Diff line number Diff line change @@ -14,6 +14,13 @@ settings:
1414 # The number of operator pod replicas to run. When in doubt, leave at 1
1515 replicas : 1
1616
17+ # Optional: Custom labels to be applied to all resources created by the operator
18+ # This can be used to identify the Bitwarden Secrets Manager project or for any other labeling needs
19+ # Example:
20+ # commonLabels:
21+ # custom-label: custom-label-value
22+ commonLabels : {}
23+
1724# Settings specific to the pod containers
1825containers :
1926 manager :
You can’t perform that action at this time.
0 commit comments