@@ -81,7 +81,7 @@ def main():
81
81
action = "store_true" ,
82
82
help = "Do not look for Application resource to determine "
83
83
"what kinds to include. I.e. set owner references for "
84
- "all of the resources in the manifests" )
84
+ "all of the (namespaced) resources in the manifests" )
85
85
args = parser .parse_args ()
86
86
87
87
resources = []
@@ -107,7 +107,6 @@ def main():
107
107
kinds = map (lambda x : x ["kind" ], apps [0 ]["spec" ].get ("componentKinds" , []))
108
108
109
109
excluded_kinds = ["PersistentVolumeClaim" , "Application" ]
110
- excluded_kinds .extend (_CLUSTER_SCOPED_KINDS )
111
110
included_kinds = [kind for kind in kinds if kind not in excluded_kinds ]
112
111
else :
113
112
included_kinds = None
@@ -136,6 +135,12 @@ def dump(outfile, resources, included_kinds, app_name, app_uid,
136
135
app_api_version ):
137
136
to_be_dumped = []
138
137
for resource in resources :
138
+ if resource ["kind" ] in _CLUSTER_SCOPED_KINDS :
139
+ # Cluster-scoped resources cannot be owned by a namespaced resource:
140
+ # https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#owners-and-dependents
141
+ log .info ("Application '{:s}' does not own cluster-scoped '{:s}/{:s}'" ,
142
+ app_name , resource ["kind" ], resource ["metadata" ]["name" ])
143
+ continue
139
144
if included_kinds is None or resource ["kind" ] in included_kinds :
140
145
log .info ("Application '{:s}' owns '{:s}/{:s}'" , app_name ,
141
146
resource ["kind" ], resource ["metadata" ]["name" ])
0 commit comments