Skip to content

Commit

Permalink
Add reconfigure ops-request
Browse files Browse the repository at this point in the history
Signed-off-by: MobarakHsn <[email protected]>
  • Loading branch information
MobarakHsn committed May 27, 2024
1 parent 2f72e37 commit 011d968
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 6 deletions.
1 change: 1 addition & 0 deletions apis/kubedb/v1alpha2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ const (
PgpoolPrimaryServicePortName = "primary"
PgpoolDatabasePortName = "db"
PgpoolPcpServicePortName = "pcp"
PgpoolCustomConfigFile = "pgpool.conf"
// ========================================== ZooKeeper Constants =================================================//

KubeDBZooKeeperRoleName = "kubedb:zookeeper-version-reader"
Expand Down
4 changes: 2 additions & 2 deletions apis/kubedb/v1alpha2/pgpool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ func (p *Pgpool) ValidateCreateOrUpdate() field.ErrorList {
err.Error(),
))
}
_, ok := secret.Data["pgpool.conf"]
_, ok := secret.Data[PgpoolCustomConfigFile]
if !ok {
errorList = append(errorList, field.Invalid(field.NewPath("spec").Child("configSecret"),
p.Name,
"`pgpool.conf` is missing",
fmt.Sprintf("`%v` is missing", PgpoolCustomConfigFile),
))
}
}
Expand Down
49 changes: 48 additions & 1 deletion apis/ops/v1alpha1/openapi_generated.go

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

12 changes: 10 additions & 2 deletions apis/ops/v1alpha1/pgpool_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type PgpoolOpsRequestSpec struct {
Type PgpoolOpsRequestType `json:"type"`
// Specifies information necessary for vertical scaling
VerticalScaling *PgpoolVerticalScalingSpec `json:"verticalScaling,omitempty"`
// Specifies information necessary for custom configuration of Pgpool
Configuration *PgpoolCustomConfigurationSpec `json:"configuration,omitempty"`
// Specifies information necessary for restarting database
Restart *RestartSpec `json:"restart,omitempty"`
// Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.
Expand All @@ -65,8 +67,8 @@ type PgpoolOpsRequestSpec struct {
Apply ApplyOption `json:"apply,omitempty"`
}

// +kubebuilder:validation:Enum=VerticalScaling;VolumeExpansion;Restart
// ENUM(VerticalScaling, Restart)
// +kubebuilder:validation:Enum=VerticalScaling;Reconfigure;Restart
// ENUM(VerticalScaling, Restart, Reconfigure)
type PgpoolOpsRequestType string

// PgpoolReplicaReadinessCriteria is the criteria for checking readiness of a Pgpool pod
Expand All @@ -79,6 +81,12 @@ type PgpoolVerticalScalingSpec struct {
Node *PodResources `json:"node,omitempty"`
}

type PgpoolCustomConfigurationSpec struct {
ConfigSecret *core.LocalObjectReference `json:"configSecret,omitempty"`
ApplyConfig map[string]string `json:"applyConfig,omitempty"`
RemoveCustomConfig bool `json:"removeCustomConfig,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PgpoolOpsRequestList is a list of PgpoolOpsRequests
Expand Down
5 changes: 5 additions & 0 deletions apis/ops/v1alpha1/pgpool_ops_types_enum.go

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

33 changes: 33 additions & 0 deletions apis/ops/v1alpha1/zz_generated.deepcopy.go

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

17 changes: 16 additions & 1 deletion crds/ops.kubedb.com_pgpoolopsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ spec:
- IfReady
- Always
type: string
configuration:
properties:
applyConfig:
additionalProperties:
type: string
type: object
configSecret:
properties:
name:
type: string
type: object
x-kubernetes-map-type: atomic
removeCustomConfig:
type: boolean
type: object
databaseRef:
properties:
name:
Expand All @@ -61,7 +76,7 @@ spec:
type:
enum:
- VerticalScaling
- VolumeExpansion
- Reconfigure
- Restart
type: string
verticalScaling:
Expand Down

0 comments on commit 011d968

Please sign in to comment.