/
kibana_types.go
159 lines (127 loc) · 5.78 KB
/
kibana_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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
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.true
*/
package v1
import (
"github.com/disaster37/operator-sdk-extra/pkg/apis"
"github.com/webcenter-fr/elasticsearch-operator/apis/shared"
corev1 "k8s.io/api/core/v1"
policyv1 "k8s.io/api/policy/v1"
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 (
KibanaAnnotationKey = "kibana.k8s.webcenter.fr"
)
// KibanaSpec defines the desired state of Kibana
// +k8s:openapi-gen=true
type KibanaSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
shared.ImageSpec `json:",inline"`
// ElasticsearchRef is the Elasticsearch ref to connect on.
// +operator-sdk:csv:customresourcedefinitions:type=spec
ElasticsearchRef shared.ElasticsearchRef `json:"elasticsearchRef"`
// Version is the Kibana version to use
// Default is use the latest
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
// +kubebuilder:default=latest
Version string `json:"version,omitempty"`
// PluginsList is the list of additionnal plugin to install on each Kibana instance
// Default is empty
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
PluginsList []string `json:"pluginsList,omitempty"`
// Endpoint permit to set endpoints to access on Kibana 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 Kibana config
// The key is the file stored on kibana/config
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Config map[string]string `json:"config,omitempty"`
// KeystoreSecretRef is the secret that store the security settings
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
KeystoreSecretRef *corev1.LocalObjectReference `json:"keystoreSecretRef,omitempty"`
// Tls permit to set the TLS setting for Kibana access
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Tls shared.TlsSpec `json:"tls,omitempty"`
// Deployment permit to set the deployment settings
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Deployment KibanaDeploymentSpec `json:"deployment,omitempty"`
// Monitoring permit to monitor current cluster
// Default, it not monitor cluster
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Monitoring shared.MonitoringSpec `json:"monitoring,omitempty"`
}
type KibanaDeploymentSpec struct {
shared.Deployment `json:",inline"`
// AntiAffinity permit to set anti affinity policy
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
AntiAffinity *shared.DeploymentAntiAffinitySpec `json:"antiAffinity,omitempty"`
// PodDisruptionBudget is the pod disruption budget policy
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
PodDisruptionBudgetSpec *policyv1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
// Node permit to set extra option on Node process
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Node string `json:"node,omitempty"`
// InitContainerResources permit to set resources on init containers
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
InitContainerResources *corev1.ResourceRequirements `json:"initContainerResources,omitempty"`
}
// KibanaStatus defines the observed state of Kibana
type KibanaStatus 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 Kibana endpoint
// +operator-sdk:csv:customresourcedefinitions:type=status
Url string `json:"url,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// Kibana is the Schema for the kibanas API
// +operator-sdk:csv:customresourcedefinitions:resources={{Ingress,networking.k8s.io/v1},{ConfigMap,v1},{Service,v1},{Secret,v1},{Deployment,apps/v1},{NetworkPolicy,networking.k8s.io/v1},{PodDisruptionBudget,policy/v1},{PodMonitor,monitoring.coreos.com/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 Kibana struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec KibanaSpec `json:"spec,omitempty"`
Status KibanaStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// KibanaList contains a list of Kibana
type KibanaList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Kibana `json:"items"`
}
func init() {
SchemeBuilder.Register(&Kibana{}, &KibanaList{})
}