Skip to content

Commit 4d38b37

Browse files
authored
Merge pull request #307 from npinaeva/npep-285-test
CNP update tests
2 parents 40eeb18 + fe93839 commit 4d38b37

File tree

56 files changed

+670
-4487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+670
-4487
lines changed

.github/workflows/conformance.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
KIND_VERSION: "v0.30.0"
1717
IMAGE_NAME: registry.k8s.io/networking/kube-network-policies
1818
KIND_CLUSTER_NAME: kind
19-
NPAPI_VERSION: "v1alpha1"
19+
NPAPI_VERSION: "v1alpha2"
2020

2121
permissions: write-all
2222

@@ -80,8 +80,7 @@ jobs:
8080
8181
- name: Install network policy APIs
8282
run: |
83-
/usr/local/bin/kubectl apply -f ./config/crd/standard/policy.networking.k8s.io_adminnetworkpolicies.yaml
84-
/usr/local/bin/kubectl apply -f ./config/crd/standard/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml
83+
/usr/local/bin/kubectl apply -f ./config/crd/standard/policy.networking.k8s.io_clusternetworkpolicies.yaml
8584
8685
- name: Install kube-network-policies from main
8786
run: |
@@ -98,8 +97,8 @@ jobs:
9897
# Preload the image in the kind cluster
9998
/usr/local/bin/kind load docker-image registry.k8s.io/networking/kube-network-policies:test-npa-${{ env.NPAPI_VERSION }} --name ${{ env.KIND_CLUSTER_NAME}}
10099
# Install kube-network-policies with the image built from main
101-
sed -i s#registry.k8s.io/networking/kube-network-policies.*#registry.k8s.io/networking/kube-network-policies:test-npa-${{ env.NPAPI_VERSION }}# install-anp.yaml
102-
/usr/local/bin/kubectl apply -f ./install-anp.yaml
100+
sed -i s#registry.k8s.io/networking/kube-network-policies.*#registry.k8s.io/networking/kube-network-policies:test-npa-${{ env.NPAPI_VERSION }}# install-cnp.yaml
101+
/usr/local/bin/kubectl apply -f ./install-cnp.yaml
103102
)
104103
105104
- name: Get Cluster status
@@ -115,7 +114,7 @@ jobs:
115114
run: |
116115
go mod download
117116
REPO_VERSION=$(git describe --always --dirty)
118-
go test -v ./conformance -run TestConformanceProfiles -args --conformance-profiles=AdminNetworkPolicy,BaselineAdminNetworkPolicy --organization=kubernetes --project=kube-network-policies --url=https://github.com/kubernetes-sigs/kube-network-policies --version=${REPO_VERSION} --contact=antonio.ojea.garcia@gmail.com --additional-info=https://github.com/kubernetes-sigs/kube-network-policies
117+
go test -v ./conformance -run TestConformanceProfiles -args --conformance-profiles=ClusterNetworkPolicy --organization=kubernetes --project=kube-network-policies --url=https://github.com/kubernetes-sigs/kube-network-policies --version=${REPO_VERSION} --contact=https://github.com/kubernetes-sigs/kube-network-policies/issues/new --additional-info=https://github.com/kubernetes-sigs/kube-network-policies
119118
120119
- name: Upload Junit Reports
121120
if: always()

config/crd/experimental/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# since it depends on service name and namespace that are out of this kustomize package.
33
# It should be run by config/default
44
resources:
5-
- policy.networking.k8s.io_adminnetworkpolicies.yaml
6-
- policy.networking.k8s.io_baselineadminnetworkpolicies.yaml
5+
- policy.networking.k8s.io_clusternetworkpolicies.yaml
76
#+kubebuilder:scaffold:crdkustomizeresource
87

98
# the following config is for teaching kustomize how to do kustomization for CRDs.

config/crd/experimental/policy.networking.k8s.io_adminnetworkpolicies.yaml

Lines changed: 0 additions & 1033 deletions
This file was deleted.

config/crd/experimental/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml

Lines changed: 0 additions & 970 deletions
This file was deleted.

config/crd/standard/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# since it depends on service name and namespace that are out of this kustomize package.
33
# It should be run by config/default
44
resources:
5-
- policy.networking.k8s.io_adminnetworkpolicies.yaml
6-
- policy.networking.k8s.io_baselineadminnetworkpolicies.yaml
5+
- policy.networking.k8s.io_clusternetworkpolicies.yaml
76
#+kubebuilder:scaffold:crdkustomizeresource
87

98
# the following config is for teaching kustomize how to do kustomization for CRDs.

config/crd/standard/policy.networking.k8s.io_adminnetworkpolicies.yaml

Lines changed: 0 additions & 923 deletions
This file was deleted.

config/crd/standard/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml

Lines changed: 0 additions & 899 deletions
This file was deleted.

conformance/apis/v1alpha1/profilereport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package v1alpha1
2020
// named conformance profile.
2121
type ProfileReport struct {
2222
// Name indicates the name of the conformance profile
23-
// (e.g. "AdminNetworkPolicy", "BaselineAdminNetworkPolicy")
23+
// (e.g. "ClusterNetworkPolicy")
2424
Name string `json:"name"`
2525

2626
// Standard indicates the standard support level which includes the set of tests

conformance/base/admin_network_policy/experimental-egress-selector-rules.yaml renamed to conformance/base/admin_tier/experimental-egress-selector-rules.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
apiVersion: policy.networking.k8s.io/v1alpha1
2-
kind: AdminNetworkPolicy
1+
apiVersion: policy.networking.k8s.io/v1alpha2
2+
kind: ClusterNetworkPolicy
33
metadata:
44
name: node-and-cidr-as-peers-example
55
spec:
6+
tier: Admin
67
priority: 75
78
subject:
89
pods:
@@ -14,7 +15,7 @@ spec:
1415
conformance-house: gryffindor
1516
egress:
1617
- name: "allow-egress-to-36363-on-nodes"
17-
action: "Allow"
18+
action: "Accept"
1819
to:
1920
- nodes:
2021
matchLabels:

conformance/base/admin_network_policy/standard-egress-inline-cidr-rules.yaml renamed to conformance/base/admin_tier/standard-egress-inline-cidr-rules.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
apiVersion: policy.networking.k8s.io/v1alpha1
2-
kind: AdminNetworkPolicy
1+
apiVersion: policy.networking.k8s.io/v1alpha2
2+
kind: ClusterNetworkPolicy
33
metadata:
44
name: inline-cidr-as-peers-example
55
spec:
6+
tier: Admin
67
priority: 85
78
subject:
89
pods:
@@ -15,13 +16,13 @@ spec:
1516
egress:
1617
# CIDR rules that test allow to specific IPs is done within the test by updating the CR
1718
#- name: "allow-egress-to-specific-podIPs"
18-
# action: "Allow"
19+
# action: "Accept"
1920
# to:
2021
# - networks:
2122
# - luna-lovegood-0.IP
2223
# - cedric-diggory-0.IP
2324
- name: "allow-egress-to-slytherin"
24-
action: "Allow"
25+
action: "Accept"
2526
to:
2627
- pods:
2728
namespaceSelector:

0 commit comments

Comments
 (0)