/
jivavolumepolicy_types.go
113 lines (92 loc) · 4.04 KB
/
jivavolumepolicy_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
/*
Copyright 2019 The OpenEBS 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 v1alpha1
import (
corev1 "k8s.io/api/core/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.
// JivaVolumePolicySpec defines the desired state of JivaVolumePolicy
type JivaVolumePolicySpec struct {
// ReplicaSC represents the storage class used for
// creating the pvc for the replicas (provisioned by localpv provisioner)
ReplicaSC string `json:"replicaSC"`
// EnableBufio ...
EnableBufio bool `json:"enableBufio"`
// AutoScaling ...
AutoScaling bool `json:"autoScaling"`
// TargetSpec represents configuration related to jiva target and its resources
Target TargetSpec `json:"target"`
// ReplicaSpec represents configuration related to replicas resources
Replica ReplicaSpec `json:"replica"`
}
// TargetSpec represents configuration related to jiva target deployment
type TargetSpec struct {
// Monitor enables or disables the target exporter sidecar
Monitor bool `json:"monitor,omitempty"`
// ReplicationFactor represents maximum number of replicas
// that are allowed to connect to the target
ReplicationFactor int `json:"replicationFactor,omitempty"`
// PodTemplateResources represents the configuration for target deployment.
PodTemplateResources
// AuxResources are the compute resources required by the jiva-target pod
// side car containers.
AuxResources *corev1.ResourceRequirements `json:"auxResources,omitempty"`
}
// ReplicaSpec represents configuration related to jiva replica sts
type ReplicaSpec struct {
// PodTemplateResources represents the configuration for replica sts.
PodTemplateResources
}
// PodTemplateResources represents the common configuration field for
// jiva target deployment and jiva replica sts.
type PodTemplateResources struct {
// Resources are the compute resources required by the jiva
// container.
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// Tolerations, if specified, are the pod's tolerations
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// Affinity if specified, are the pod's affinities
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// NodeSelector is the labels that will be used to select
// a node for pod scheduleing
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// PriorityClassName if specified applies to the pod
// If left empty, no priority class is applied.
PriorityClassName string `json:"priorityClassName,omitempty"`
}
// JivaVolumePolicyStatus is for handling status of JivaVolumePolicy
type JivaVolumePolicyStatus struct {
Phase string `json:"phase"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// JivaVolumePolicy is the Schema for the jivavolumepolicies API
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=jivavolumepolicies,scope=Namespaced
type JivaVolumePolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec JivaVolumePolicySpec `json:"spec,omitempty"`
Status JivaVolumePolicyStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// JivaVolumePolicyList contains a list of JivaVolumePolicy
type JivaVolumePolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []JivaVolumePolicy `json:"items"`
}
func init() {
SchemeBuilder.Register(&JivaVolumePolicy{}, &JivaVolumePolicyList{})
}