-
Notifications
You must be signed in to change notification settings - Fork 231
Expand file tree
/
Copy pathinterfaces.go
More file actions
113 lines (96 loc) · 3.05 KB
/
interfaces.go
File metadata and controls
113 lines (96 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cloud
import (
"context"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
ctrl "sigs.k8s.io/controller-runtime"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
corev1 "k8s.io/api/core/v1"
infrav1 "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
)
// Cloud alias for cloud.Cloud interface.
type Cloud = cloud.Cloud
// Reconciler is a generic interface used by components offering a type of service.
type Reconciler interface {
Reconcile(ctx context.Context) error
Delete(ctx context.Context) error
}
// ReconcilerWithResult is a generic interface used by components offering a type of service.
type ReconcilerWithResult interface {
Reconcile(ctx context.Context) (ctrl.Result, error)
Delete(ctx context.Context) (ctrl.Result, error)
}
// Client is an interface which can get cloud client.
type Client interface {
Cloud() Cloud
NetworkCloud() Cloud
}
// ClusterGetter is an interface which can get cluster information.
type ClusterGetter interface {
Client
Project() string
Region() string
Name() string
Namespace() string
NetworkName() string
NetworkProject() string
IsSharedVpc() bool
SkipFirewallRuleCreation() bool
Network() *infrav1.Network
AdditionalLabels() infrav1.Labels
FailureDomains() []string
ControlPlaneEndpoint() clusterv1.APIEndpoint
ResourceManagerTags() infrav1.ResourceManagerTags
LoadBalancer() infrav1.LoadBalancerSpec
}
// ClusterSetter is an interface which can set cluster information.
type ClusterSetter interface {
SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint)
}
// Cluster is an interface which can get and set cluster information.
type Cluster interface {
ClusterGetter
ClusterSetter
}
// MachineGetter is an interface which can get machine information.
type MachineGetter interface {
Client
Name() string
Namespace() string
Zone() string
Project() string
Role() string
IsControlPlane() bool
IsFirstMachine() bool
IsAPIServerHealthy() bool
ControlPlaneGroupName() string
GetInstanceID() *string
GetProviderID() string
GetBootstrapData() (string, error)
GetInstanceStatus() *infrav1.InstanceStatus
}
// MachineSetter is an interface which can set machine information.
type MachineSetter interface {
SetProviderID()
SetInstanceStatus(v infrav1.InstanceStatus)
SetFailureMessage(v error)
SetFailureReason(v string)
SetAnnotation(key, value string)
SetAddresses(addressList []corev1.NodeAddress)
}
// Machine is an interface which can get and set machine information.
type Machine interface {
MachineGetter
MachineSetter
}