Skip to content

Commit

Permalink
issue-613, default cluster name
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiienkoMykyta authored and ribaraka committed Dec 11, 2023
1 parent 388c59b commit 065b544
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/cadence_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var _ webhook.Defaulter = &Cadence{}
func (c *Cadence) Default() {
cadencelog.Info("default", "name", c.Name)

if c.Spec.Name == "" {
c.Spec.Name = c.Name
}

if c.GetAnnotations() == nil {
c.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/cassandra_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ var _ webhook.Defaulter = &Cassandra{}
func (c *Cassandra) Default() {
cassandralog.Info("default", "name", c.Name)

if c.Spec.Name == "" {
c.Spec.Name = c.Name
}

if c.GetAnnotations() == nil {
c.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/kafka_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var _ webhook.Defaulter = &Kafka{}
func (k *Kafka) Default() {
kafkalog.Info("default", "name", k.Name)

if k.Spec.Name == "" {
k.Spec.Name = k.Name
}

if k.GetAnnotations() == nil {
k.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/kafkaconnect_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ var _ webhook.Defaulter = &KafkaConnect{}
func (r *KafkaConnect) Default() {
kafkaconnectlog.Info("default", "name", r.Name)

if r.Spec.Name == "" {
r.Spec.Name = r.Name
}

if r.GetAnnotations() == nil {
r.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/opensearch_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func (os *OpenSearch) Default() {
}

opensearchlog.Info("default values are set", "name", os.Name)

if os.Spec.Name == "" {
os.Spec.Name = os.Name
}
}

func setDefaultValues(dc *OpenSearchDataCentre) {
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/postgresql_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ var _ webhook.Defaulter = &PostgreSQL{}
func (pg *PostgreSQL) Default() {
postgresqllog.Info("default", "name", pg.Name)

if pg.Spec.Name == "" {
pg.Spec.Name = pg.Name
}

if pg.GetAnnotations() == nil {
pg.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/redis_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var _ webhook.Defaulter = &Redis{}
func (r *Redis) Default() {
redislog.Info("default", "name", r.Name)

if r.Spec.Name == "" {
r.Spec.Name = r.Name
}

if r.GetAnnotations() == nil {
r.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
4 changes: 4 additions & 0 deletions apis/clusters/v1beta1/zookeeper_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var _ webhook.Defaulter = &Zookeeper{}
func (z *Zookeeper) Default() {
redislog.Info("default", "name", z.Name)

if z.Spec.Name == "" {
z.Spec.Name = z.Name
}

if z.GetAnnotations() == nil {
z.SetAnnotations(map[string]string{
models.ResourceStateAnnotation: "",
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/cadence.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@
## Cluster create flow
To create a Cadence cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# cadence.yaml
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
## Cluster create flow
To create a Cassandra cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# cassandra.yaml
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/kafka-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
## Cluster create flow
To create a Kafka Connect cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# kafkaconnect.yaml

Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
## Cluster create flow
To create a Kafka cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
kafka.yaml
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down
4 changes: 4 additions & 0 deletions doc/clusters/opensearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
## Cluster creation example

To create a cluster you need to prepare a cluster manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# opensearch.yaml file
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@

## Cluster creation example

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

To create a cluster you need to prepare a cluster manifest. Here is an example:
```yaml
# postgresql.yaml file
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
## Cluster create flow
To create a Redis cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# redis.yaml
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down
3 changes: 3 additions & 0 deletions doc/clusters/zookeeper.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
## Cluster create flow
To create a Zookeeper cluster instance you need to prepare the yaml manifest. Here is an example:

Notice:
- If you choose to omit the cluster name in the specification, the operator will use it from the metadata name instead. In this case make sure that metadata name matches the name pattern, you can check the pattern on instaclustr API specification

```yaml
# zookeeper.yaml
apiVersion: clusters.instaclustr.com/v1beta1
Expand Down

0 comments on commit 065b544

Please sign in to comment.