/
command_types.go
67 lines (56 loc) · 2.34 KB
/
command_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
package v1alpha1
import (
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Command is the Schema for the commands API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
type Command struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CommandSpec `json:"spec,omitempty"`
Status CommandStatus `json:"status,omitempty"`
}
// CommandSpec defines the desired state of Command
// +k8s:openapi-gen=true
type CommandSpec struct {
CommonConfiguration CommonConfiguration `json:"commonConfiguration"`
ServiceConfiguration CommandConfiguration `json:"serviceConfiguration"`
}
// CommandConfiguration is the Spec for the Command configuration
// +k8s:openapi-gen=true
type CommandConfiguration struct {
ClusterName string `json:"clusterName,omitempty"`
ConfigAPIURL string `json:"configAPIURL,omitempty"`
TelemetryURL string `json:"telemetryURL,omitempty"`
PostgresInstance string `json:"postgresInstance,omitempty"`
SwiftInstance string `json:"swiftInstance,omitempty"`
KeystoneInstance string `json:"keystoneInstance,omitempty"`
KeystoneSecretName string `json:"keystoneSecretName,omitempty"`
Containers map[string]*Container `json:"containers,omitempty"`
}
// CommandStatus defines the observed state of Command
// +k8s:openapi-gen=true
type CommandStatus struct {
Active bool `json:"active,omitempty"`
IPs []string `json:"ips,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CommandList contains a list of Command
type CommandList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Command `json:"items"`
}
func init() {
SchemeBuilder.Register(&Command{}, &CommandList{})
}
func (c *Command) PrepareIntendedDeployment(
instanceDeployment *appsv1.Deployment, commonConfiguration *CommonConfiguration, request reconcile.Request, scheme *runtime.Scheme,
) (*appsv1.Deployment, error) {
return PrepareIntendedDeployment(instanceDeployment, commonConfiguration, "command", request, scheme, c)
}