Skip to content

Commit

Permalink
Added logic for provisioning On-premises Cassandra cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
testisnullus committed Sep 30, 2023
1 parent ffc2a11 commit 29686af
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
5 changes: 0 additions & 5 deletions apis/clusterresources/v1beta1/postgresqluser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ type ClusterInfo struct {
Event string `json:"event,omitempty"`
}

type NamespacedName struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

Expand Down
5 changes: 5 additions & 0 deletions apis/clusterresources/v1beta1/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ type SecretReference struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
}

type NamespacedName struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
}
16 changes: 15 additions & 1 deletion apis/clusters/v1beta1/cassandra_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ type CassandraRestoreFrom struct {

// CassandraSpec defines the desired state of Cassandra
type CassandraSpec struct {
RestoreFrom *CassandraRestoreFrom `json:"restoreFrom,omitempty"`
OnPremisesSpec *CassandraOnPremisesSpec `json:"onPremisesSpec,omitempty"`
RestoreFrom *CassandraRestoreFrom `json:"restoreFrom,omitempty"`
Cluster `json:",inline"`
DataCentres []*CassandraDataCentre `json:"dataCentres,omitempty"`
LuceneEnabled bool `json:"luceneEnabled,omitempty"`
Expand All @@ -67,6 +68,19 @@ type CassandraSpec struct {
ResizeSettings []*ResizeSettings `json:"resizeSettings,omitempty"`
}

type CassandraOnPremisesSpec struct {
DeleteDisksWithVM bool `json:"deleteDisksWithVM,omitempty"`
StorageClassName string `json:"storageClassName"`
SystemDiskSize string `json:"systemDiskSize"`
DataDiskSize string `json:"dataDiskSize"`
SSHGatewayCPU int64 `json:"sshGatewayCPU"`
SSHGatewayMemory string `json:"sshGatewayMemory"`
NodeCPU int64 `json:"nodeCPU"`
NodeMemory string `json:"nodeMemory"`
OSImageURL string `json:"osImageURL"`
CloudInitScriptNamespacedName *NamespacedName `json:"cloudInitScriptNamespacedName"`
}

// CassandraStatus defines the observed state of Cassandra
type CassandraStatus struct {
ClusterStatus `json:",inline"`
Expand Down
5 changes: 5 additions & 0 deletions apis/clusters/v1beta1/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ type privateLinkStatus struct {
EndPointServiceName string `json:"endPointServiceName,omitempty"`
}

type NamespacedName struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
}

type PrivateLinkStatuses []*privateLinkStatus

func (p1 PrivateLinkStatuses) Equal(p2 PrivateLinkStatuses) bool {
Expand Down
4 changes: 0 additions & 4 deletions controllers/clusters/cassandra_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ import (
"github.com/instaclustr/operator/pkg/scheduler"
)

const (
StatusRUNNING = "RUNNING"
)

// CassandraReconciler reconciles a Cassandra object
type CassandraReconciler struct {
client.Client
Expand Down
2 changes: 1 addition & 1 deletion controllers/clusters/kafka_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (r *KafkaReconciler) handleUpdateCluster(
return models.ExitReconcile
}

if iKafka.Status.ClusterStatus.State != StatusRUNNING {
if iKafka.Status.ClusterStatus.State != models.RunningStatus {
l.Error(instaclustr.ClusterNotRunning, "Unable to update cluster, cluster still not running",
"cluster name", k.Spec.Name,
"cluster state", iKafka.Status.ClusterStatus.State)
Expand Down

0 comments on commit 29686af

Please sign in to comment.