Skip to content

Commit

Permalink
Automated protobuf generation
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Feb 14, 2020
1 parent ef7cd09 commit 0ec66c2
Show file tree
Hide file tree
Showing 14 changed files with 9,971 additions and 80 deletions.
72 changes: 36 additions & 36 deletions api/v1alpha1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ import (

// Gateway represents an instantiation of a service-traffic handling infrastructure.
type Gateway struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`

Spec GatewaySpec `json:"spec,omitempty"`
Status GatewayStatus `json:"status,omitempty"`
Spec GatewaySpec `json:"spec,omitempty" protobuf:"bytes,3,opt,name=spec"`
Status GatewayStatus `json:"status,omitempty" protobuf:"bytes,4,opt,name=status"`
}

// +kubebuilder:object:root=true

// GatewayList contains a list of Gateway
type GatewayList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Gateway `json:"items"`
metav1.TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
Items []Gateway `json:"items" protobuf:"bytes,3,rep,name=items"`
}

// GatewaySpec defines the desired state of Gateway.
Expand All @@ -52,13 +52,13 @@ type GatewayList struct {
// signaling via the GatewayStatus block.
type GatewaySpec struct {
// Class used for this Gateway. This is the name of a GatewayClass resource.
Class string `json:"class"`
Class string `json:"class" protobuf:"bytes,1,opt,name=class"`
// Listeners associated with this Gateway. Listeners define what addresses,
// ports, protocols are bound on this Gateway.
Listeners []Listener `json:"listeners"`
Listeners []Listener `json:"listeners" protobuf:"bytes,2,rep,name=listeners"`
// Routes associated with this Gateway. Routes define
// protocol-specific routing to backends (e.g. Services).
Routes []core.TypedLocalObjectReference `json:"routes"`
Routes []core.TypedLocalObjectReference `json:"routes" protobuf:"bytes,3,rep,name=routes"`
}

const (
Expand All @@ -81,7 +81,7 @@ type Listener struct {
// Support: Core
//
// +required
Name string `json:"name"`
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Address requested for this listener. This is optional and behavior
// can depend on GatewayClass. If a value is set in the spec and
// the request address is invalid, the GatewayClass MUST indicate
Expand All @@ -90,29 +90,29 @@ type Listener struct {
// Support:
//
// +optional
Address *ListenerAddress `json:"address,omitempty"`
Address *ListenerAddress `json:"address,omitempty" protobuf:"bytes,2,opt,name=address"`
// Port is a list of ports associated with the Address.
//
// Support:
// +optional
Port *int32 `json:"port,omitempty"`
Port *int32 `json:"port,omitempty" protobuf:"varint,3,opt,name=port"`
// Protocol to use.
//
// Support:
// +optional
Protocol *string `json:"protocol,omitempty"`
Protocol *string `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol"`
// TLS is the TLS configuration for the Listener. If unspecified,
// the listener will not support TLS connections.
//
// Support: Core
//
// +optional
TLS *ListenerTLS `json:"tls,omitempty"`
TLS *ListenerTLS `json:"tls,omitempty" protobuf:"bytes,5,opt,name=tls"`
// Extension for this Listener.
//
// Support: custom.
// +optional
Extension *core.TypedLocalObjectReference `json:"extension,omitempty"`
Extension *core.TypedLocalObjectReference `json:"extension,omitempty" protobuf:"bytes,6,opt,name=extension"`
}

const (
Expand All @@ -132,10 +132,10 @@ type ListenerAddress struct {
// Type of the Address. This is one of the *AddressType constants.
//
// Support: Extended
Type string `json:"type"`
Type string `json:"type" protobuf:"bytes,1,opt,name=type"`
// Value. Examples: "1.2.3.4", "128::1", "my-ip-address". Validity of the
// values will depend on `Type` and support by the controller.
Value string `json:"value"`
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}

const (
Expand Down Expand Up @@ -171,7 +171,7 @@ type ListenerTLS struct {
// Support: Implementation-specific (Other resource types)
//
// +required
Certificates []core.TypedLocalObjectReference `json:"certificates"`
Certificates []core.TypedLocalObjectReference `json:"certificates" protobuf:"bytes,1,rep,name=certificates"`
// MinimumVersion of TLS allowed. It is recommended to use one of
// the TLS_* constants above. Note: this is not strongly
// typed to allow implementation-specific versions to be used without
Expand All @@ -182,7 +182,7 @@ type ListenerTLS struct {
// values.
//
// +optional
MinimumVersion *string `json:"minimumVersion"`
MinimumVersion *string `json:"minimumVersion" protobuf:"bytes,2,opt,name=minimumVersion"`
// Options are a list of key/value pairs to give extended options
// to the provider.
//
Expand All @@ -192,16 +192,16 @@ type ListenerTLS struct {
// construct.
//
// Support: Implementation-specific.
Options map[string]string `json:"options"`
Options map[string]string `json:"options" protobuf:"bytes,3,rep,name=options"`
}

// GatewayStatus defines the observed state of Gateway.
type GatewayStatus struct {
// Conditions describe the current conditions of the Gateway.
Conditions []GatewayCondition `json:"conditions"`
Conditions []GatewayCondition `json:"conditions" protobuf:"bytes,1,rep,name=conditions"`
// Listeners provide status for each listener defined in the Spec. The name
// in ListenerStatus refers to the corresponding Listener of the same name.
Listeners []ListenerStatus `json:"listeners"`
Listeners []ListenerStatus `json:"listeners" protobuf:"bytes,2,rep,name=listeners"`
}

// GatewayConditionType is a type of condition associated with a Gateway.
Expand Down Expand Up @@ -235,29 +235,29 @@ const (
// GatewayCondition is an error status for a given route.
type GatewayCondition struct {
// Type indicates the type of condition.
Type GatewayConditionType `json:"type"`
Type GatewayConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=GatewayConditionType"`
// Status describes the current state of this condition. Can be "True",
// "False", or "Unknown".
Status core.ConditionStatus `json:"status"`
Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
// Message is a human-understandable message describing the condition.
// +optional
Message string `json:"message,omitempty"`
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// Reason indicates why the condition is in this state.
// +optional
Reason string `json:"reason,omitempty"`
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// LastTransitionTime indicates the last time this condition changed.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,5,opt,name=lastTransitionTime"`
}

// ListenerStatus is the status associated with each listener block.
type ListenerStatus struct {
// Name is the name of the listener this status refers to.
Name string `json:"name"`
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Address bound on this listener.
Address *ListenerAddress `json:"address"`
Address *ListenerAddress `json:"address" protobuf:"bytes,2,opt,name=address"`
// Conditions describe the current condition of this listener.
Conditions []ListenerCondition `json:"conditions"`
Conditions []ListenerCondition `json:"conditions" protobuf:"bytes,3,rep,name=conditions"`
}

// ListenerConditionType is a type of condition associated with the listener.
Expand All @@ -278,19 +278,19 @@ const (
// ListenerCondition is an error status for a given listener.
type ListenerCondition struct {
// Type indicates the type of condition.
Type ListenerConditionType `json:"type"`
Type ListenerConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ListenerConditionType"`
// Status describes the current state of this condition. Can be "True",
// "False", or "Unknown".
Status core.ConditionStatus `json:"status"`
Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
// Message is a human-understandable message describing the condition.
// +optional
Message string `json:"message,omitempty"`
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// Reason indicates why the condition is in this state.
// +optional
Reason string `json:"reason,omitempty"`
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// LastTransitionTime indicates the last time this condition changed.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,5,opt,name=lastTransitionTime"`
}

func init() {
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
//
// Support: Core.
type GatewayClass struct {
metav1.TypeMeta `json:",inline"`
metav1.TypeMeta `json:",inline" protobuf:"bytes,4,opt,name=typeMeta"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Spec for this GatewayClass.
Expand Down Expand Up @@ -130,7 +130,7 @@ type GatewayClassCondition struct {

// GatewayClassList contains a list of GatewayClass
type GatewayClassList struct {
metav1.TypeMeta `json:",inline"`
metav1.TypeMeta `json:",inline" protobuf:"bytes,3,opt,name=typeMeta"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []GatewayClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}
Expand Down
Loading

0 comments on commit 0ec66c2

Please sign in to comment.