-
Notifications
You must be signed in to change notification settings - Fork 2
Etcd API and CRD #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Etcd API and CRD #15
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2d17b92
Add Etcd API spec
rytswd 4894d21
Add Etcd CRD
rytswd d31208d
Add cell name
rytswd e7bef8d
Merge remote-tracking branch 'origin/main' into etcd-api-and-crd
rytswd ede5da2
Apply suggestions from code review
rytswd 6c7a8b8
Update api/v1alpha1/etcd_types.go
rytswd 0bdb540
Update api/v1alpha1/etcd_types.go
rytswd 27a30af
Update api/v1alpha1/etcd_types.go
rytswd 1105ca9
Update CRD spec
rytswd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,41 +17,106 @@ 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. | ||||||
| // NOTE: json tags are required. Any new fields you add must have json tags for | ||||||
| // the fields to be serialized. | ||||||
|
|
||||||
| // EtcdSpec defines the desired state of Etcd | ||||||
| // EtcdSpec defines the desired state of an Etcd cluster managed by the operator | ||||||
| type EtcdSpec struct { | ||||||
| // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||||||
| // Important: Run "make" to regenerate code after modifying this file | ||||||
| // The following markers will use OpenAPI v3 schema to validate the value | ||||||
| // More info: https://book.kubebuilder.io/reference/markers/crd-validation.html | ||||||
| // CellName is the name of the cell this MultiOrch belongs to. | ||||||
| // +kubebuilder:validation:MinLength=1 | ||||||
| // +optional | ||||||
| CellName string `json:"cellName,omitempty"` | ||||||
|
|
||||||
| // Image is the container image for Etcd. | ||||||
| // NOTE: The version information is taken from Multigres repo's local | ||||||
| // provisioning setup: | ||||||
| // https://github.com/multigres/multigres/blob/38264ed3cb5049961a1e3d8a9de4836f8215ca76/go/provisioner/local/config.go#L186 | ||||||
| // +kubebuilder:validation:MinLength=1 | ||||||
| // +kubebuilder:default="gcr.io/etcd-development/etcd:v3.5.9" | ||||||
| // +optional | ||||||
| Image string `json:"image,omitempty"` | ||||||
|
|
||||||
| // ImagePullSecrets is an optional list of references to secrets in the same namespace | ||||||
| // to use for pulling the image. | ||||||
| // +optional | ||||||
| ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` | ||||||
|
|
||||||
| // Replicas is the desired number of Etcd members. | ||||||
rytswd marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| // For high availability, use an odd number (typically 3 or 5). | ||||||
fernando-villalba marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| // +kubebuilder:validation:Minimum=1 | ||||||
rytswd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| // +kubebuilder:default=3 | ||||||
| // +optional | ||||||
| Replicas *int32 `json:"replicas,omitempty"` | ||||||
|
|
||||||
| // Resources defines the resource requirements for the Etcd container. | ||||||
| // +optional | ||||||
| Resources corev1.ResourceRequirements `json:"resources,omitempty"` | ||||||
|
|
||||||
| // ServiceAccountName is the name of the ServiceAccount to use for the Etcd pods. | ||||||
| // +optional | ||||||
| ServiceAccountName string `json:"serviceAccountName,omitempty"` | ||||||
|
|
||||||
| // StorageClassName is the name of the StorageClass to use for Etcd data volumes. | ||||||
| // If not specified, the default StorageClass will be used. | ||||||
| // +optional | ||||||
| StorageClassName *string `json:"storageClassName,omitempty"` | ||||||
|
|
||||||
| // StorageSize is the size of the persistent volume for each Etcd member. | ||||||
| // +kubebuilder:default="10Gi" | ||||||
| // +optional | ||||||
| StorageSize string `json:"storageSize,omitempty"` | ||||||
|
|
||||||
| // VolumeClaimTemplate allows customization of the PersistentVolumeClaim for Etcd data. | ||||||
| // If specified, this takes precedence over StorageClassName and StorageSize. | ||||||
| // +optional | ||||||
| VolumeClaimTemplate *corev1.PersistentVolumeClaimSpec `json:"volumeClaimTemplate,omitempty"` | ||||||
|
|
||||||
| // Affinity defines pod affinity and anti-affinity rules. | ||||||
| // +optional | ||||||
| Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||||||
|
|
||||||
| // Tolerations allows pods to schedule onto nodes with matching taints. | ||||||
| // +optional | ||||||
| Tolerations []corev1.Toleration `json:"tolerations,omitempty"` | ||||||
|
|
||||||
| // NodeSelector is a selector which must be true for the pod to fit on a node. | ||||||
| // +optional | ||||||
| NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||||||
|
|
||||||
| // foo is an example field of Etcd. Edit etcd_types.go to remove/update | ||||||
| // TopologySpreadConstraints controls how pods are spread across topology domains. | ||||||
| // +optional | ||||||
| Foo *string `json:"foo,omitempty"` | ||||||
| TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"` | ||||||
|
|
||||||
| // PodAnnotations are annotations to add to the Etcd pods. | ||||||
| // +optional | ||||||
| PodAnnotations map[string]string `json:"podAnnotations,omitempty"` | ||||||
|
|
||||||
| // PodLabels are additional labels to add to the Etcd pods. | ||||||
rytswd marked this conversation as resolved.
Show resolved
Hide resolved
rytswd marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| // These are merged with the standard labels generated by the operator. | ||||||
| // In case of a key conflict, the operator's standard labels take precedence. | ||||||
| // +optional | ||||||
| PodLabels map[string]string `json:"podLabels,omitempty"` | ||||||
| } | ||||||
|
|
||||||
| // EtcdStatus defines the observed state of Etcd. | ||||||
| type EtcdStatus struct { | ||||||
| // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||||||
| // Important: Run "make" to regenerate code after modifying this file | ||||||
|
|
||||||
| // For Kubernetes API conventions, see: | ||||||
| // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties | ||||||
|
|
||||||
| // conditions represent the current state of the Etcd resource. | ||||||
| // Each condition has a unique type and reflects the status of a specific aspect of the resource. | ||||||
| // | ||||||
| // Standard condition types include: | ||||||
| // - "Available": the resource is fully functional | ||||||
| // - "Progressing": the resource is being created or updated | ||||||
| // - "Degraded": the resource failed to reach or maintain its desired state | ||||||
| // | ||||||
| // The status of each condition is one of True, False, or Unknown. | ||||||
| // Ready indicates whether the Etcd cluster is healthy and available. | ||||||
| Ready bool `json:"ready"` | ||||||
|
|
||||||
| // Replicas is the desired number of Etcd members. | ||||||
| Replicas int32 `json:"replicas"` | ||||||
|
|
||||||
| // ReadyReplicas is the number of ready Etcd members. | ||||||
| ReadyReplicas int32 `json:"readyReplicas"` | ||||||
|
|
||||||
| // ObservedGeneration reflects the generation of the most recently observed Etcd spec. | ||||||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||||||
|
|
||||||
| // Conditions represent the latest available observations of the Etcd cluster's state. | ||||||
| // +listType=map | ||||||
| // +listMapKey=type | ||||||
| // +optional | ||||||
|
|
@@ -60,6 +125,9 @@ type EtcdStatus struct { | |||||
|
|
||||||
| // +kubebuilder:object:root=true | ||||||
| // +kubebuilder:subresource:status | ||||||
| // +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready` | ||||||
| // +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.readyReplicas` | ||||||
rytswd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| // +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.readyReplicas` | |
| // +kubebuilder:printcolumn:name="Ready Replicas",type=string,JSONPath=`.status.readyReplicas` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.