Skip to content

Commit

Permalink
fix(kubernetes) : inbound/outbound rules only detected in apiVersion=…
Browse files Browse the repository at this point in the history
…network.k8s.io/v1 (#3684)

* Issue #3173

Fix for inbound/outbound rules only detected in
apiVersion=network.k8s.io/v1

* Fix for Issue 3173

Title: inbound/outbound rules only detected in apiVersion=network.k8s.io/v1
  • Loading branch information
Darshan authored and ezimanyi committed May 17, 2019
1 parent 7e11bc5 commit 97a5f69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.netflix.spinnaker.clouddriver.kubernetes.v2.caching.view.model;

import static com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesApiVersion.NETWORKING_K8S_IO_V1;
import static com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesApiVersion.NETWORKING_K8S_IO_V1BETA1;

import com.netflix.spinnaker.cats.cache.CacheData;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.caching.Keys;
Expand Down Expand Up @@ -90,7 +91,8 @@ public static KubernetesV2SecurityGroup fromCacheData(CacheData cd) {
if (manifest.getKind() != KubernetesKind.NETWORK_POLICY) {
log.warn("Unknown security group kind " + manifest.getKind());
} else {
if (manifest.getApiVersion().equals(NETWORKING_K8S_IO_V1)) {
if (manifest.getApiVersion().equals(NETWORKING_K8S_IO_V1)
|| (manifest.getApiVersion().equals(NETWORKING_K8S_IO_V1BETA1))) {
V1NetworkPolicy v1beta1NetworkPolicy =
KubernetesCacheDataConverter.getResource(manifest, V1NetworkPolicy.class);
inboundRules = inboundRules(v1beta1NetworkPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class KubernetesApiVersion {
new KubernetesApiVersion("extensions/v1beta1");
public static KubernetesApiVersion NETWORKING_K8S_IO_V1 =
new KubernetesApiVersion("network.k8s.io/v1");
public static KubernetesApiVersion NETWORKING_K8S_IO_V1BETA1 =
new KubernetesApiVersion("network.k8s.io/v1beta1");
public static KubernetesApiVersion APPS_V1BETA1 = new KubernetesApiVersion("apps/v1beta1");
public static KubernetesApiVersion APPS_V1BETA2 = new KubernetesApiVersion("apps/v1beta2");
public static KubernetesApiVersion BATCH_V1 = new KubernetesApiVersion("batch/v1");
Expand Down

0 comments on commit 97a5f69

Please sign in to comment.