Skip to content

Commit 4713a66

Browse files
authored
Merge pull request #77 from tssurya/update-api-approved-annotation
Leverage kubebuilder annotations generator
2 parents a871b0c + 1f9de24 commit 4713a66

12 files changed

+70
-538
lines changed

apis/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
// +kubebuilder:printcolumn:name="Priority",type=string,JSONPath=".spec.priority"
3131
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
3232
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
33+
// +kubebuilder:metadata:annotations="api-approved.kubernetes.io=https://github.com/kubernetes/enhancements/pull/2522"
3334
// AdminNetworkPolicy is a cluster level resource that is part of the
3435
// AdminNetworkPolicy API.
3536
type AdminNetworkPolicy struct {

apis/v1alpha1/baselineadminnetworkpolicy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
// +kubebuilder:resource:shortName=banp,scope=Cluster
2626
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
2727
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
28-
28+
// +kubebuilder:metadata:annotations="api-approved.kubernetes.io=https://github.com/kubernetes/enhancements/pull/2522"
2929
// BaselineAdminNetworkPolicy is a cluster level resource that is part of the
3030
// AdminNetworkPolicy API.
3131
type BaselineAdminNetworkPolicy struct {

bin/golangci-lint

-1.68 MB
Binary file not shown.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.2
6+
api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/2522
7+
controller-gen.kubebuilder.io/version: v0.11.1
78
creationTimestamp: null
89
name: adminnetworkpolicies.policy.networking.k8s.io
910
spec:
@@ -934,8 +935,8 @@ spec:
934935
description: "Condition contains details for one aspect of the current
935936
state of this API Resource. --- This struct is intended for direct
936937
use as an array at the field path .status.conditions. For example,
937-
type FooStatus struct{ // Represents the observations of a foo's
938-
current state. // Known .status.conditions.type are: \"Available\",
938+
\n type FooStatus struct{ // Represents the observations of a
939+
foo's current state. // Known .status.conditions.type are: \"Available\",
939940
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
940941
// +listType=map // +listMapKey=type Conditions []metav1.Condition
941942
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.2
6+
api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/2522
7+
controller-gen.kubebuilder.io/version: v0.11.1
78
creationTimestamp: null
89
name: baselineadminnetworkpolicies.policy.networking.k8s.io
910
spec:
@@ -906,8 +907,8 @@ spec:
906907
description: "Condition contains details for one aspect of the current
907908
state of this API Resource. --- This struct is intended for direct
908909
use as an array at the field path .status.conditions. For example,
909-
type FooStatus struct{ // Represents the observations of a foo's
910-
current state. // Known .status.conditions.type are: \"Available\",
910+
\n type FooStatus struct{ // Represents the observations of a
911+
foo's current state. // Known .status.conditions.type are: \"Available\",
911912
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
912913
// +listType=map // +listMapKey=type Conditions []metav1.Condition
913914
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"

config/crd/kustomization.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@ resources:
66
- bases/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml
77
#+kubebuilder:scaffold:crdkustomizeresource
88

9-
patchesStrategicMerge:
9+
# patchesStrategicMerge:
1010
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1111
# patches here are for enabling the conversion webhook for each CRD
1212
#- patches/webhook_in_adminnetworkpolicies.yaml
1313
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1414

15-
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
16-
# patches here are for enabling the CA injection for each CRD
17-
#- patches/cainjection_in_adminnetworkpolicies.yaml
18-
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
19-
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-
2415
# the following config is for teaching kustomize how to do kustomization for CRDs.
2516
configurations:
2617
- kustomizeconfig.yaml

config/crd/patches/apiapproved_annotation_in_adminnetworkpolicies.yaml

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

config/crd/patches/apiapproved_annotation_in_baselineadminnetworkpolicies.yaml

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

config/crd/patches/cainjection_in_adminnetworkpolicies.yaml

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

config/crd/patches/cainjection_in_baselineadminnetworkpolicies.yaml

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

0 commit comments

Comments
 (0)