Commit 6059216f authored by Zamir Martins Filho's avatar Zamir Martins Filho Committed by charlie ablett

Add kind for both NetworkPolicy and

CiliumNetworkPolicy kubernetes resources
parent 82643f14
---
title: Add 'kind' to differentiate between NetworkPolicy and CiliumNetworkPolicy Kubernetes network manifests
merge_request: 40165
author:
type: changed
...@@ -84,6 +84,11 @@ module Gitlab ...@@ -84,6 +84,11 @@ module Gitlab
egress: egress egress: egress
} }
end end
override :kind
def kind
KIND
end
end end
end end
end end
...@@ -6,6 +6,8 @@ module Gitlab ...@@ -6,6 +6,8 @@ module Gitlab
include NetworkPolicyCommon include NetworkPolicyCommon
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
KIND = 'NetworkPolicy'
def initialize(name:, namespace:, selector:, ingress:, labels: nil, creation_timestamp: nil, policy_types: ["Ingress"], egress: nil) def initialize(name:, namespace:, selector:, ingress:, labels: nil, creation_timestamp: nil, policy_types: ["Ingress"], egress: nil)
@name = name @name = name
@namespace = namespace @namespace = namespace
...@@ -80,6 +82,11 @@ module Gitlab ...@@ -80,6 +82,11 @@ module Gitlab
egress: egress egress: egress
} }
end end
override :kind
def kind
KIND
end
end end
end end
end end
...@@ -57,8 +57,12 @@ module Gitlab ...@@ -57,8 +57,12 @@ module Gitlab
raise NotImplementedError raise NotImplementedError
end end
def kind
raise NotImplementedError
end
def manifest def manifest
YAML.dump({ metadata: metadata, spec: spec }.deep_stringify_keys) YAML.dump({ kind: kind, metadata: metadata, spec: spec }.deep_stringify_keys)
end end
end end
end end
......
...@@ -13,6 +13,7 @@ RSpec.shared_examples 'network policy common specs' do ...@@ -13,6 +13,7 @@ RSpec.shared_examples 'network policy common specs' do
creation_timestamp: nil, creation_timestamp: nil,
manifest: YAML.dump( manifest: YAML.dump(
{ {
kind: described_class::KIND,
metadata: metadata, metadata: metadata,
spec: spec spec: spec
}.deep_stringify_keys }.deep_stringify_keys
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment