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

chore: remove instanceset's role probe #8578

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions apis/workloads/v1/instanceset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ type InstanceSetSpec struct {
// +optional
Roles []ReplicaRole `json:"roles,omitempty"`
leon-inf marked this conversation as resolved.
Show resolved Hide resolved

// Provides method to probe role.
//
// +optional
RoleProbe *RoleProbe `json:"roleProbe,omitempty"`

// Provides actions to do membership dynamic reconfiguration.
//
// +optional
Expand Down Expand Up @@ -506,63 +501,6 @@ const (
NoneMode AccessMode = "None"
)

// RoleProbe defines how to observe role
type RoleProbe struct {
// Defines a custom method for role probing.
// Actions defined here are executed in series.
// Upon completion of all actions, the final output should be a single string representing the role name defined in spec.Roles.
// The latest [BusyBox](https://busybox.net/) image will be used if Image is not configured.
// Environment variables can be used in Command:
// - v_KB_ITS_LAST_STDOUT: stdout from the last action, watch for 'v_' prefix
// - KB_ITS_USERNAME: username part of the credential
// - KB_ITS_PASSWORD: password part of the credential
//
// +optional
CustomHandler []Action `json:"customHandler,omitempty"`

// Specifies the number of seconds to wait after the container has started before initiating role probing.
//
// +kubebuilder:default=0
// +kubebuilder:validation:Minimum=0
// +optional
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`

// Specifies the number of seconds after which the probe times out.
//
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=1
// +optional
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`

// Specifies the frequency (in seconds) of probe execution.
//
// +kubebuilder:default=2
// +kubebuilder:validation:Minimum=1
// +optional
PeriodSeconds int32 `json:"periodSeconds,omitempty"`

// Specifies the minimum number of consecutive successes for the probe to be considered successful after having failed.
//
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=1
// +optional
SuccessThreshold int32 `json:"successThreshold,omitempty"`

// Specifies the minimum number of consecutive failures for the probe to be considered failed after having succeeded.
//
// +kubebuilder:default=3
// +kubebuilder:validation:Minimum=1
// +optional
FailureThreshold int32 `json:"failureThreshold,omitempty"`

// Specifies the method for updating the pod role label.
//
// +kubebuilder:default=ReadinessProbeEventUpdate
// +kubebuilder:validation:Enum={ReadinessProbeEventUpdate, DirectAPIServerEventUpdate}
// +optional
RoleUpdateMechanism RoleUpdateMechanism `json:"roleUpdateMechanism,omitempty"`
}

type Action struct {
// Refers to the utility image that contains the command which can be utilized to retrieve or process role information.
//
Expand Down
27 changes: 0 additions & 27 deletions apis/workloads/v1/zz_generated.deepcopy.go

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

79 changes: 0 additions & 79 deletions config/crd/bases/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4174,85 +4174,6 @@ spec:
format: int32
minimum: 0
type: integer
roleProbe:
description: Provides method to probe role.
properties:
customHandler:
description: |-
Defines a custom method for role probing.
Actions defined here are executed in series.
Upon completion of all actions, the final output should be a single string representing the role name defined in spec.Roles.
The latest [BusyBox](https://busybox.net/) image will be used if Image is not configured.
Environment variables can be used in Command:
- v_KB_ITS_LAST_STDOUT: stdout from the last action, watch for 'v_' prefix
- KB_ITS_USERNAME: username part of the credential
- KB_ITS_PASSWORD: password part of the credential
items:
properties:
args:
description: Additional parameters used to perform specific
statements. This field is optional.
items:
type: string
type: array
command:
description: A set of instructions that will be executed
within the Container to retrieve or process role information.
This field is required.
items:
type: string
type: array
image:
description: Refers to the utility image that contains the
command which can be utilized to retrieve or process role
information.
type: string
required:
- command
type: object
type: array
failureThreshold:
default: 3
description: Specifies the minimum number of consecutive failures
for the probe to be considered failed after having succeeded.
format: int32
minimum: 1
type: integer
initialDelaySeconds:
default: 0
description: Specifies the number of seconds to wait after the
container has started before initiating role probing.
format: int32
minimum: 0
type: integer
periodSeconds:
default: 2
description: Specifies the frequency (in seconds) of probe execution.
format: int32
minimum: 1
type: integer
roleUpdateMechanism:
default: ReadinessProbeEventUpdate
description: Specifies the method for updating the pod role label.
enum:
- ReadinessProbeEventUpdate
- DirectAPIServerEventUpdate
type: string
successThreshold:
default: 1
description: Specifies the minimum number of consecutive successes
for the probe to be considered successful after having failed.
format: int32
minimum: 1
type: integer
timeoutSeconds:
default: 1
description: Specifies the number of seconds after which the probe
times out.
format: int32
minimum: 1
type: integer
type: object
roles:
description: A list of roles defined in the system.
items:
Expand Down
1 change: 0 additions & 1 deletion controllers/apps/transformer_component_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func copyAndMergeITS(oldITS, newITS *workloads.InstanceSet) *workloads.InstanceS
itsObjCopy.Spec.Template = *itsProto.Spec.Template.DeepCopy()
itsObjCopy.Spec.Replicas = itsProto.Spec.Replicas
itsObjCopy.Spec.Roles = itsProto.Spec.Roles
itsObjCopy.Spec.RoleProbe = itsProto.Spec.RoleProbe
itsObjCopy.Spec.MembershipReconfiguration = itsProto.Spec.MembershipReconfiguration
itsObjCopy.Spec.MemberUpdateStrategy = itsProto.Spec.MemberUpdateStrategy
itsObjCopy.Spec.Credential = itsProto.Spec.Credential
Expand Down
5 changes: 0 additions & 5 deletions controllers/workloads/instanceset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,10 @@ var _ = Describe("InstanceSet Controller", func() {
ObjectMeta: pod.ObjectMeta,
Spec: pod.Spec,
}
action := workloads.Action{
Image: "foo",
Command: []string{"bar"},
}
its := builder.NewInstanceSetBuilder(testCtx.DefaultNamespace, name).
AddMatchLabelsInMap(commonLabels).
AddAnnotations(constant.CRDAPIVersionAnnotationKey, workloads.GroupVersion.String()).
SetTemplate(template).
AddCustomHandler(action).
GetObject()
viper.Set(constant.KBToolsImage, "kb-tool-image")
Expect(k8sClient.Create(ctx, its)).Should(Succeed())
Expand Down
79 changes: 0 additions & 79 deletions deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4174,85 +4174,6 @@ spec:
format: int32
minimum: 0
type: integer
roleProbe:
description: Provides method to probe role.
properties:
customHandler:
description: |-
Defines a custom method for role probing.
Actions defined here are executed in series.
Upon completion of all actions, the final output should be a single string representing the role name defined in spec.Roles.
The latest [BusyBox](https://busybox.net/) image will be used if Image is not configured.
Environment variables can be used in Command:
- v_KB_ITS_LAST_STDOUT: stdout from the last action, watch for 'v_' prefix
- KB_ITS_USERNAME: username part of the credential
- KB_ITS_PASSWORD: password part of the credential
items:
properties:
args:
description: Additional parameters used to perform specific
statements. This field is optional.
items:
type: string
type: array
command:
description: A set of instructions that will be executed
within the Container to retrieve or process role information.
This field is required.
items:
type: string
type: array
image:
description: Refers to the utility image that contains the
command which can be utilized to retrieve or process role
information.
type: string
required:
- command
type: object
type: array
failureThreshold:
default: 3
description: Specifies the minimum number of consecutive failures
for the probe to be considered failed after having succeeded.
format: int32
minimum: 1
type: integer
initialDelaySeconds:
default: 0
description: Specifies the number of seconds to wait after the
container has started before initiating role probing.
format: int32
minimum: 0
type: integer
periodSeconds:
default: 2
description: Specifies the frequency (in seconds) of probe execution.
format: int32
minimum: 1
type: integer
roleUpdateMechanism:
default: ReadinessProbeEventUpdate
description: Specifies the method for updating the pod role label.
enum:
- ReadinessProbeEventUpdate
- DirectAPIServerEventUpdate
type: string
successThreshold:
default: 1
description: Specifies the minimum number of consecutive successes
for the probe to be considered successful after having failed.
format: int32
minimum: 1
type: integer
timeoutSeconds:
default: 1
description: Specifies the number of seconds after which the probe
times out.
format: int32
minimum: 1
type: integer
type: object
roles:
description: A list of roles defined in the system.
items:
Expand Down
Loading
Loading