Skip to content

Commit d6171ac

Browse files
authored
Merge pull request #40 from tssurya/fix-crd-installation
Fix CRD installation
2 parents a8b6ab8 + 5f526d6 commit d6171ac

7 files changed

+31
-26
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ If your repo has certain guidelines for contribution, put them here ahead of the
1616
- [Kubernetes Contributor Guide](https://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](https://git.k8s.io/community/contributors/guide#contributing)
1717
- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet) - Common resources for existing developers
1818

19+
### Installing the Admin Network Policy CRD
20+
21+
1) Clone the repo: `git clone https://github.com/kubernetes-sigs/network-policy-api.git`
22+
2) Run `cd network-policy-api` && `make install`
23+
1924
## Mentorship
2025

2126
- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!

apis/v1alpha1/shared_types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ type AdminNetworkPolicyPort struct {
6767
type Port struct {
6868
// Protocol is the network protocol (TCP, UDP, or SCTP) which traffic must
6969
// match. If not specified, this field defaults to TCP.
70-
// +kubebuilder:default=TCP
7170
Protocol v1.Protocol `json:"protocol"`
7271

7372
// Number defines a network port value.
@@ -81,7 +80,6 @@ type Port struct {
8180
type PortRange struct {
8281
// Protocol is the network protocol (TCP, UDP, or SCTP) which traffic must
8382
// match. If not specified, this field defaults to TCP.
84-
// +kubebuilder:default=TCP
8583
Protocol v1.Protocol `json:"protocol,omitempty"`
8684

8785
// Start defines a network port that is the start of a port range, the Start

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ spec:
8888
minimum: 1
8989
type: integer
9090
protocol:
91-
allOf:
92-
- default: TCP
93-
- default: TCP
91+
default: TCP
9492
description: Protocol is the network protocol (TCP,
9593
UDP, or SCTP) which traffic must match. If not specified,
9694
this field defaults to TCP.
@@ -112,9 +110,7 @@ spec:
112110
minimum: 1
113111
type: integer
114112
protocol:
115-
allOf:
116-
- default: TCP
117-
- default: TCP
113+
default: TCP
118114
description: Protocol is the network protocol (TCP,
119115
UDP, or SCTP) which traffic must match. If not specified,
120116
this field defaults to TCP.
@@ -699,9 +695,7 @@ spec:
699695
minimum: 1
700696
type: integer
701697
protocol:
702-
allOf:
703-
- default: TCP
704-
- default: TCP
698+
default: TCP
705699
description: Protocol is the network protocol (TCP,
706700
UDP, or SCTP) which traffic must match. If not specified,
707701
this field defaults to TCP.
@@ -723,9 +717,7 @@ spec:
723717
minimum: 1
724718
type: integer
725719
protocol:
726-
allOf:
727-
- default: TCP
728-
- default: TCP
720+
default: TCP
729721
description: Protocol is the network protocol (TCP,
730722
UDP, or SCTP) which traffic must match. If not specified,
731723
this field defaults to TCP.

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ spec:
8585
minimum: 1
8686
type: integer
8787
protocol:
88-
allOf:
89-
- default: TCP
90-
- default: TCP
88+
default: TCP
9189
description: Protocol is the network protocol (TCP,
9290
UDP, or SCTP) which traffic must match. If not specified,
9391
this field defaults to TCP.
@@ -109,9 +107,7 @@ spec:
109107
minimum: 1
110108
type: integer
111109
protocol:
112-
allOf:
113-
- default: TCP
114-
- default: TCP
110+
default: TCP
115111
description: Protocol is the network protocol (TCP,
116112
UDP, or SCTP) which traffic must match. If not specified,
117113
this field defaults to TCP.
@@ -691,9 +687,7 @@ spec:
691687
minimum: 1
692688
type: integer
693689
protocol:
694-
allOf:
695-
- default: TCP
696-
- default: TCP
690+
default: TCP
697691
description: Protocol is the network protocol (TCP,
698692
UDP, or SCTP) which traffic must match. If not specified,
699693
this field defaults to TCP.
@@ -715,9 +709,7 @@ spec:
715709
minimum: 1
716710
type: integer
717711
protocol:
718-
allOf:
719-
- default: TCP
720-
- default: TCP
712+
default: TCP
721713
description: Protocol is the network protocol (TCP,
722714
UDP, or SCTP) which traffic must match. If not specified,
723715
this field defaults to TCP.

config/crd/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ patchesStrategicMerge:
1717
#- patches/cainjection_in_adminnetworkpolicies.yaml
1818
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
1919

20+
# [API-APPROVED] To enable the CRD, we need to patch the api-approved annotation
21+
- patches/apiapproved_annotation_in_baselineadminnetworkpolicies.yaml
22+
- patches/apiapproved_annotation_in_adminnetworkpolicies.yaml
23+
2024
# the following config is for teaching kustomize how to do kustomization for CRDs.
2125
configurations:
2226
- kustomizeconfig.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following patch adds the api-approved annotation to the CRD. See https://github.com/kubernetes/enhancements/pull/1111
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
api-approved.kubernetes.io: "https://github.com/kubernetes/enhancements/pull/2522"
7+
name: adminnetworkpolicies.policy.networking.k8s.io
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following patch adds the api-approved annotation to the CRD. See https://github.com/kubernetes/enhancements/pull/1111
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
api-approved.kubernetes.io: "https://github.com/kubernetes/enhancements/pull/2522"
7+
name: baselineadminnetworkpolicies.policy.networking.k8s.io

0 commit comments

Comments
 (0)