Skip to content
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

feat: graceful group member change #12

Merged
merged 16 commits into from
Dec 10, 2024
32 changes: 28 additions & 4 deletions api/v1/cachegroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,32 @@ import (
// 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.

type CacheDirType string

var (
CacheDirTypeHostPath CacheDirType = "HostPath"
CacheDirTypePVC CacheDirType = "PVC"
)

type CacheDir struct {
// +kubebuilder:validation:Enum=HostPath;PVC
Type CacheDirType `json:"type,omitempty"`
// required for HostPath type
// +optional
Path string `json:"path,omitempty"`
// required for PVC type
// +optional
Name string `json:"name,omitempty"`
}

// CacheGroupWorkerTemplate defines cache group worker template
type CacheGroupWorkerTemplate struct {
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
HostNetwork *bool `json:"hostNetwork,omitempty"`
SchedulerName string `json:"schedulerName,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
CacheDirs []CacheDir `json:"cacheDirs,omitempty"`

// Container image.
// More info: https://kubernetes.io/docs/concepts/containers/images
Expand Down Expand Up @@ -145,17 +164,22 @@ type CacheGroupStatus struct {
Phase CacheGroupPhase `json:"phase,omitempty"`
Conditions []CacheGroupCondition `json:"conditions,omitempty"`

ReadyWorker int32 `json:"readyWorker,omitempty"`
ExpectWorker int32 `json:"expectWorker,omitempty"`
ReadyStr string `json:"readyStr,omitempty"`
CacheGroup string `json:"cacheGroup,omitempty"`
FileSystem string `json:"fileSystem,omitempty"`
ReadyWorker int32 `json:"readyWorker,omitempty"`
BackUpWorker int32 `json:"backUpWorker,omitempty"`
WaitingDeletedWorker int32 `json:"waitingDeletedWorker,omitempty"`
ExpectWorker int32 `json:"expectWorker,omitempty"`
ReadyStr string `json:"readyStr,omitempty"`
CacheGroup string `json:"cacheGroup,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=cg
// +kubebuilder:printcolumn:name="Cache Group",type="string",JSONPath=".status.cacheGroup"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Back up",type="string",JSONPath=".status.backUpWorker"
// +kubebuilder:printcolumn:name="Waiting Deleted",type="string",JSONPath=".status.WaitingDeletedWorker"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.readyStr"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// CacheGroup is the Schema for the cachegroups API
Expand Down
20 changes: 20 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions config/crd/bases/juicefs.io_cachegroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.backUpWorker
name: Back up
type: string
- jsonPath: .status.WaitingDeletedWorker
name: Waiting Deleted
type: string
- jsonPath: .status.readyStr
name: Ready
type: string
Expand Down Expand Up @@ -77,6 +83,20 @@ spec:
overwrite:
items:
properties:
cacheDirs:
items:
properties:
name:
type: string
path:
type: string
type:
enum:
- HostPath
- PVC
type: string
type: object
type: array
dnsPolicy:
type: string
env:
Expand Down Expand Up @@ -1471,6 +1491,20 @@ spec:
type: array
template:
properties:
cacheDirs:
items:
properties:
name:
type: string
path:
type: string
type:
enum:
- HostPath
- PVC
type: string
type: object
type: array
dnsPolicy:
type: string
env:
Expand Down Expand Up @@ -2862,6 +2896,9 @@ spec:
type: object
status:
properties:
backUpWorker:
format: int32
type: integer
cacheGroup:
type: string
conditions:
Expand All @@ -2883,13 +2920,18 @@ spec:
expectWorker:
format: int32
type: integer
fileSystem:
type: string
phase:
type: string
readyStr:
type: string
readyWorker:
format: int32
type: integer
waitingDeletedWorker:
format: int32
type: integer
type: object
type: object
served: true
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: controller
newTag: latest
newName: registry.zzde.me/juicefs-cache-group-operator
newTag: v0.2.5
42 changes: 42 additions & 0 deletions dist/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.backUpWorker
name: Back up
type: string
- jsonPath: .status.WaitingDeletedWorker
name: Waiting Deleted
type: string
- jsonPath: .status.readyStr
name: Ready
type: string
Expand Down Expand Up @@ -76,6 +82,20 @@ spec:
overwrite:
items:
properties:
cacheDirs:
items:
properties:
name:
type: string
path:
type: string
type:
enum:
- HostPath
- PVC
type: string
type: object
type: array
dnsPolicy:
type: string
env:
Expand Down Expand Up @@ -1470,6 +1490,20 @@ spec:
type: array
template:
properties:
cacheDirs:
items:
properties:
name:
type: string
path:
type: string
type:
enum:
- HostPath
- PVC
type: string
type: object
type: array
dnsPolicy:
type: string
env:
Expand Down Expand Up @@ -2861,6 +2895,9 @@ spec:
type: object
status:
properties:
backUpWorker:
format: int32
type: integer
cacheGroup:
type: string
conditions:
Expand All @@ -2882,13 +2919,18 @@ spec:
expectWorker:
format: int32
type: integer
fileSystem:
type: string
phase:
type: string
readyStr:
type: string
readyWorker:
format: int32
type: integer
waitingDeletedWorker:
format: int32
type: integer
type: object
type: object
served: true
Expand Down
Loading
Loading