orange-policeman-59119
08/13/2019, 4:01 PMk8s.scope.resource.get
behave if the resource specified is absent? Is it a fallible operation?
I ask because I would like to deploy an operator in one (shared) place, which defines CRDs.
Then, if and only if the CRDs exist, in other stacks use them to deploy additional components.
Example:
Prometheus Operator chart defines a ServiceMonitor CRD, the service monitor object defines a set of targets to scrape for metrics. Other stacks should deploy ServiceMonitor resources in their namespaces, but only if the CRD exists.best-xylophone-83824
08/13/2019, 4:19 PMorange-policeman-59119
08/13/2019, 4:33 PMgorgeous-egg-16927
08/13/2019, 4:57 PM.get()
operation should fail if the resource doesn’t exist, but doesn’t seem to be the case (it just no-op’d). I’ll check with the team to see if that’s a bugbest-xylophone-83824
08/13/2019, 5:00 PM/api
to get a list of registered apiversions, all installed CRDs are also theregorgeous-egg-16927
08/13/2019, 5:02 PMorange-policeman-59119
08/13/2019, 5:03 PMgorgeous-egg-16927
08/13/2019, 5:03 PMorange-policeman-59119
08/13/2019, 5:04 PMbest-xylophone-83824
08/13/2019, 5:04 PMorange-policeman-59119
08/13/2019, 5:06 PMwhite-balloon-205
Based on the bug report, it looks like the intent is to throw an error if the resource doesn't exist, but the current behavior is my desired behaviorCurious to understand this better. The current behaviour doesn't raise an error - but also doesn't communicate the failure in any generally discoverable way (as well as violating the typing that is promised). If this did throw an error, you could
try/catch
it to do your work in cases where it is not available. Would that accomplish your needs?orange-policeman-59119
08/13/2019, 5:27 PMwhite-balloon-205
| undefined
- but I think the ergonomics of that are actually possible more awkward for normal usage?orange-policeman-59119
08/13/2019, 5:29 PM| undefined
. Also, is the .get
call synchronous? I'm not sure how that works