Skip to content

Commit 66db33a

Browse files
committed
Initial type definition
Signed-off-by: Flynn <[email protected]>
1 parent 00fd166 commit 66db33a

File tree

1 file changed

+136
-2
lines changed

1 file changed

+136
-2
lines changed

geps/gep-3949/index.md

Lines changed: 136 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ spec:
172172
is analogous to
173173
the `parametersRef` field
174174
in the GatewayClass resource:
175-
it allows specifying
175+
it allows optionally specifying
176176
a reference to a resource
177177
that contains configuration
178178
specific to the mesh
@@ -287,7 +287,141 @@ is a significant barrier to mesh adoption.
287287

288288
### API Type Definitions
289289

290-
TBA.
290+
```go
291+
// Mesh is a Cluster level resource.
292+
type Mesh struct {
293+
metav1.TypeMeta `json:",inline"`
294+
metav1.ObjectMeta `json:"metadata,omitempty"`
295+
296+
// Spec defines the desired state of Mesh.
297+
Spec MeshSpec `json:"spec"`
298+
299+
// Status defines the current state of Mesh.
300+
//
301+
// Implementations MUST populate status on all Mesh resources which
302+
// specify their controller name.
303+
//
304+
// +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
305+
Status MeshStatus `json:"status,omitempty"`
306+
}
307+
308+
// MeshSpec defines the desired state of a Mesh.
309+
type MeshSpec struct {
310+
// ControllerName is the name of the controller that is managing this
311+
// Mesh. The value of this field MUST be a domain prefixed path.
312+
//
313+
// Example: "example.com/awesome-mesh".
314+
//
315+
// This field is not mutable and cannot be empty.
316+
//
317+
// Support: Core
318+
//
319+
// +kubebuilder:validation:XValidation:message="Value is immutable",rule="self == oldSelf"
320+
ControllerName string `json:"controllerName"`
321+
322+
// ParametersRef is an optional reference to a resource that contains
323+
// implementation-specific for this Mesh. If no implementation-specific
324+
// parameters are needed, this field MUST be omitted.
325+
//
326+
// ParametersRef can reference a standard Kubernetes resource, i.e.
327+
// ConfigMap, or an implementation-specific custom resource. The resource
328+
// can be cluster-scoped or namespace-scoped.
329+
//
330+
// If the referent cannot be found, refers to an unsupported kind, or when
331+
// the data within that resource is malformed, the Mesh MUST be rejected
332+
// with the "Accepted" status condition set to "False" and an
333+
// "InvalidParameters" reason.
334+
//
335+
// Support: Implementation-specific
336+
//
337+
// +optional
338+
ParametersRef *ParametersReference `json:"parametersRef,omitempty"`
339+
}
340+
341+
// MeshConditionType is the type for status conditions on Mesh resources.
342+
// This type should be used with the MeshStatus.Conditions field.
343+
type MeshConditionType string
344+
345+
// MeshConditionReason defines the set of reasons that explain why a
346+
// particular Mesh condition type has been raised.
347+
type MeshConditionReason string
348+
349+
const (
350+
// This condition indicates whether the Mesh has been accepted by the
351+
// controller requested in the `spec.controller` field.
352+
//
353+
// This condition defaults to Unknown, and MUST be set by a controller
354+
// when it sees a Mesh using its controller string. The status of this
355+
// condition MUST be set to True if the controller will accept the Mesh
356+
// resource. Otherwise, this status MUST be set to False. If the status
357+
// is set to False, the controller MUST set a Message and Reason as an
358+
// explanation.
359+
//
360+
// Possible reasons for this condition to be true are:
361+
//
362+
// * "Accepted"
363+
//
364+
// Possible reasons for this condition to be False are:
365+
//
366+
// * "InvalidParameters"
367+
//
368+
// Controllers should prefer to use the values of MeshConditionReason
369+
// for the corresponding Reason, where appropriate.
370+
MeshConditionStatusAccepted MeshConditionType = "Accepted"
371+
372+
// This reason is used with the "Accepted" condition when the condition is
373+
// true.
374+
MeshConditionReasonAccepted MeshConditionReason = "Accepted"
375+
376+
// This reason is used with the "Accepted" condition when the Mesh
377+
// was not accepted because the parametersRef field refers to
378+
// * a namespaced resource but the Namespace field is not set, or
379+
// * a cluster-scoped resource but the Namespace field is set, or
380+
// * a nonexistent object, or
381+
// * an unsupported resource or kind, or
382+
// * an existing resource but the data within that resource is malformed.
383+
MeshConditionReasonInvalidParameters MeshConditionReason = "InvalidParameters"
384+
385+
// This reason is used with the "Accepted" condition when the
386+
// requested controller has not yet made a decision about whether
387+
// to accept the Mesh. It is the default Reason on a new Mesh.
388+
MeshConditionReasonPending MeshConditionReason = "Pending"
389+
)
390+
391+
// MeshStatus is the current status for the Mesh.
392+
type MeshStatus struct {
393+
// Conditions is the current status from the controller for
394+
// this Mesh.
395+
//
396+
// Controllers should prefer to publish conditions using values
397+
// of MeshConditionType for the type of each Condition.
398+
//
399+
// +optional
400+
// +listType=map
401+
// +listMapKey=type
402+
// +kubebuilder:validation:MaxItems=8
403+
// +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}}
404+
Conditions []metav1.Condition `json:"conditions,omitempty"`
405+
406+
// SupportedFeatures is the set of features the Mesh support.
407+
// It MUST be sorted in ascending alphabetical order by the Name key.
408+
// +optional
409+
// +listType=map
410+
// +listMapKey=name
411+
// <gateway:experimental>
412+
// +kubebuilder:validation:MaxItems=64
413+
SupportedFeatures []SupportedFeature `json:"supportedFeatures,omitempty"`
414+
}
415+
416+
// +kubebuilder:object:root=true
417+
418+
// MeshList contains a list of Mesh
419+
type MeshList struct {
420+
metav1.TypeMeta `json:",inline"`
421+
metav1.ListMeta `json:"metadata,omitempty"`
422+
Items []Mesh `json:"items"`
423+
}
424+
```
291425

292426
## Conformance Details
293427

0 commit comments

Comments
 (0)