Skip to content

Commit

Permalink
refactor: add xline bootup script
Browse files Browse the repository at this point in the history
Signed-off-by: Phoeniix Zhao <[email protected]>
  • Loading branch information
Phoenix500526 committed Feb 16, 2024
1 parent de89583 commit 9650010
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 189 deletions.
107 changes: 54 additions & 53 deletions api/v1alpha1/xlinecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,65 +51,65 @@ type XlineClusterList struct {
}

type XlineArgs struct {
JaegerOffline bool `json:"jaeger-offline,omitempty"`
JaegerOnline bool `json:"jaeger-online,omitempty"`
JaegerLevel bool `json:"jaeger-level,omitempty"`
ClientUseBackoff bool `json:"client-use-backoff,omitempty"`
AuthPrivateKey *string `json:"auth-private-key,omitempty"`
AuthPublicKey *string `json:"auth-public-key,omitempty"`
JaegerOutputDir *string `json:"jaeger-output-dir,omitempty"`
LogFile *string `json:"log-file,omitempty"`
LogRotate *string `json:"log-rotate,omitempty"`

// +kubebuilder:validation:Enum=off;info;error;warn;trace;debug
LogLevel *string `json:"log-level,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
HeartbeatInterval *string `json:"heartbeat-interval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
ServerWaitSyncedTimeout *string `json:"server-wait-synced-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
RetryTimeout *string `json:"retry-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
RpcTimeout *string `json:"rpc-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
BatchTimeout *string `json:"batch-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
ClientWaitSyncedTimeout *string `json:"client-wait-synced-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
ClientProposeTimeout *string `json:"client-propose-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
ClientInitialRetryTimeout *string `json:"client-initial-retry-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
ClientMaxRetryTimeout *string `json:"client-max-retry-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
GcInterval *string `json:"gc-interval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
RangeRetryTimeout *string `json:"range-retry-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
CompactTimeout *string `json:"compact-timeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
SyncVictimsInterval *string `json:"sync-victims-interval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
WatchProgressNotifyInterval *string `json:"watch-progress-notify-interval,omitempty"`
CurpDir *string `json:"curp-dir,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s|m|h|d)
CompactSleepInterval *string `json:"compact-sleep-interval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(B|MB|GB)
BatchMaxSize *string `json:"batch-max-size,omitempty"`
JaegerOffline bool `json:"JaegerOffline,omitempty"`
JaegerOnline bool `json:"JaegerOnline,omitempty"`
ClientUseBackoff bool `json:"ClientUseBackoff,omitempty"`
JaegerLevel *string `json:"JaegerLevel,omitempty"`
JaegerOutputDir *string `json:"JaegerOutputDir,omitempty"`
LogFile *string `json:"LogFile,omitempty"`

// +kubebuilder:validation:Enum=never;hourly;daily
LogRotate *string `json:"LogRotate,omitempty"`

// +kubebuilder:validation:Enum=trace;debug;info;warn;error
LogLevel *string `json:"LogLevel,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms)
HeartbeatInterval *string `json:"HeartbeatInterval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(ms|s)
ServerWaitSyncedTimeout *string `json:"ServerWaitSyncedTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(ms|s)
RetryTimeout *string `json:"RetryTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
RpcTimeout *string `json:"RpcTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
BatchTimeout *string `json:"BatchTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
ClientWaitSyncedTimeout *string `json:"ClientWaitSyncedTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
ClientProposeTimeout *string `json:"ClientProposeTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
ClientInitialRetryTimeout *string `json:"ClientInitialRetryTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
ClientMaxRetryTimeout *string `json:"ClientMaxRetryTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
GcInterval *string `json:"GcInterval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
RangeRetryTimeout *string `json:"RangeRetryTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
CompactTimeout *string `json:"CompactTimeout,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
SyncVictimsInterval *string `json:"SyncVictimsInterval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
WatchProgressNotifyInterval *string `json:"WatchProgressNotifyInterval,omitempty"`
CurpDir *string `json:"CurpDir,omitempty"`
// +kubebuilder:validation:Pattern=\d+(us|ms|s)
CompactSleepInterval *string `json:"CompactSleepInterval,omitempty"`
// +kubebuilder:validation:Pattern=\d+(KB|MB|kb|mb)
BatchMaxSize *string `json:"BatchMaxSize,omitempty"`
// +kubebuilder:validation:Minimum=1
RetryCount int `json:"retry-count,omitempty"`
RetryCount int `json:"RetryCount,omitempty"`
// +kubebuilder:validation:Minimum=1
FollowerTimeoutTicks int `json:"follower-timeout-ticks,omitempty"`
FollowerTimeoutTicks int `json:"FollowerTimeoutTicks,omitempty"`
// +kubebuilder:validation:Minimum=1
CandidateTimeoutTicks int `json:"candidate-timeout-ticks,omitempty"`
CandidateTimeoutTicks int `json:"CandidateTimeoutTicks,omitempty"`
// +kubebuilder:validation:Minimum=1
LogEntriesCap int `json:"log-entries-cap,omitempty"`
LogEntriesCap int `json:"LogEntriesCap,omitempty"`
// +kubebuilder:validation:Minimum=1
CmdWorkers int `json:"cmd-workers,omitempty"`
CmdWorkers int `json:"CmdWorkers,omitempty"`
// +kubebuilder:validation:Minimum=1
CompactBatchSize int `json:"compact-batch-size,omitempty"`
CompactBatchSize int `json:"CompactBatchSize,omitempty"`
// +kubebuilder:validation:Minimum=1
Quota int `json:"quota,omitempty"`
Quota int `json:"Quota,omitempty"`
}

// ########################################
Expand All @@ -124,7 +124,7 @@ type XlineClusterSpec struct {

/// Xline container bootstrap arguments
/// Set additional arguments except [`--name`, `--members`, `--storage-engine`, `--data-dir`]
BootstrapArgs XlineArgs `json:"bootstrapArgs,omitempty"`
BootstrapArgs XlineArgs `json:"config,omitempty"`

// ImagePullPolicy of Xline cluster Pods
// +optional
Expand Down Expand Up @@ -184,6 +184,7 @@ type XlineClusterStatus struct {
type XlineClusterOprStage string

const (
StageXlineScriptCM XlineClusterOprStage = "Xline/ScriptCM"
StageXlineService XlineClusterOprStage = "Xline/Service"
StageXlineStatefulSet XlineClusterOprStage = "Xline/Statefulset"
StageComplete XlineClusterOprStage = "complete"
Expand Down
9 changes: 2 additions & 7 deletions api/v1alpha1/zz_generated.deepcopy.go

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

155 changes: 77 additions & 78 deletions config/crd/bases/xline.io.datenlord.com_xlineclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,129 +52,128 @@ spec:
- priKey
- pubKey
type: object
bootstrapArgs:
claims:
description: "Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container. \n This is an alpha field and requires
enabling the DynamicResourceAllocation feature gate. \n This field
is immutable. It can only be set for containers."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in pod.spec.resourceClaims
of the Pod where this field is used. It makes that resource
available inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
config:
description: / Xline container bootstrap arguments / Set additional
arguments except [`--name`, `--members`, `--storage-engine`, `--data-dir`]
properties:
auth-private-key:
BatchMaxSize:
pattern: \d+(KB|MB|kb|mb)
type: string
auth-public-key:
BatchTimeout:
pattern: \d+(us|ms|s)
type: string
batch-max-size:
pattern: \d+(B|MB|GB)
type: string
batch-timeout:
pattern: \d+(us|ms|s|m|h|d)
type: string
candidate-timeout-ticks:
CandidateTimeoutTicks:
minimum: 1
type: integer
client-initial-retry-timeout:
pattern: \d+(us|ms|s|m|h|d)
ClientInitialRetryTimeout:
pattern: \d+(us|ms|s)
type: string
client-max-retry-timeout:
pattern: \d+(us|ms|s|m|h|d)
ClientMaxRetryTimeout:
pattern: \d+(us|ms|s)
type: string
client-propose-timeout:
pattern: \d+(us|ms|s|m|h|d)
ClientProposeTimeout:
pattern: \d+(us|ms|s)
type: string
client-use-backoff:
ClientUseBackoff:
type: boolean
client-wait-synced-timeout:
pattern: \d+(us|ms|s|m|h|d)
ClientWaitSyncedTimeout:
pattern: \d+(us|ms|s)
type: string
cmd-workers:
CmdWorkers:
minimum: 1
type: integer
compact-batch-size:
CompactBatchSize:
minimum: 1
type: integer
compact-sleep-interval:
pattern: \d+(us|ms|s|m|h|d)
CompactSleepInterval:
pattern: \d+(us|ms|s)
type: string
compact-timeout:
pattern: \d+(us|ms|s|m|h|d)
CompactTimeout:
pattern: \d+(us|ms|s)
type: string
curp-dir:
CurpDir:
type: string
follower-timeout-ticks:
FollowerTimeoutTicks:
minimum: 1
type: integer
gc-interval:
pattern: \d+(us|ms|s|m|h|d)
GcInterval:
pattern: \d+(us|ms|s)
type: string
heartbeat-interval:
pattern: \d+(us|ms|s|m|h|d)
HeartbeatInterval:
pattern: \d+(us|ms)
type: string
jaeger-level:
type: boolean
jaeger-offline:
JaegerLevel:
type: string
JaegerOffline:
type: boolean
jaeger-online:
JaegerOnline:
type: boolean
jaeger-output-dir:
JaegerOutputDir:
type: string
log-entries-cap:
LogEntriesCap:
minimum: 1
type: integer
log-file:
LogFile:
type: string
log-level:
LogLevel:
enum:
- "off"
- info
- error
- warn
- trace
- debug
- info
- warn
- error
type: string
log-rotate:
LogRotate:
enum:
- never
- hourly
- daily
type: string
quota:
Quota:
minimum: 1
type: integer
range-retry-timeout:
pattern: \d+(us|ms|s|m|h|d)
RangeRetryTimeout:
pattern: \d+(us|ms|s)
type: string
retry-count:
RetryCount:
minimum: 1
type: integer
retry-timeout:
pattern: \d+(us|ms|s|m|h|d)
RetryTimeout:
pattern: \d+(ms|s)
type: string
rpc-timeout:
pattern: \d+(us|ms|s|m|h|d)
RpcTimeout:
pattern: \d+(us|ms|s)
type: string
server-wait-synced-timeout:
pattern: \d+(us|ms|s|m|h|d)
ServerWaitSyncedTimeout:
pattern: \d+(ms|s)
type: string
sync-victims-interval:
pattern: \d+(us|ms|s|m|h|d)
SyncVictimsInterval:
pattern: \d+(us|ms|s)
type: string
watch-progress-notify-interval:
pattern: \d+(us|ms|s|m|h|d)
WatchProgressNotifyInterval:
pattern: \d+(us|ms|s)
type: string
type: object
claims:
description: "Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container. \n This is an alpha field and requires
enabling the DynamicResourceAllocation feature gate. \n This field
is immutable. It can only be set for containers."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in pod.spec.resourceClaims
of the Pod where this field is used. It makes that resource
available inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
image:
description: Xline cluster image
type: string
Expand Down
20 changes: 20 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand All @@ -24,6 +36,14 @@ rules:
- get
- list
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
Loading

0 comments on commit 9650010

Please sign in to comment.