File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed
Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,10 @@ WorkloadName:
77 metadata :
88 type : object
99 properties :
10- labels :
11- type : object
12- additionalProperties :
13- type : string
14- description : Labels for the workload, including teamId.
1510 name :
1611 type : string
1712 description : Name of the workload.
13+ namespace :
14+ type : string
15+ description : Namespace of the workload, including teamId.
1816 type : object
Original file line number Diff line number Diff line change @@ -1730,14 +1730,15 @@ export default class OtomiStack {
17301730 }
17311731
17321732 getAllWorkloadNames ( ) : WorkloadName [ ] {
1733- const workloads = this . getAllAplWorkloads ( ) . map ( ( workload ) => ( {
1734- metadata : {
1735- name : workload . metadata . name ,
1736- labels : {
1737- 'apl.io/teamId' : workload . metadata . labels [ 'apl.io/teamId' ] ,
1733+ const workloads = this . getAllAplWorkloads ( ) . map ( ( workload ) => {
1734+ const teamId = workload . metadata . labels [ 'apl.io/teamId' ]
1735+ return {
1736+ metadata : {
1737+ name : workload . metadata . name ,
1738+ namespace : teamId ? `team-${ teamId } ` : undefined ,
17381739 } ,
1739- } ,
1740- } ) )
1740+ }
1741+ } )
17411742 return workloads
17421743 }
17431744
@@ -2067,8 +2068,12 @@ export default class OtomiStack {
20672068 pods = res . items
20682069 }
20692070
2071+ const excludedLabels = [ 'helm.sh/chart' , 'app.kubernetes.io/managed-by' ]
2072+ const filteredLabels = Object . fromEntries (
2073+ Object . entries ( pods [ 0 ] ?. metadata ?. labels ?? { } ) . filter ( ( [ key ] ) => ! excludedLabels . includes ( key ) ) ,
2074+ )
20702075 // Return labels of the first matching pod, or empty object
2071- return pods . length > 0 ? ( pods [ 0 ] . metadata ?. labels ?? { } ) : { }
2076+ return pods . length > 0 ? filteredLabels : { }
20722077 }
20732078
20742079 async listUniquePodNamesByLabel ( labelSelector : string , namespace ?: string ) : Promise < string [ ] > {
You can’t perform that action at this time.
0 commit comments