Skip to content

Commit

Permalink
cluster backup and cluster restore were migrated to APIv2 for postgre…
Browse files Browse the repository at this point in the history
…s cassandra redis and opensearch
  • Loading branch information
tengu-alt committed Sep 14, 2023
1 parent 7c0608c commit cbeaace
Show file tree
Hide file tree
Showing 24 changed files with 207 additions and 240 deletions.
11 changes: 2 additions & 9 deletions apis/clusters/v1beta1/cassandra_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,15 @@ type Spark struct {
Version string `json:"version"`
}

type CassandraRestoreDC struct {
CDCID string `json:"cdcId,omitempty"`
RestoreToSameVPC bool `json:"restoreToSameVpc,omitempty"`
CustomVPCID string `json:"customVpcId,omitempty"`
CustomVPCNetwork string `json:"customVpcNetwork,omitempty"`
}

type CassandraRestoreFrom struct {
// Original cluster ID. Backup from that cluster will be used for restore
ClusterID string `json:"clusterID"`

// The display name of the restored cluster.
ClusterNameOverride string `json:"clusterNameOverride,omitempty"`
RestoredClusterName string `json:"restoredClusterName,omitempty"`

// An optional list of cluster data centres for which custom VPC settings will be used.
CDCInfos []CassandraRestoreDC `json:"cdcInfos,omitempty"`
CDCConfigs []*RestoreCDCConfigs `json:"cdcConfigs,omitempty"`

// Timestamp in milliseconds since epoch. All backed up data will be restored for this point in time.
PointInTime int64 `json:"pointInTime,omitempty"`
Expand Down
14 changes: 2 additions & 12 deletions apis/clusters/v1beta1/opensearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,26 +459,16 @@ type OpenSearchRestoreFrom struct {
ClusterID string `json:"clusterId"`

// The display name of the restored cluster.
ClusterNameOverride string `json:"clusterNameOverride,omitempty"`
RestoredClusterName string `json:"restoredClusterName,omitempty"`

// An optional list of cluster data centres for which custom VPC settings will be used.
CDCInfos []*OpenSearchRestoreCDCInfo `json:"cdcInfos,omitempty"`
CDCConfigs []*RestoreCDCConfigs `json:"cdcConfigs,omitempty"`

// Timestamp in milliseconds since epoch. All backed up data will be restored for this point in time.
PointInTime int64 `json:"pointInTime,omitempty"`

// Only data for the specified indices will be restored, for the point in time.
IndexNames string `json:"indexNames,omitempty"`

// The cluster network for this cluster to be restored to.
ClusterNetwork string `json:"clusterNetwork,omitempty"`
}

type OpenSearchRestoreCDCInfo struct {
CDCID string `json:"cdcId,omitempty"`
RestoreToSameVPC bool `json:"restoreToSameVpc,omitempty"`
CustomVPCID string `json:"customVpcId,omitempty"`
CustomVPCNetwork string `json:"customVpcNetwork,omitempty"`
}

// OpenSearchStatus defines the observed state of OpenSearch
Expand Down
14 changes: 2 additions & 12 deletions apis/clusters/v1beta1/postgresql_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,13 @@ type PgRestoreFrom struct {
ClusterID string `json:"clusterId"`

// The display name of the restored cluster.
ClusterNameOverride string `json:"clusterNameOverride,omitempty"`
RestoredClusterName string `json:"restoredClusterName,omitempty"`

// An optional list of cluster data centres for which custom VPC settings will be used.
CDCInfos []*PgRestoreCDCInfo `json:"cdcInfos,omitempty"`
CDCConfigs []*RestoreCDCConfigs `json:"cdsConfigs,omitempty"`

// Timestamp in milliseconds since epoch. All backed up data will be restored for this point in time.
PointInTime int64 `json:"pointInTime,omitempty"`

// The cluster network for this cluster to be restored to.
ClusterNetwork string `json:"clusterNetwork,omitempty"`
}

type PgRestoreCDCInfo struct {
CDCID string `json:"cdcId,omitempty"`
RestoreToSameVPC bool `json:"restoreToSameVpc,omitempty"`
CustomVPCID string `json:"customVpcId,omitempty"`
CustomVPCNetwork string `json:"customVpcNetwork,omitempty"`
}

// PgSpec defines the desired state of PostgreSQL
Expand Down
14 changes: 2 additions & 12 deletions apis/clusters/v1beta1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,16 @@ type RedisRestoreFrom struct {
ClusterID string `json:"clusterId"`

// The display name of the restored cluster.
ClusterNameOverride string `json:"clusterNameOverride,omitempty"`
RestoredClusterName string `json:"restoredClusterName,omitempty"`

// An optional list of cluster data centres for which custom VPC settings will be used.
CDCInfos []*RedisRestoreCDCInfo `json:"cdcInfos,omitempty"`
CDCConfigs []*RestoreCDCConfigs `json:"cdcConfigs,omitempty"`

// Timestamp in milliseconds since epoch. All backed up data will be restored for this point in time.
PointInTime int64 `json:"pointInTime,omitempty"`

// Only data for the specified indices will be restored, for the point in time.
IndexNames string `json:"indexNames,omitempty"`

// The cluster network for this cluster to be restored to.
ClusterNetwork string `json:"clusterNetwork,omitempty"`
}

type RedisRestoreCDCInfo struct {
CDCID string `json:"cdcId,omitempty"`
RestoreToSameVPC bool `json:"restoreToSameVpc,omitempty"`
CustomVPCID string `json:"customVpcId,omitempty"`
CustomVPCNetwork string `json:"customVpcNetwork,omitempty"`
}

// RedisSpec defines the desired state of Redis
Expand Down
11 changes: 11 additions & 0 deletions apis/clusters/v1beta1/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ type DataCentreStatus struct {
PrivateLink PrivateLinkStatuses `json:"privateLink,omitempty"`
}

type RestoreCDCConfigs struct {
CustomVPCSettings *RestoreCustomVPCSettings `json:"customVpcSettings,omitempty"`
RestoreMode string `json:"restoreMode,omitempty"`
CDCID string `json:"cdcId,omitempty"`
}

type RestoreCustomVPCSettings struct {
VpcID string `json:"vpcId,omitempty"`
Network string `json:"network,omitempty"`
}

type Node struct {
ID string `json:"id,omitempty"`
Size string `json:"size,omitempty"`
Expand Down
139 changes: 60 additions & 79 deletions apis/clusters/v1beta1/zz_generated.deepcopy.go

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

21 changes: 12 additions & 9 deletions config/crd/bases/clusters.instaclustr.com_cassandras.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,28 @@ spec:
type: boolean
restoreFrom:
properties:
cdcInfos:
cdcConfigs:
description: An optional list of cluster data centres for which
custom VPC settings will be used.
items:
properties:
cdcId:
type: string
customVpcId:
type: string
customVpcNetwork:
customVpcSettings:
properties:
network:
type: string
vpcId:
type: string
type: object
restoreMode:
type: string
restoreToSameVpc:
type: boolean
type: object
type: array
clusterID:
description: Original cluster ID. Backup from that cluster will
be used for restore
type: string
clusterNameOverride:
description: The display name of the restored cluster.
type: string
clusterNetwork:
description: The cluster network for this cluster to be restored
to.
Expand All @@ -143,6 +143,9 @@ spec:
up data will be restored for this point in time.
format: int64
type: integer
restoredClusterName:
description: The display name of the restored cluster.
type: string
required:
- clusterID
type: object
Expand Down
Loading

0 comments on commit cbeaace

Please sign in to comment.