Skip to content

Commit

Permalink
Merge pull request #186 from linode/fw-nodes
Browse files Browse the repository at this point in the history
Refactor into distinct packages to prep for adding firewall support to Nodes
  • Loading branch information
AshleyDumaine authored Mar 11, 2024
2 parents 53a5848 + 0a3730f commit 0295e50
Show file tree
Hide file tree
Showing 10 changed files with 1,002 additions and 609 deletions.
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

//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

0 comments on commit 0295e50

Please sign in to comment.