Skip to content

Commit 130bfe5

Browse files
author
Kate Osborn
committed
Add controllerName to status
1 parent bdc6a94 commit 130bfe5

File tree

3 files changed

+160
-81
lines changed

3 files changed

+160
-81
lines changed

apis/v1alpha1/clientsettingspolicy_types.go

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1alpha1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
v1 "sigs.k8s.io/gateway-api/apis/v1"
56
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
67
)
78

@@ -55,13 +56,12 @@ type ClientSettingsPolicySpec struct {
5556

5657
// ClientSettingsPolicyStatus defines the current state of ClientSettingsPolicy.
5758
type ClientSettingsPolicyStatus struct {
58-
// Conditions describe the current conditions of the ClientSettingsPolicy.
59+
// Controllers is a list of Gateway API controllers that are acting on this Policy.
60+
// Each controller that manages the Policy must add an entry to this list when the controller first sees the
61+
// policy and should update the entry as appropriate.
5962
//
60-
// +listType=map
61-
// +listMapKey=type
62-
// +kubebuilder:validation:MinItems=1
63-
// +kubebuilder:validation:MaxItems=8
64-
Conditions []metav1.Condition `json:"conditions,omitempty"`
63+
// +kubebuilder:validation:MaxItems=32
64+
Controllers []ControllerStatus `json:"controllers,omitempty"`
6565
}
6666

6767
// ClientBody contains the settings for the client request body.
@@ -138,3 +138,25 @@ type Duration string
138138
//
139139
// +kubebuilder:validation:Pattern=`^\d{1,4}(k|m|g)?$`
140140
type Size string
141+
142+
// ControllerStatus describes the status of a Policy with respect to a Gateway API Controller.
143+
type ControllerStatus struct {
144+
// ControllerName is a domain/path string that indicates the name of the
145+
// controller that wrote this status. This corresponds with the
146+
// controllerName field on GatewayClass.
147+
//
148+
// Example: "gateway.nginx.org/nginx-gateway-controller".
149+
//
150+
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
151+
// valid Kubernetes names
152+
// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
153+
ControllerName v1.GatewayController `json:"controllerName"`
154+
155+
// Conditions describe the current conditions of the object.
156+
//
157+
// +listType=map
158+
// +listMapKey=type
159+
// +kubebuilder:validation:MinItems=1
160+
// +kubebuilder:validation:MaxItems=8
161+
Conditions []metav1.Condition `json:"conditions,omitempty"`
162+
}

apis/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/gateway.nginx.org_clientsettingspolicies.yaml

Lines changed: 107 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ spec:
6161
the 413 (Request Entity Too Large) error is returned to the client.
6262
Setting size to 0 disables checking of client request body size.
6363
Default: 1m.
64-
pattern: ^\d+(k|m|g)?$
64+
pattern: ^\d{1,4}(k|m|g)?$
6565
type: string
6666
timeout:
6767
description: |-
@@ -70,7 +70,7 @@ spec:
7070
If a client does not transmit anything within this time, the request is terminated with the
7171
408 (Request Time-out) error.
7272
Default: 60s.
73-
pattern: ^\d+(ms|s|m|h|d)?$
73+
pattern: ^\d{1,4}(ms|s)?$
7474
type: string
7575
type: object
7676
keepAlive:
@@ -91,22 +91,22 @@ spec:
9191
Time defines the maximum time during which requests can be processed through one keep-alive connection.
9292
After this time is reached, the connection is closed following the subsequent request processing.
9393
Default: 1h.
94-
pattern: ^\d+(ms|s|m|h|d)?$
94+
pattern: ^\d{1,4}(ms|s)?$
9595
type: string
9696
timeout:
9797
description: Timeout defines the keep-alive timeouts for clients.
9898
properties:
9999
header:
100100
description: 'Header sets the timeout in the "Keep-Alive:
101101
timeout=time" response header field.'
102-
pattern: ^\d+(ms|s|m|h|d)?$
102+
pattern: ^\d{1,4}(ms|s)?$
103103
type: string
104104
server:
105105
description: |-
106106
Server sets the timeout during which a keep-alive client connection will stay open on the server side.
107107
Setting this value to 0 disables keep-alive client connections.
108108
Default: 75s.
109-
pattern: ^\d+(ms|s|m|h|d)?$
109+
pattern: ^\d{1,4}(ms|s)?$
110110
type: string
111111
type: object
112112
type: object
@@ -155,81 +155,116 @@ spec:
155155
status:
156156
description: Status defines the state of the ClientSettingsPolicy.
157157
properties:
158-
conditions:
159-
description: Conditions describe the current conditions of the ClientSettingsPolicy.
158+
controllers:
159+
description: |-
160+
Controllers is a list of Gateway API controllers that are acting on this Policy.
161+
Each controller that manages the Policy must add an entry to this list when the controller first sees the
162+
policy and should update the entry as appropriate.
160163
items:
161-
description: "Condition contains details for one aspect of the current
162-
state of this API Resource.\n---\nThis struct is intended for
163-
direct use as an array at the field path .status.conditions. For
164-
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
165-
observations of a foo's current state.\n\t // Known .status.conditions.type
166-
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
167-
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
168-
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
169-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
170-
\ // other fields\n\t}"
164+
description: ControllerStatus describes the status of a Policy with
165+
respect to a Gateway API Controller.
171166
properties:
172-
lastTransitionTime:
173-
description: |-
174-
lastTransitionTime is the last time the condition transitioned from one status to another.
175-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
176-
format: date-time
177-
type: string
178-
message:
167+
conditions:
168+
description: Conditions describe the current conditions of the
169+
object.
170+
items:
171+
description: "Condition contains details for one aspect of
172+
the current state of this API Resource.\n---\nThis struct
173+
is intended for direct use as an array at the field path
174+
.status.conditions. For example,\n\n\n\ttype FooStatus
175+
struct{\n\t // Represents the observations of a foo's
176+
current state.\n\t // Known .status.conditions.type are:
177+
\"Available\", \"Progressing\", and \"Degraded\"\n\t //
178+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t //
179+
+listType=map\n\t // +listMapKey=type\n\t Conditions
180+
[]metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\"
181+
patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
182+
\ // other fields\n\t}"
183+
properties:
184+
lastTransitionTime:
185+
description: |-
186+
lastTransitionTime is the last time the condition transitioned from one status to another.
187+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
188+
format: date-time
189+
type: string
190+
message:
191+
description: |-
192+
message is a human readable message indicating details about the transition.
193+
This may be an empty string.
194+
maxLength: 32768
195+
type: string
196+
observedGeneration:
197+
description: |-
198+
observedGeneration represents the .metadata.generation that the condition was set based upon.
199+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
200+
with respect to the current state of the instance.
201+
format: int64
202+
minimum: 0
203+
type: integer
204+
reason:
205+
description: |-
206+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
207+
Producers of specific condition types may define expected values and meanings for this field,
208+
and whether the values are considered a guaranteed API.
209+
The value should be a CamelCase string.
210+
This field may not be empty.
211+
maxLength: 1024
212+
minLength: 1
213+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
214+
type: string
215+
status:
216+
description: status of the condition, one of True, False,
217+
Unknown.
218+
enum:
219+
- "True"
220+
- "False"
221+
- Unknown
222+
type: string
223+
type:
224+
description: |-
225+
type of condition in CamelCase or in foo.example.com/CamelCase.
226+
---
227+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
228+
useful (see .node.status.conditions), the ability to deconflict is important.
229+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
230+
maxLength: 316
231+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
232+
type: string
233+
required:
234+
- lastTransitionTime
235+
- message
236+
- reason
237+
- status
238+
- type
239+
type: object
240+
maxItems: 8
241+
minItems: 1
242+
type: array
243+
x-kubernetes-list-map-keys:
244+
- type
245+
x-kubernetes-list-type: map
246+
controllerName:
179247
description: |-
180-
message is a human readable message indicating details about the transition.
181-
This may be an empty string.
182-
maxLength: 32768
183-
type: string
184-
observedGeneration:
185-
description: |-
186-
observedGeneration represents the .metadata.generation that the condition was set based upon.
187-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
188-
with respect to the current state of the instance.
189-
format: int64
190-
minimum: 0
191-
type: integer
192-
reason:
193-
description: |-
194-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
195-
Producers of specific condition types may define expected values and meanings for this field,
196-
and whether the values are considered a guaranteed API.
197-
The value should be a CamelCase string.
198-
This field may not be empty.
199-
maxLength: 1024
248+
ControllerName is a domain/path string that indicates the name of the
249+
controller that wrote this status. This corresponds with the
250+
controllerName field on GatewayClass.
251+
252+
253+
Example: "gateway.nginx.org/nginx-gateway-controller".
254+
255+
256+
The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
257+
valid Kubernetes names
258+
(https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
259+
maxLength: 253
200260
minLength: 1
201-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
202-
type: string
203-
status:
204-
description: status of the condition, one of True, False, Unknown.
205-
enum:
206-
- "True"
207-
- "False"
208-
- Unknown
209-
type: string
210-
type:
211-
description: |-
212-
type of condition in CamelCase or in foo.example.com/CamelCase.
213-
---
214-
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
215-
useful (see .node.status.conditions), the ability to deconflict is important.
216-
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
217-
maxLength: 316
218-
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
261+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$
219262
type: string
220263
required:
221-
- lastTransitionTime
222-
- message
223-
- reason
224-
- status
225-
- type
264+
- controllerName
226265
type: object
227-
maxItems: 8
228-
minItems: 1
266+
maxItems: 32
229267
type: array
230-
x-kubernetes-list-map-keys:
231-
- type
232-
x-kubernetes-list-type: map
233268
type: object
234269
required:
235270
- spec

0 commit comments

Comments
 (0)