Skip to content

Commit 7be0b2b

Browse files
committed
Add generated clientset, informers and listers
Signed-off-by: Dyanngg <[email protected]>
1 parent c233253 commit 7be0b2b

36 files changed

+2295
-231
lines changed

apis/v1alpha1/adminnetworkpolicy_types.go renamed to apis/policy.networking.k8s.io/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import (
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
)
2525

26-
//+kubebuilder:object:root=true
27-
//+kubebuilder:subresource:status
28-
//+kubebuilder:resource:scope=Cluster
26+
// +genclient
27+
// +kubebuilder:object:root=true
28+
// +kubebuilder:subresource:status
29+
// +kubebuilder:resource:scope=Cluster
30+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2931

3032
// AdminNetworkPolicy is a cluster level resource that is part of the
3133
// AdminNetworkPolicy API.
@@ -176,15 +178,12 @@ const (
176178
AdminNetworkPolicyRuleActionPass AdminNetworkPolicyRuleAction = "Pass"
177179
)
178180

179-
//+kubebuilder:object:root=true
181+
// +kubebuilder:object:root=true
182+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
180183

181184
// AdminNetworkPolicyList contains a list of AdminNetworkPolicy
182185
type AdminNetworkPolicyList struct {
183186
metav1.TypeMeta `json:",inline"`
184187
metav1.ListMeta `json:"metadata,omitempty"`
185188
Items []AdminNetworkPolicy `json:"items"`
186189
}
187-
188-
func init() {
189-
SchemeBuilder.Register(&AdminNetworkPolicy{}, &AdminNetworkPolicyList{})
190-
}

apis/v1alpha1/baselineadminnetworkpolicy_types.go renamed to apis/policy.networking.k8s.io/v1alpha1/baselineadminnetworkpolicy_types.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ import (
1919
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020
)
2121

22-
//+kubebuilder:object:root=true
23-
//+kubebuilder:subresource:status
24-
//+kubebuilder:resource:scope=Cluster
22+
// +genclient
23+
// +kubebuilder:object:root=true
24+
// +kubebuilder:subresource:status
25+
// +kubebuilder:resource:scope=Cluster
26+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2527

2628
// BaselineAdminNetworkPolicy is a cluster level resource that is part of the
2729
// AdminNetworkPolicy API.
@@ -98,7 +100,7 @@ type BaselineAdminNetworkPolicyIngressRule struct {
98100
Ports *[]AdminNetworkPolicyPort `json:"ports,omitempty"`
99101
}
100102

101-
// AdminNetworkPolicyEgressRule describes an action to take on a particular
103+
// BaselineAdminNetworkPolicyEgressRule describes an action to take on a particular
102104
// set of traffic originating from pods selected by a BaselineAdminNetworkPolicy's
103105
// Subject field.
104106
type BaselineAdminNetworkPolicyEgressRule struct {
@@ -142,15 +144,12 @@ const (
142144
BaselineAdminNetworkPolicyRuleActionAllow BaselineAdminNetworkPolicyRuleAction = "Allow"
143145
)
144146

145-
//+kubebuilder:object:root=true
147+
// +kubebuilder:object:root=true
148+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
146149

147150
// BaselineAdminNetworkPolicyList contains a list of BaselineAdminNetworkPolicy
148151
type BaselineAdminNetworkPolicyList struct {
149152
metav1.TypeMeta `json:",inline"`
150153
metav1.ListMeta `json:"metadata,omitempty"`
151154
Items []BaselineAdminNetworkPolicy `json:"items"`
152155
}
153-
154-
func init() {
155-
SchemeBuilder.Register(&BaselineAdminNetworkPolicy{}, &BaselineAdminNetworkPolicyList{})
156-
}
File renamed without changes.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright 2022.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
"k8s.io/apimachinery/pkg/runtime"
22+
"k8s.io/apimachinery/pkg/runtime/schema"
23+
)
24+
25+
var (
26+
// SchemeGroupVersion is group version used to register these objects
27+
SchemeGroupVersion = schema.GroupVersion{Group: "policy.networking.k8s.io", Version: "v1alpha1"}
28+
29+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
30+
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
31+
32+
// AddToScheme adds the types in this group-version to the given scheme.
33+
AddToScheme = SchemeBuilder.AddToScheme
34+
)
35+
36+
func init() {
37+
// We only register manually written functions here. The registration of the
38+
// generated functions takes place in the generated files. The separation
39+
// makes the code compile even when the generated files are missing.
40+
SchemeBuilder.Register(addKnownTypes)
41+
}
42+
43+
// Resource takes an unqualified resource and returns a Group qualified GroupResource
44+
func Resource(resource string) schema.GroupResource {
45+
return SchemeGroupVersion.WithResource(resource).GroupResource()
46+
}
47+
48+
// Adds the list of known types to the given scheme.
49+
func addKnownTypes(scheme *runtime.Scheme) error {
50+
scheme.AddKnownTypes(
51+
SchemeGroupVersion,
52+
&AdminNetworkPolicy{},
53+
&AdminNetworkPolicyList{},
54+
&BaselineAdminNetworkPolicy{},
55+
&BaselineAdminNetworkPolicyList{},
56+
)
57+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
58+
return nil
59+
}

apis/v1alpha1/zz_generated.deepcopy.go renamed to apis/policy.networking.k8s.io/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/clientset/versioned/clientset.go

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/clientset/versioned/doc.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/clientset/versioned/fake/clientset_generated.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/clientset/versioned/fake/doc.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)