Skip to content

Commit

Permalink
on premises automation has been removed by default
Browse files Browse the repository at this point in the history
  • Loading branch information
testisnullus committed Jan 18, 2024
1 parent 8ff29e9 commit 98381a4
Show file tree
Hide file tree
Showing 25 changed files with 274 additions and 36 deletions.
14 changes: 7 additions & 7 deletions apis/clusters/v1beta1/cadence_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje
return err
}

if c.Spec.OnPremisesSpec != nil {
if c.Spec.OnPremisesSpec != nil && !c.Spec.OnPremisesSpec.DisableAutomation {
err = c.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -135,7 +135,7 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje
}

for _, awsArchival := range c.Spec.AWSArchival {
err := awsArchival.validate()
err = awsArchival.validate()
if err != nil {
return err
}
Expand All @@ -146,7 +146,7 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje
return fmt.Errorf("AdvancedVisibility array size must be between 0 and 1")
}

err := sp.validate()
err = sp.validate()
if err != nil {
return err
}
Expand All @@ -158,7 +158,7 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje
}

if pp.BundledKafkaSpec != nil {
err := pp.BundledKafkaSpec.validate()
err = pp.BundledKafkaSpec.validate()
if err != nil {
return err
}
Expand Down Expand Up @@ -194,12 +194,12 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje

for _, dc := range c.Spec.DataCentres {
if c.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.DataCentre.ValidateCreation()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand All @@ -215,7 +215,7 @@ func (cv *cadenceValidator) ValidateCreate(ctx context.Context, obj runtime.Obje
}

for _, rs := range c.Spec.ResizeSettings {
err := validateSingleConcurrentResize(rs.Concurrency)
err = validateSingleConcurrentResize(rs.Concurrency)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions apis/clusters/v1beta1/cassandra_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (cv *cassandraValidator) ValidateCreate(ctx context.Context, obj runtime.Ob
return err
}

if c.Spec.OnPremisesSpec != nil {
if c.Spec.OnPremisesSpec != nil && !c.Spec.OnPremisesSpec.DisableAutomation {
err = c.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -126,12 +126,12 @@ func (cv *cassandraValidator) ValidateCreate(ctx context.Context, obj runtime.Ob

for _, dc := range c.Spec.DataCentres {
if c.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.DataCentre.ValidateCreation()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions apis/clusters/v1beta1/kafka_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (kv *kafkaValidator) ValidateCreate(ctx context.Context, obj runtime.Object
return err
}

if k.Spec.OnPremisesSpec != nil {
if k.Spec.OnPremisesSpec != nil && !k.Spec.OnPremisesSpec.DisableAutomation {
err = k.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -120,12 +120,12 @@ func (kv *kafkaValidator) ValidateCreate(ctx context.Context, obj runtime.Object

for _, dc := range k.Spec.DataCentres {
if k.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.DataCentre.ValidateCreation()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func (kv *kafkaValidator) ValidateCreate(ctx context.Context, obj runtime.Object
}

for _, rs := range k.Spec.ResizeSettings {
err := validateSingleConcurrentResize(rs.Concurrency)
err = validateSingleConcurrentResize(rs.Concurrency)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions apis/clusters/v1beta1/kafkaconnect_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (kcv *kafkaConnectValidator) ValidateCreate(ctx context.Context, obj runtim
return err
}

if kc.Spec.OnPremisesSpec != nil {
if kc.Spec.OnPremisesSpec != nil && !kc.Spec.OnPremisesSpec.DisableAutomation {
err = kc.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -157,12 +157,12 @@ func (kcv *kafkaConnectValidator) ValidateCreate(ctx context.Context, obj runtim

for _, dc := range kc.Spec.DataCentres {
if kc.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.DataCentre.ValidateCreation()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions apis/clusters/v1beta1/postgresql_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (pgv *pgValidator) ValidateCreate(ctx context.Context, obj runtime.Object)
return err
}

if pg.Spec.OnPremisesSpec != nil {
if pg.Spec.OnPremisesSpec != nil && !pg.Spec.OnPremisesSpec.DisableAutomation {
err = pg.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -138,12 +138,12 @@ func (pgv *pgValidator) ValidateCreate(ctx context.Context, obj runtime.Object)

for _, dc := range pg.Spec.DataCentres {
if pg.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.DataCentre.ValidateCreation()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand All @@ -170,7 +170,7 @@ func (pgv *pgValidator) ValidateCreate(ctx context.Context, obj runtime.Object)
}

for _, rs := range pg.Spec.ResizeSettings {
err := validateSingleConcurrentResize(rs.Concurrency)
err = validateSingleConcurrentResize(rs.Concurrency)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions apis/clusters/v1beta1/redis_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (rv *redisValidator) ValidateCreate(ctx context.Context, obj runtime.Object
return err
}

if r.Spec.OnPremisesSpec != nil {
if r.Spec.OnPremisesSpec != nil && !r.Spec.OnPremisesSpec.DisableAutomation {
err = r.Spec.OnPremisesSpec.ValidateCreation()
if err != nil {
return err
Expand Down Expand Up @@ -136,12 +136,12 @@ func (rv *redisValidator) ValidateCreate(ctx context.Context, obj runtime.Object

for _, dc := range r.Spec.DataCentres {
if r.Spec.OnPremisesSpec != nil {
err := dc.DataCentre.ValidateOnPremisesCreation()
err = dc.DataCentre.ValidateOnPremisesCreation()
if err != nil {
return err
}
} else {
err := dc.ValidateCreate()
err = dc.DataCentre.ValidateCreation()
if err != nil {
return err
}
Expand All @@ -153,7 +153,7 @@ func (rv *redisValidator) ValidateCreate(ctx context.Context, obj runtime.Object
}

for _, rs := range r.Spec.ResizeSettings {
err := validateSingleConcurrentResize(rs.Concurrency)
err = validateSingleConcurrentResize(rs.Concurrency)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions apis/clusters/v1beta1/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type ClusteredMaintenanceEvent struct {
}

type OnPremisesSpec struct {
DisableAutomation bool `json:"disableAutomation"`
StorageClassName string `json:"storageClassName"`
OSDiskSize string `json:"osDiskSize"`
DataDiskSize string `json:"dataDiskSize"`
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_cadences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -159,6 +161,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_cassandras.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -175,6 +177,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -213,6 +215,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_kafkas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -199,6 +201,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_postgresqls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -183,6 +185,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/clusters.instaclustr.com_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ spec:
type: object
dataDiskSize:
type: string
disableAutomation:
type: boolean
nodeCPU:
format: int64
type: integer
Expand All @@ -149,6 +151,7 @@ spec:
required:
- cloudInitScriptRef
- dataDiskSize
- disableAutomation
- nodeCPU
- nodeMemory
- osDiskSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: kafkaconnect-sample
spec:
name: "kafkaconnect-onprem"
version: "3.1.2"
version: "3.5.1"
onPremisesSpec:
storageClassName: managed-csi-premium
osDiskSize: 20Gi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: clusters.instaclustr.com/v1beta1
kind: Cadence
metadata:
name: cadence-sample
spec:
name: "cadence-test"
version: "1.0.0"
onPremisesSpec:
disableAutomation: true
storageClassName: managed-csi-premium
osDiskSize: 20Gi
dataDiskSize: 200Gi
sshGatewayCPU: 2
sshGatewayMemory: 4096Mi
nodeCPU: 2
nodeMemory: 8192Mi
osImageURL: "https://s3.amazonaws.com/debian-bucket/debian-11-generic-amd64-20230601-1398.raw"
cloudInitScriptRef:
namespace: default
name: instaclustr-cloud-init-secret
standardProvisioning:
- targetCassandra:
dependencyCdcId: "9d43ac54-7317-4ce5-859a-e9d0443508a4"
dependencyVpcType: "TARGET_VPC"
privateNetworkCluster: false
dataCentres:
- region: "CLIENT_DC"
network: "10.1.0.0/16"
cloudProvider: "ONPREMISES"
name: "testdc"
nodeSize: "CAD-DEV-OP.4.8-200"
nodesNumber: 2
clientEncryption: false
slaTier: "NON_PRODUCTION"
useCadenceWebAuth: false
Loading

0 comments on commit 98381a4

Please sign in to comment.