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

[KO-335] Adding support for HPA #307

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion api/v1/aerospikecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ type AerospikeClusterStatus struct { //nolint:govet // for readability
Pods map[string]AerospikePodStatus `json:"pods" patchStrategy:"strategic"`

// Phase denotes the current phase of Aerospike cluster operation.
Phase AerospikeClusterPhase `json:"phase,omitempty"`
Phase AerospikeClusterPhase `json:"phase,omitempty"`
Selector string `json:"selector"`
}

// AerospikeNetworkType specifies the type of network address to use.
Expand Down Expand Up @@ -921,6 +922,7 @@ type AerospikePodStatus struct { //nolint:govet // for readability
// +kubebuilder:printcolumn:name="HostNetwork",type=boolean,JSONPath=`.spec.podSpec.hostNetwork`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
//+kubebuilder:subresource:scale:specpath=.spec.size,statuspath=.status.size,selectorpath=.status.selector
abhishekdwivedi3060 marked this conversation as resolved.
Show resolved Hide resolved

// AerospikeCluster is the schema for the AerospikeCluster API
// +operator-sdk:csv:customresourcedefinitions:displayName="Aerospike Cluster",resources={{Service, v1},{Pod,v1},{StatefulSet,v1}}
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/asdb.aerospike.com_aerospikeclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18282,6 +18282,8 @@ spec:
type: integer
type: object
type: object
selector:
type: string
size:
description: Aerospike cluster size
format: int32
Expand Down Expand Up @@ -18893,11 +18895,17 @@ spec:
- skipWorkDirValidate
- skipXdrDlogFileValidate
type: object
required:
- selector
type: object
type: object
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.size
statusReplicasPath: .status.size
status: {}
- additionalPrinterColumns:
- jsonPath: .spec.size
Expand Down
4 changes: 4 additions & 0 deletions controllers/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
k8sRuntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -428,6 +429,9 @@ func (r *SingleClusterReconciler) updateStatus() error {
newAeroCluster.Status.IsReadinessProbeEnabled = clusterReadinessEnable
}

selector := labels.SelectorFromSet(utils.LabelsForAerospikeCluster(newAeroCluster.Name))
newAeroCluster.Status.Selector = selector.String()

err = r.patchStatus(newAeroCluster)
if err != nil {
return fmt.Errorf("error updating status: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18282,6 +18282,8 @@ spec:
type: integer
type: object
type: object
selector:
type: string
size:
description: Aerospike cluster size
format: int32
Expand Down Expand Up @@ -18893,11 +18895,17 @@ spec:
- skipWorkDirValidate
- skipXdrDlogFileValidate
type: object
required:
- selector
type: object
type: object
served: true
storage: true
subresources:
scale:
labelSelectorPath: .status.selector
specReplicasPath: .spec.size
statusReplicasPath: .status.size
status: {}
- additionalPrinterColumns:
- jsonPath: .spec.size
Expand Down
Loading