Skip to content
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

Refactor into distinct packages to prep for adding firewall support to Nodes #186

Merged
merged 1 commit into from
Mar 11, 2024
Merged
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
34 changes: 34 additions & 0 deletions cloud/annotations/annotations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package annotations

const (
// AnnLinodeDefaultProtocol is the annotation used to specify the default protocol
// for Linode load balancers. Options are tcp, http and https. Defaults to tcp.
AnnLinodeDefaultProtocol = "service.beta.kubernetes.io/linode-loadbalancer-default-protocol"
AnnLinodePortConfigPrefix = "service.beta.kubernetes.io/linode-loadbalancer-port-"
AnnLinodeDefaultProxyProtocol = "service.beta.kubernetes.io/linode-loadbalancer-default-proxy-protocol"

AnnLinodeCheckPath = "service.beta.kubernetes.io/linode-loadbalancer-check-path"
AnnLinodeCheckBody = "service.beta.kubernetes.io/linode-loadbalancer-check-body"
AnnLinodeHealthCheckType = "service.beta.kubernetes.io/linode-loadbalancer-check-type"

AnnLinodeHealthCheckInterval = "service.beta.kubernetes.io/linode-loadbalancer-check-interval"
AnnLinodeHealthCheckTimeout = "service.beta.kubernetes.io/linode-loadbalancer-check-timeout"
AnnLinodeHealthCheckAttempts = "service.beta.kubernetes.io/linode-loadbalancer-check-attempts"
AnnLinodeHealthCheckPassive = "service.beta.kubernetes.io/linode-loadbalancer-check-passive"

// AnnLinodeThrottle is the annotation specifying the value of the Client Connection
// Throttle, which limits the number of subsequent new connections per second from the
// same client IP. Options are a number between 1-20, or 0 to disable. Defaults to 20.
AnnLinodeThrottle = "service.beta.kubernetes.io/linode-loadbalancer-throttle"

AnnLinodeLoadBalancerPreserve = "service.beta.kubernetes.io/linode-loadbalancer-preserve"
AnnLinodeNodeBalancerID = "service.beta.kubernetes.io/linode-loadbalancer-nodebalancer-id"

AnnLinodeHostnameOnlyIngress = "service.beta.kubernetes.io/linode-loadbalancer-hostname-only-ingress"
AnnLinodeLoadBalancerTags = "service.beta.kubernetes.io/linode-loadbalancer-tags"
AnnLinodeCloudFirewallID = "service.beta.kubernetes.io/linode-loadbalancer-firewall-id"
AnnLinodeCloudFirewallACL = "service.beta.kubernetes.io/linode-loadbalancer-firewall-acl"

AnnLinodeNodePrivateIP = "node.k8s.linode.com/private-ip"
AnnLinodeHostUUID = "node.k8s.linode.com/host-uuid"
)
34 changes: 0 additions & 34 deletions cloud/linode/annotations.go

This file was deleted.

9 changes: 5 additions & 4 deletions cloud/linode/client.go → cloud/linode/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package linode
package client

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up: moving this file into a new package would constitute a major version bump of this module. However, this module's last-tagged version is still < v1, so it should be fine. Just be aware that this may break downstream users of this module.

//go:generate go run github.com/golang/mock/mockgen -destination mock_client_test.go -package linode github.com/linode/linode-cloud-controller-manager/cloud/linode Client
//go:generate go run github.com/golang/mock/mockgen -destination mock_client_test.go -package client github.com/linode/linode-cloud-controller-manager/cloud/linode/client Client

import (
"context"
Expand Down Expand Up @@ -39,9 +39,10 @@ type Client interface {
// linodego.Client implements Client
var _ Client = (*linodego.Client)(nil)

func newLinodeClient(token, ua, apiURL string) (*linodego.Client, error) {
// New creates a new linode client with a given token, userAgent, and API URL
func New(token, userAgent, apiURL string) (*linodego.Client, error) {
linodeClient := linodego.NewClient(nil)
linodeClient.SetUserAgent(ua)
linodeClient.SetUserAgent(userAgent)
linodeClient.SetToken(token)

// Validate apiURL
Expand Down
Loading
Loading