forked from hetznercloud/hcloud-cloud-controller-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Boris Brönner
committed
Aug 28, 2023
1 parent
15a71fd
commit f682041
Showing
9 changed files
with
304 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package rootserver | ||
|
||
import ( | ||
"context" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
cloudprovider "k8s.io/cloud-provider" | ||
) | ||
|
||
type Queries interface { | ||
// IsRootServer finds out if the given node is one looking at the k8s node | ||
// label instance.hetzner.cloud/is-root-server | ||
IsRootServer(ctx context.Context, nodeName types.NodeName) (bool, error) | ||
IsRootServerByNode(node *corev1.Node) bool | ||
GetInstanceMetadata(node *corev1.Node) (*cloudprovider.InstanceMetadata, error) | ||
GetRootServerRoutes(ctx context.Context) ([]*cloudprovider.Route, error) | ||
} | ||
|
||
type queriesMock struct { | ||
} | ||
|
||
func (m *queriesMock) IsRootServer(context.Context, types.NodeName) (bool, error) { | ||
return false, nil | ||
} | ||
|
||
func (m *queriesMock) IsRootServerByNode(*corev1.Node) bool { | ||
return false | ||
} | ||
|
||
func (m *queriesMock) NodeAddresses(context.Context, types.NodeName) ([]corev1.NodeAddress, error) { | ||
return []corev1.NodeAddress{}, nil | ||
} | ||
|
||
func (m *queriesMock) GetInstanceMetadata(*corev1.Node) (*cloudprovider.InstanceMetadata, error) { | ||
return &cloudprovider.InstanceMetadata{}, nil | ||
} | ||
|
||
func (m *queriesMock) GetRootServerRoutes(context.Context) ([]*cloudprovider.Route, error) { | ||
return []*cloudprovider.Route{}, nil | ||
} | ||
|
||
func NewQueriesMock() Queries { | ||
return &queriesMock{} | ||
} |
Oops, something went wrong.