Skip to content

✨Allow API Loadbalancer Health Monitor configuration #2512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,39 @@ type APIServerLoadBalancer struct {
// Flavor is the flavor name that will be used to create the APIServerLoadBalancer Spec.
//+optional
Flavor optional.String `json:"flavor,omitempty"`

// Monitor contains configuration for the load balancer health monitor.
//+optional
Monitor *APIServerLoadBalancerMonitor `json:"monitor,omitempty"`
}

// APIServerLoadBalancerMonitor contains configuration for the load balancer health monitor.
type APIServerLoadBalancerMonitor struct {
// Delay is the time in seconds between sending probes to members.
//+optional
//+kubebuilder:validation:Minimum=0
//+kubebuilder:default:10
Delay int `json:"delay,omitempty"`

// Timeout is the maximum time in seconds for a monitor to wait for a connection to be established before it times out.
//+optional
//+kubebuilder:validation:Minimum=0
//+kubebuilder:default:5
Timeout int `json:"timeout,omitempty"`

// MaxRetries is the number of successful checks before changing the operating status of the member to ONLINE.
//+optional
//+kubebuilder:validation:Minimum=0
//+kubebuilder:validation:Maximum=10
//+kubebuilder:default:5
MaxRetries int `json:"maxRetries,omitempty"`

// MaxRetriesDown is the number of allowed check failures before changing the operating status of the member to ERROR.
//+optional
//+kubebuilder:validation:Minimum=1
//+kubebuilder:validation:Maximum=10
//+kubebuilder:default:3
MaxRetriesDown int `json:"maxRetriesDown,omitempty"`
}

func (s *APIServerLoadBalancer) IsZero() bool {
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion cmd/models-schema/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions docs/book/src/api/v1beta1/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/clients/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type LbClient interface {
DeletePoolMember(poolID string, lbMemberID string) error
CreateMonitor(opts monitors.CreateOptsBuilder) (*monitors.Monitor, error)
ListMonitors(opts monitors.ListOptsBuilder) ([]monitors.Monitor, error)
UpdateMonitor(id string, opts monitors.UpdateOptsBuilder) (*monitors.Monitor, error)
DeleteMonitor(id string) error
ListLoadBalancerProviders() ([]providers.Provider, error)
ListOctaviaVersions() ([]apiversions.APIVersion, error)
Expand Down Expand Up @@ -239,6 +240,15 @@ func (l lbClient) ListMonitors(opts monitors.ListOptsBuilder) ([]monitors.Monito
return monitors.ExtractMonitors(allPages)
}

func (l lbClient) UpdateMonitor(id string, opts monitors.UpdateOptsBuilder) (*monitors.Monitor, error) {
mc := metrics.NewMetricPrometheusContext("loadbalancer_healthmonitor", "update")
monitor, err := monitors.Update(context.TODO(), l.serviceClient, id, opts).Extract()
if mc.ObserveRequest(err) != nil {
return nil, err
}
return monitor, nil
}

func (l lbClient) DeleteMonitor(id string) error {
mc := metrics.NewMetricPrometheusContext("loadbalancer_healthmonitor", "delete")
err := monitors.Delete(context.TODO(), l.serviceClient, id).ExtractErr()
Expand Down
15 changes: 15 additions & 0 deletions pkg/clients/mock/loadbalancer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading