Skip to content

Commit 0b58f1f

Browse files
authored
Fix invalid kubebuilder code gen markers (#734)
* Fix invalid kubebuilder code gen markers * Remove redundant optional markers (#735)
1 parent 36b1193 commit 0b58f1f

File tree

9 files changed

+14
-41
lines changed

9 files changed

+14
-41
lines changed

api/bindings/v1alpha1/boundendpoint_types.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,26 @@ type BoundEndpointSpec struct {
6464
type BoundEndpointStatus struct {
6565
// Endpoints is the list of ngrok API endpoint references bound to this BoundEndpoint
6666
// All endpoints share the same underlying Kubernetes services
67-
// +kubebuilder:validation:Optional
6867
Endpoints []BindingEndpoint `json:"endpoints,omitempty"`
6968

7069
// HashName is the hashed output of the TargetService and TargetNamespace for unique identification
71-
// +kubebuilder:validation:Optional
7270
HashedName string `json:"hashedName,omitempty"`
7371

7472
// EndpointsSummary provides a human-readable count of bound endpoints
7573
// Format: "N endpoint" or "N endpoints"
7674
// Examples: "1 endpoint", "2 endpoints"
77-
// +kubebuilder:validation:Optional
7875
EndpointsSummary string `json:"endpointsSummary,omitempty"`
7976

8077
// Conditions represent the latest available observations of the BoundEndpoint's state
81-
// +kubebuilder:validation:Optional
8278
// +listType=map
8379
// +listMapKey=type
8480
// +kubebuilder:validation:MaxItems=8
8581
Conditions []metav1.Condition `json:"conditions,omitempty"`
8682

8783
// TargetServiceRef references the created ExternalName Service in the target namespace
88-
// +kubebuilder:validation:Optional
8984
TargetServiceRef *ngrokv1alpha1.K8sObjectRefOptionalNamespace `json:"targetServiceRef,omitempty"`
9085

9186
// UpstreamServiceRef references the created ClusterIP Service pointing to pod forwarders
92-
// +kubebuilder:validation:Optional
9387
UpstreamServiceRef *ngrokv1alpha1.K8sObjectRef `json:"upstreamServiceRef,omitempty"`
9488
}
9589

@@ -114,7 +108,6 @@ type EndpointTarget struct {
114108
Port int32 `json:"port"`
115109

116110
// Metadata is a subset of metav1.ObjectMeta that is added to the Service
117-
// +kube:validation:Optional
118111
Metadata TargetMetadata `json:"metadata,omitempty"`
119112
}
120113

@@ -125,14 +118,12 @@ type TargetMetadata struct {
125118
// (scope and select) objects. May match selectors of replication controllers
126119
// and services.
127120
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
128-
// +kubebuilder:validation:Optional
129121
Labels map[string]string `json:"labels,omitempty"`
130122

131123
// Annotations is an unstructured key value map stored with a resource that may be
132124
// set by external tools to store and retrieve arbitrary metadata. They are not
133125
// queryable and should be preserved when modifying objects.
134126
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
135-
// +kubebuilder:validation:Optional
136127
Annotations map[string]string `json:"annotations,omitempty"`
137128
}
138129

api/ingress/v1alpha1/domain_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ type DomainSpec struct {
5151
Domain string `json:"domain"`
5252

5353
// Region is the region in which to reserve the domain
54-
// +kubebuilder:validation:Optional
5554
Region string `json:"region,omitempty"`
5655

5756
// DomainReclaimPolicy is the policy to use when the domain is deleted

api/ngrok/v1alpha1/agentendpoint_types.go

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ type EndpointUpstream struct {
8888

8989
// Optionally specify the version of proxy protocol to use if the upstream requires it
9090
//
91-
// +kubebuilder:validation:Optional
9291
// +kubebuilder:validation:Enum=1;2
92+
// +kubebuilder:validation:Optional
9393
ProxyProtocolVersion *commonv1alpha1.ProxyProtocolVersion `json:"proxyProtocolVersion"`
9494
}
9595

@@ -118,8 +118,6 @@ type AgentEndpointSpec struct {
118118

119119
// Allows configuring a TrafficPolicy to be used with this AgentEndpoint
120120
// When configured, the traffic policy is provided inline or as a reference to an NgrokTrafficPolicy resource
121-
//
122-
// +kubebuilder:validation:Optional
123121
TrafficPolicy *TrafficPolicyCfg `json:"trafficPolicy,omitempty"`
124122

125123
// Human-readable description of this agent endpoint
@@ -135,14 +133,11 @@ type AgentEndpointSpec struct {
135133
// List of Binding IDs to associate with the endpoint
136134
// Accepted values are "public", "internal", or "kubernetes"
137135
//
138-
// +kubebuilder:validation:Optional
139136
// +kubebuilder:validation:MaxItems=1
140-
// +kubebuilder:validation:Items=pattern=`^(public|internal|kubernetes)$`
137+
// +kubebuilder:validation:items:Pattern=`^(public|internal|kubernetes)$`
141138
Bindings []string `json:"bindings,omitempty"`
142139

143140
// List of client certificates to present to the upstream when performing a TLS handshake
144-
//
145-
// +kubebuilder:validation:Optional
146141
ClientCertificateRefs []K8sObjectRefOptionalNamespace `json:"clientCertificateRefs,omitempty"`
147142
}
148143

@@ -159,15 +154,12 @@ type TrafficPolicyCfg struct {
159154
// Inline definition of a TrafficPolicy to attach to the agent Endpoint
160155
// The raw JSON-encoded policy that was applied to the ngrok API
161156
//
162-
// +kubebuilder:validation:Optional
163157
// +kubebuilder:validation:Schemaless
164158
// +kubebuilder:pruning:PreserveUnknownFields
165159
// +kubebuilder:validation:Type=object
166160
Inline json.RawMessage `json:"inline,omitempty"`
167161

168162
// Reference to a TrafficPolicy resource to attach to the Agent Endpoint
169-
//
170-
// +kubebuilder:validation:Optional
171163
Reference *K8sObjectRef `json:"targetRef,omitempty"`
172164
}
173165

@@ -182,24 +174,19 @@ func (t *TrafficPolicyCfg) Type() TrafficPolicyCfgType {
182174
type AgentEndpointStatus struct {
183175
// The assigned URL. This will either be the user-supplied url, or the generated assigned url
184176
// depending on the configuration of spec.url
185-
//
186-
// +kubebuilder:validation:Optional
187177
AssignedURL string `json:"assignedURL,omitempty"`
188178

189179
// Identifies any traffic policies attached to the AgentEndpoint ("inline", "none", or reference name).
190-
//
191-
// +kubebuilder:validation:Optional
192180
AttachedTrafficPolicy string `json:"trafficPolicy,omitempty"`
193181

194182
// DomainRef is a reference to the Domain resource associated with this endpoint.
195183
// For internal endpoints, this will be nil.
196184
// +kubebuilder:validation:Optional
197-
// +kubebuilder:validation:Nullable
185+
// +nullable
198186
DomainRef *K8sObjectRefOptionalNamespace `json:"domainRef"`
199187

200188
// Conditions describe the current conditions of the AgentEndpoint.
201189
//
202-
// +kubebuilder:validation:Optional
203190
// +listType=map
204191
// +listMapKey=type
205192
// +kubebuilder:validation:MaxItems=8

api/ngrok/v1alpha1/cloudendpoint_types.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ type CloudEndpointSpec struct {
4747
URL string `json:"url"`
4848

4949
// Reference to the TrafficPolicy resource to attach to the Cloud Endpoint
50-
//
51-
// +kubebuilder:validation:Optional
5250
TrafficPolicyName string `json:"trafficPolicyName,omitempty"`
5351

5452
// Controls whether or not the Cloud Endpoint should allow pooling with other
@@ -60,8 +58,6 @@ type CloudEndpointSpec struct {
6058
PoolingEnabled bool `json:"poolingEnabled"`
6159

6260
// Allows inline definition of a TrafficPolicy object
63-
//
64-
// +kubebuilder:validation:Optional
6561
TrafficPolicy *NgrokTrafficPolicySpec `json:"trafficPolicy,omitempty"`
6662

6763
// Human-readable description of this cloud endpoint
@@ -77,9 +73,8 @@ type CloudEndpointSpec struct {
7773
// Bindings is the list of Binding IDs to associate with the endpoint
7874
// Accepted values are "public", "internal", or "kubernetes"
7975
//
80-
// +kubebuilder:validation:Optional
8176
// +kubebuilder:validation:MaxItems=1
82-
// +kubebuilder:validation:Items=pattern=`^(public|internal|kubernetes)$`
77+
// +kubebuilder:validation:items:Pattern=`^(public|internal|kubernetes)$`
8378
Bindings []string `json:"bindings,omitempty"`
8479
}
8580

@@ -91,12 +86,11 @@ type CloudEndpointStatus struct {
9186
// DomainRef is a reference to the Domain resource associated with this endpoint.
9287
// For internal endpoints, this will be nil.
9388
// +kubebuilder:validation:Optional
94-
// +kubebuilder:validation:Nullable
89+
// +nullable
9590
DomainRef *K8sObjectRefOptionalNamespace `json:"domainRef"`
9691

9792
// Conditions describe the current conditions of the AgentEndpoint.
9893
//
99-
// +kubebuilder:validation:Optional
10094
// +listType=map
10195
// +listMapKey=type
10296
// +kubebuilder:validation:MaxItems=8

api/ngrok/v1alpha1/common_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type K8sObjectRefOptionalNamespace struct {
4343
Name string `json:"name"`
4444

4545
// The namespace of the Kubernetes resource being referenced
46-
// +kubebuilder:validation:Optional
4746
Namespace *string `json:"namespace,omitempty"`
4847
}
4948

api/ngrok/v1alpha1/kubernetesoperator_types.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type KubernetesOperatorBinding struct {
4646
EndpointSelectors []string `json:"endpointSelectors,omitempty"`
4747

4848
// The public ingress endpoint for this Kubernetes Operator
49-
// +kubebuilder:validation:Optional
5049
IngressEndpoint *string `json:"ingressEndpoint,omitempty"`
5150

5251
// TlsSecretName is the name of the k8s secret that contains the TLS private/public keys to use for the ngrok forwarding endpoint
@@ -64,22 +63,19 @@ type KubernetesOperatorStatus struct {
6463
URI string `json:"uri,omitempty"`
6564

6665
// RegistrationStatus is the status of the registration of this Kubernetes Operator with the ngrok API
67-
// +kube:validation:Enum=registered;error;pending
66+
// +kubebuilder:validation:Enum=registered;error;pending
6867
// +kubebuilder:default="pending"
6968
RegistrationStatus string `json:"registrationStatus,omitempty"`
7069

7170
// RegistrationErrorCode is the returned ngrok error code
72-
// +kube:validation:Optional
7371
// +kubebuilder:validation:Pattern=`^ERR_NGROK_\d+$`
7472
RegistrationErrorCode string `json:"registrationErrorCode,omitempty"`
7573

7674
// RegistrationErrorMessage is a free-form error message if the status is error
77-
// +kubebuilder:validation:Optional
7875
// +kubebuilder:validation:MaxLength=4096
7976
RegistrationErrorMessage string `json:"errorMessage,omitempty"`
8077

8178
// EnabledFeatures is the string representation of the features enabled for this Kubernetes Operator
82-
// +kubebuilder:validation:Optional
8379
EnabledFeatures string `json:"enabledFeatures,omitempty"`
8480

8581
// BindingsIngressEndpoint is the URL that the operator will use to talk
@@ -112,7 +108,6 @@ type KubernetesOperatorSpec struct {
112108
Metadata string `json:"metadata,omitempty"`
113109

114110
// Features enabled for this Kubernetes Operator
115-
// +kubebuilder:validation:Optional
116111
// +kubebuilder:validation:items:Enum=ingress;gateway;bindings
117112
EnabledFeatures []string `json:"enabledFeatures,omitempty"`
118113

helm/ngrok-crds/templates/ngrok.k8s.ngrok.com_agentendpoints.yaml

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

helm/ngrok-crds/templates/ngrok.k8s.ngrok.com_cloudendpoints.yaml

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

helm/ngrok-crds/templates/ngrok.k8s.ngrok.com_kubernetesoperators.yaml

Lines changed: 4 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)