/
cache_types.go
111 lines (95 loc) · 3.88 KB
/
cache_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
package v2alpha1
// IMPORTANT: run "make codegen" or "operator-sdk generate k8s" to regenerate code after modifying this file
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type CacheConditionType string
const (
CacheConditionReady CacheConditionType = "Ready"
)
// AdminAuth description of the auth info
type AdminAuth struct {
// The secret that contains user credentials.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Authentication Secret",xDescriptors="urn:alm:descriptor:io.kubernetes:Secret"
SecretName string `json:"secretName,omitempty"`
// Secret and key containing the admin username for authentication.
// +optional
Username v1.SecretKeySelector `json:"username,omitempty"`
// Secret and key containing the admin password for authentication.
// +optional
Password v1.SecretKeySelector `json:"password,omitempty"`
}
// +kubebuilder:validation:Enum=recreate;retain
type CacheUpdateStrategyType string
const (
CacheUpdateRecreate CacheUpdateStrategyType = "recreate"
CacheUpdateRetain CacheUpdateStrategyType = "retain"
)
type CacheUpdateSpec struct {
// How updates to Cache CR template should be applied on the Infinispan server
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Update Strategy",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:recreate", "urn:alm:descriptor:com.tectonic.ui:select:retain"}
Strategy CacheUpdateStrategyType `json:"strategy,omitempty"`
}
// CacheSpec defines the desired state of Cache
type CacheSpec struct {
// Deprecated. This no longer has any effect. The operator's admin credentials are now used to perform cache operations
AdminAuth *AdminAuth `json:"adminAuth,omitempty"`
// Infinispan cluster name
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Cluster Name",xDescriptors="urn:alm:descriptor:io.kubernetes:infinispan.org:v1:Infinispan"
ClusterName string `json:"clusterName"`
// Name of the cache to be created. If empty ObjectMeta.Name will be used
// +optional
Name string `json:"name,omitempty"`
// Cache template in XML format
// +optional
Template string `json:"template,omitempty"`
// Name of the template to be used to create this cache
// +optional
TemplateName string `json:"templateName,omitempty"`
// How updates to Cache CR template should be reconciled on the Infinispan server
// +optional
Updates *CacheUpdateSpec `json:"updates,omitempty"`
}
// CacheCondition define a condition of the cluster
type CacheCondition struct {
// Type is the type of the condition.
Type CacheConditionType `json:"type"`
// Status is the status of the condition.
Status metav1.ConditionStatus `json:"status"`
// Human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty"`
}
// CacheStatus defines the observed state of Cache
type CacheStatus struct {
// Conditions list for this cache
// +optional
Conditions []CacheCondition `json:"conditions,omitempty"`
// Deprecated. This is no longer set. Service name that exposes the cache inside the cluster
// +optional
ServiceName string `json:"serviceName,omitempty"`
}
// +kubebuilder:object:root=true
// Cache is the Schema for the caches API
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=caches,scope=Namespaced
type Cache struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CacheSpec `json:"spec,omitempty"`
Status CacheStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// CacheList contains a list of Cache
type CacheList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Cache `json:"items"`
}
func init() {
SchemeBuilder.Register(&Cache{}, &CacheList{})
}