fix(kubernetes): return only valid kinds from UnregisteredCrdCachingAgent.primaryKinds
MODIFY
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/caching/agent/KubernetesUnregisteredCustomResourceCachingAgent.java
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/caching/agent/KubernetesUnregisteredCustomResourceCachingAgent.java
@@ -63,6 +63,8 @@ public class KubernetesUnregisteredCustomResourceCachingAgent extends Kubernetes
@Override
protected List<KubernetesKind> primaryKinds() {
- return credentials.getCrds();
+ return credentials.getCrds().stream()
+ .filter(credentials::isValidKind)
+ .collect(Collectors.toList());
}
}

MODIFY
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/security/KubernetesV2Credentials.java
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/security/KubernetesV2Credentials.java
@@ -385,10 +385,6 @@ public class KubernetesV2Credentials implements KubernetesCredentials {
.map(KubernetesManifest::getName)
.collect(Collectors.toList()), namespaceExpirySeconds, TimeUnit.SECONDS);
- if (checkPermissionsOnStartup) {
- determineOmitKinds();
- }
-
this.liveCrdSupplier = Suppliers.memoizeWithExpiration(() -> {
try {
return this.list(KubernetesKind.CUSTOM_RESOURCE_DEFINITION, "")
@@ -410,6 +406,10 @@ public class KubernetesV2Credentials implements KubernetesCredentials {
// ensure this is called at least once before the credentials object is created to ensure all crds are registered
this.liveCrdSupplier.get();
+
+ if (checkPermissionsOnStartup) {
+ determineOmitKinds();
+ }
}
public List<KubernetesKind> getCrds() {

fix(kubernetes): return only valid kinds from UnregisteredCrdCachingAgent.primaryKinds (#3394)