Skip to content

Commit

Permalink
refactor(listener): add svc traffic policy and pref addr type to list…
Browse files Browse the repository at this point in the history
…ener class (#294)
  • Loading branch information
whg517 authored Dec 24, 2024
1 parent abffbcc commit eba818c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/apis/listeners/v1alpha1/listener_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ type AddressType string
const (
AddressTypeHostname AddressType = "Hostname"
AddressTypeIP AddressType = "IP"
// When preferredAddressType is set to HostnameConservative, the controller will
// attempt to use the ip only `ListenerClassSpec.ServiceType` is NodePort,
// otherwise it will use the hostname.
AddressTypeHostnameConservative AddressType = "HostnameConservative"
)

// ListenerSpec defines the desired state of Listener
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/listeners/v1alpha1/listenerclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ type ListenerClassSpec struct {

// +kubebuilder:validation:Optional
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=Local
// +kubebuilder:validation:Enum=Local;Cluster
ServiceExternalTrafficPolicy corev1.ServiceExternalTrafficPolicyType `json:"serviceExternalTrafficPolicy,omitempty"`

// When preferredAddressType is set to HostnameConservative, the controller will
// attempt to use the ip only `ListenerClassSpec.ServiceType` is NodePort,
// otherwise it will use the hostname.
// +kubebuilder:validation:Optional
// +kubebuilder:default=HostnameConservative
// +kubebuilder:validation:Enum=HostnameConservative;Hostname;IP
PreferredAddressType AddressType `json:"preferredAddressType,omitempty"`
}

// ListenerClassStatus defines the observed state of ListenerClass
Expand Down

0 comments on commit eba818c

Please sign in to comment.