Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6059216f
Commit
6059216f
authored
Aug 28, 2020
by
Zamir Martins Filho
Committed by
charlie ablett
Aug 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add kind for both NetworkPolicy and
CiliumNetworkPolicy kubernetes resources
parent
82643f14
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
1 deletion
+23
-1
changelogs/unreleased/add_kind_to_differentiate_policies.yml
changelogs/unreleased/add_kind_to_differentiate_policies.yml
+5
-0
lib/gitlab/kubernetes/cilium_network_policy.rb
lib/gitlab/kubernetes/cilium_network_policy.rb
+5
-0
lib/gitlab/kubernetes/network_policy.rb
lib/gitlab/kubernetes/network_policy.rb
+7
-0
lib/gitlab/kubernetes/network_policy_common.rb
lib/gitlab/kubernetes/network_policy_common.rb
+5
-1
spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb
...itlab/kubernetes/network_policy_common_shared_examples.rb
+1
-0
No files found.
changelogs/unreleased/add_kind_to_differentiate_policies.yml
0 → 100644
View file @
6059216f
---
title
:
Add 'kind' to differentiate between NetworkPolicy and CiliumNetworkPolicy Kubernetes network manifests
merge_request
:
40165
author
:
type
:
changed
lib/gitlab/kubernetes/cilium_network_policy.rb
View file @
6059216f
...
@@ -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
lib/gitlab/kubernetes/network_policy.rb
View file @
6059216f
...
@@ -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
lib/gitlab/kubernetes/network_policy_common.rb
View file @
6059216f
...
@@ -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
...
...
spec/support/shared_examples/lib/gitlab/kubernetes/network_policy_common_shared_examples.rb
View file @
6059216f
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment