Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c691be3a
Commit
c691be3a
authored
Nov 06, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch field types to PodSelector and NamespaceSelector
parent
bcdff4f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
describe.go
pkg/printers/internalversion/describe.go
+5
-5
describe_test.go
pkg/printers/internalversion/describe_test.go
+7
-7
No files found.
pkg/printers/internalversion/describe.go
View file @
c691be3a
...
...
@@ -3106,7 +3106,7 @@ func describeNetworkPolicy(networkPolicy *networking.NetworkPolicy) (string, err
func
describeNetworkPolicySpec
(
nps
networking
.
NetworkPolicySpec
,
w
PrefixWriter
)
{
w
.
Write
(
LEVEL_0
,
"Spec:
\n
"
)
w
.
Write
(
LEVEL_1
,
"Pod
Selector: "
)
w
.
Write
(
LEVEL_1
,
"PodSelector: "
)
if
len
(
nps
.
PodSelector
.
MatchLabels
)
==
0
&&
len
(
nps
.
PodSelector
.
MatchExpressions
)
==
0
{
w
.
Write
(
LEVEL_2
,
"<none> (Allowing the specific traffic to all pods in this namespace)
\n
"
)
}
else
{
...
...
@@ -3144,9 +3144,9 @@ func printNetworkPolicySpecIngressFrom(npirs []networking.NetworkPolicyIngressRu
for
_
,
from
:=
range
npir
.
From
{
w
.
Write
(
LEVEL_0
,
"%s"
,
initialIndent
)
if
from
.
PodSelector
!=
nil
{
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"From Pod
Selector"
,
metav1
.
FormatLabelSelector
(
from
.
PodSelector
))
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"From PodSelector"
,
metav1
.
FormatLabelSelector
(
from
.
PodSelector
))
}
else
if
from
.
NamespaceSelector
!=
nil
{
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"From Namespace
Selector"
,
metav1
.
FormatLabelSelector
(
from
.
NamespaceSelector
))
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"From NamespaceSelector"
,
metav1
.
FormatLabelSelector
(
from
.
NamespaceSelector
))
}
else
if
from
.
IPBlock
!=
nil
{
w
.
Write
(
LEVEL_0
,
"From IPBlock:
\n
"
)
w
.
Write
(
LEVEL_0
,
"%s%sCIDR: %s
\n
"
,
initialIndent
,
initialIndent
,
from
.
IPBlock
.
CIDR
)
...
...
@@ -3185,9 +3185,9 @@ func printNetworkPolicySpecEgressTo(npers []networking.NetworkPolicyEgressRule,
for
_
,
to
:=
range
nper
.
To
{
w
.
Write
(
LEVEL_0
,
"%s"
,
initialIndent
)
if
to
.
PodSelector
!=
nil
{
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"To Pod
Selector"
,
metav1
.
FormatLabelSelector
(
to
.
PodSelector
))
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"To PodSelector"
,
metav1
.
FormatLabelSelector
(
to
.
PodSelector
))
}
else
if
to
.
NamespaceSelector
!=
nil
{
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"To Namespace
Selector"
,
metav1
.
FormatLabelSelector
(
to
.
NamespaceSelector
))
w
.
Write
(
LEVEL_0
,
"%s: %s
\n
"
,
"To NamespaceSelector"
,
metav1
.
FormatLabelSelector
(
to
.
NamespaceSelector
))
}
else
if
to
.
IPBlock
!=
nil
{
w
.
Write
(
LEVEL_0
,
"To IPBlock:
\n
"
)
w
.
Write
(
LEVEL_0
,
"%s%sCIDR: %s
\n
"
,
initialIndent
,
initialIndent
,
to
.
IPBlock
.
CIDR
)
...
...
pkg/printers/internalversion/describe_test.go
View file @
c691be3a
...
...
@@ -1657,13 +1657,13 @@ Created on: 2017-06-04 21:45:56 -0700 PDT
Labels: <none>
Annotations: <none>
Spec:
Pod
Selector: foo in (bar1,bar2),foo2 notin (bar1,bar2),id1=app1,id2=app2
PodSelector: foo in (bar1,bar2),foo2 notin (bar1,bar2),id1=app1,id2=app2
Allowing ingress traffic:
To Port: 80/TCP
To Port: 82/TCP
From Pod
Selector: id=app2,id2=app3
From Namespace
Selector: id=app2,id2=app3
From Namespace
Selector: foo in (bar1,bar2),id=app2,id2=app3
From PodSelector: id=app2,id2=app3
From NamespaceSelector: id=app2,id2=app3
From NamespaceSelector: foo in (bar1,bar2),id=app2,id2=app3
From IPBlock:
CIDR: 192.168.0.0/16
Except: 192.168.3.0/24, 192.168.4.0/24
...
...
@@ -1673,9 +1673,9 @@ Spec:
Allowing egress traffic:
To Port: 80/TCP
To Port: 82/TCP
To Pod
Selector: id=app2,id2=app3
To Namespace
Selector: id=app2,id2=app3
To Namespace
Selector: foo in (bar1,bar2),id=app2,id2=app3
To PodSelector: id=app2,id2=app3
To NamespaceSelector: id=app2,id2=app3
To NamespaceSelector: foo in (bar1,bar2),id=app2,id2=app3
To IPBlock:
CIDR: 192.168.0.0/16
Except: 192.168.3.0/24, 192.168.4.0/24
...
...
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