-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathdockermachine_types.go
126 lines (100 loc) · 4.12 KB
/
dockermachine_types.go
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
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
Copyright 2019 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 v1alpha3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
)
const (
// MachineFinalizer allows ReconcileDockerMachine to clean up resources associated with AWSMachine before
// removing it from the apiserver.
MachineFinalizer = "dockermachine.infrastructure.cluster.x-k8s.io"
)
// DockerMachineSpec defines the desired state of DockerMachine
type DockerMachineSpec struct {
// ProviderID will be the container name in ProviderID format (docker:////<containername>)
// +optional
ProviderID *string `json:"providerID,omitempty"`
// CustomImage allows customizing the container image that is used for
// running the machine
// +optional
CustomImage string `json:"customImage,omitempty"`
// PreLoadImages allows to pre-load images in a newly created machine. This can be used to
// speed up tests by avoiding e.g. to download CNI images on all the containers.
// +optional
PreLoadImages []string `json:"preLoadImages,omitempty"`
// ExtraMounts describes additional mount points for the node container
// These may be used to bind a hostPath
// +optional
ExtraMounts []Mount `json:"extraMounts,omitempty"`
// Bootstrapped is true when the kubeadm bootstrapping has been run
// against this machine
// +optional
Bootstrapped bool `json:"bootstrapped,omitempty"`
}
// Mount specifies a host volume to mount into a container.
// This is a simplified version of kind v1alpha4.Mount types
type Mount struct {
// Path of the mount within the container.
ContainerPath string `json:"containerPath,omitempty"`
// Path of the mount on the host. If the hostPath doesn't exist, then runtimes
// should report error. If the hostpath is a symbolic link, runtimes should
// follow the symlink and mount the real destination to container.
HostPath string `json:"hostPath,omitempty"`
// If set, the mount is read-only.
// +optional
Readonly bool `json:"readOnly,omitempty"`
}
// DockerMachineStatus defines the observed state of DockerMachine
type DockerMachineStatus struct {
// Ready denotes that the machine (docker container) is ready
// +optional
Ready bool `json:"ready"`
// LoadBalancerConfigured denotes that the machine has been
// added to the load balancer
// +optional
LoadBalancerConfigured bool `json:"loadBalancerConfigured,omitempty"`
// Addresses contains the associated addresses for the docker machine.
// +optional
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
// Conditions defines current service state of the DockerMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}
// +kubebuilder:resource:path=dockermachines,scope=Namespaced,categories=cluster-api
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// DockerMachine is the Schema for the dockermachines API
type DockerMachine struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DockerMachineSpec `json:"spec,omitempty"`
Status DockerMachineStatus `json:"status,omitempty"`
}
func (c *DockerMachine) GetConditions() clusterv1.Conditions {
return c.Status.Conditions
}
func (c *DockerMachine) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}
// +kubebuilder:object:root=true
// DockerMachineList contains a list of DockerMachine
type DockerMachineList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DockerMachine `json:"items"`
}
func init() {
SchemeBuilder.Register(&DockerMachine{}, &DockerMachineList{})
}