Commit afa79d13 authored by charlie ablett's avatar charlie ablett

Merge branch 'add_kind_to_differentiate_policies' into 'master'

Add kind as part of the manifest as a diferentiator

See merge request gitlab-org/gitlab!40165
parents 2e941271 6059216f
---
title: Add 'kind' to differentiate between NetworkPolicy and CiliumNetworkPolicy Kubernetes network manifests
merge_request: 40165
author:
type: changed
......@@ -84,6 +84,11 @@ module Gitlab
egress: egress
}
end
override :kind
def kind
KIND
end
end
end
end
......@@ -6,6 +6,8 @@ module Gitlab
include NetworkPolicyCommon
extend ::Gitlab::Utils::Override
KIND = 'NetworkPolicy'
def initialize(name:, namespace:, selector:, ingress:, labels: nil, creation_timestamp: nil, policy_types: ["Ingress"], egress: nil)
@name = name
@namespace = namespace
......@@ -80,6 +82,11 @@ module Gitlab
egress: egress
}
end
override :kind
def kind
KIND
end
end
end
end
......@@ -57,8 +57,12 @@ module Gitlab
raise NotImplementedError
end
def kind
raise NotImplementedError
end
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
......
......@@ -13,6 +13,7 @@ RSpec.shared_examples 'network policy common specs' do
creation_timestamp: nil,
manifest: YAML.dump(
{
kind: described_class::KIND,
metadata: metadata,
spec: spec
}.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