/
cerebro_types.go
116 lines (92 loc) · 3.96 KB
/
cerebro_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
/*
Copyright 2022.
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 v1
import (
"github.com/disaster37/operator-sdk-extra/pkg/apis"
"github.com/webcenter-fr/elasticsearch-operator/apis/shared"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
const (
CerebroAnnotationKey = "cerebro.k8s.webcenter.fr"
)
// CerebroSpec defines the desired state of Cerebro
// +k8s:openapi-gen=true
type CerebroSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
shared.ImageSpec `json:",inline"`
// Version is the Cerebro version to use
// Default is use the latest
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
// +kubebuilder:default=latest
Version string `json:"version,omitempty"`
// Endpoint permit to set endpoints to access on Cerebro from external kubernetes
// You can set ingress and / or load balancer
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Endpoint shared.EndpointSpec `json:"endpoint,omitempty"`
// Config is the Cerebro config
// The key is the file stored on kibana/config
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Config map[string]string `json:"config,omitempty"`
// Deployment permit to set the deployment settings
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Deployment CerebroDeploymentSpec `json:"deployment,omitempty"`
}
type CerebroDeploymentSpec struct {
shared.Deployment `json:",inline"`
// Node permit to set extra option on Node process
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Node string `json:"node,omitempty"`
}
// CerebroStatus defines the observed state of Cerebro
type CerebroStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
apis.BasicMultiPhaseObjectStatus `json:",inline"`
// Url is the Cerebro endpoint
// +operator-sdk:csv:customresourcedefinitions:type=status
Url string `json:"url,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// Cerebro is the Schema for the cerebroes API
// +operator-sdk:csv:customresourcedefinitions:resources={{Ingress,networking.k8s.io/v1},{ConfigMap,v1},{Service,v1},{Secret,v1},{Deployment,apps/v1}}
// +kubebuilder:printcolumn:name="URL",type="string",JSONPath=".status.url"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Phase"
// +kubebuilder:printcolumn:name="Error",type="boolean",JSONPath=".status.isOnError",description="Is on error"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status",description="health"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type Cerebro struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CerebroSpec `json:"spec,omitempty"`
Status CerebroStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// CerebroList contains a list of Cerebro
type CerebroList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Cerebro `json:"items"`
}
func init() {
SchemeBuilder.Register(&Cerebro{}, &CerebroList{})
}