Skip to content

Commit

Permalink
kafka codebase refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Siryk authored and Bohdan Siryk committed Feb 8, 2024
1 parent bff1424 commit f07cd8d
Show file tree
Hide file tree
Showing 22 changed files with 687 additions and 537 deletions.
31 changes: 13 additions & 18 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -114,15 +118,6 @@
}
],
"results": {
".git/config": [
{
"type": "Base64 High Entropy String",
"filename": ".git/config",
"hashed_secret": "a16bf940eb9599e3a77ae599906a4e71e4e52243",
"is_verified": false,
"line_number": 23
}
],
"apis/clusterresources/v1beta1/cassandrauser_types.go": [
{
"type": "Secret Keyword",
Expand Down Expand Up @@ -190,21 +185,21 @@
"filename": "apis/clusters/v1beta1/cassandra_types.go",
"hashed_secret": "331cc743251c3b9504229de4d139c539da121a33",
"is_verified": false,
"line_number": 263
"line_number": 262
},
{
"type": "Secret Keyword",
"filename": "apis/clusters/v1beta1/cassandra_types.go",
"hashed_secret": "0ad8d7005e084d4f028a4277b73c6fab24269c17",
"is_verified": false,
"line_number": 349
"line_number": 348
},
{
"type": "Secret Keyword",
"filename": "apis/clusters/v1beta1/cassandra_types.go",
"hashed_secret": "e0a46b27231f798fe22dc4d5d82b5feeb5dcf085",
"is_verified": false,
"line_number": 414
"line_number": 413
}
],
"apis/clusters/v1beta1/cassandra_webhook.go": [
Expand All @@ -222,14 +217,14 @@
"filename": "apis/clusters/v1beta1/kafka_types.go",
"hashed_secret": "964c67cddfe8e6707157152dcf319126502199dc",
"is_verified": false,
"line_number": 206
"line_number": 294
},
{
"type": "Secret Keyword",
"filename": "apis/clusters/v1beta1/kafka_types.go",
"hashed_secret": "75ba0f10db4ab09467225d44f7911a3f724a0917",
"hashed_secret": "589a0ad3cc6bc886a00c46a22e5065c48bd8e1b2",
"is_verified": false,
"line_number": 374
"line_number": 440
}
],
"apis/clusters/v1beta1/kafkaconnect_types.go": [
Expand Down Expand Up @@ -395,7 +390,7 @@
"filename": "apis/clusters/v1beta1/zz_generated.deepcopy.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 2174
"line_number": 2223
}
],
"apis/kafkamanagement/v1beta1/kafkauser_types.go": [
Expand Down Expand Up @@ -744,7 +739,7 @@
"filename": "pkg/instaclustr/client.go",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 2048
"line_number": 2054
}
],
"pkg/instaclustr/mock/client.go": [
Expand Down Expand Up @@ -1135,5 +1130,5 @@
}
]
},
"generated_at": "2024-02-06T13:59:12Z"
"generated_at": "2024-02-08T08:15:55Z"
}
3 changes: 1 addition & 2 deletions apis/clusters/v1beta1/cassandra_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ type CassandraSpec struct {
PasswordAndUserAuth bool `json:"passwordAndUserAuth,omitempty"`
BundledUseOnly bool `json:"bundledUseOnly,omitempty"`
UserRefs References `json:"userRefs,omitempty"`
//+kubebuilder:validate:MaxItems:=1
ResizeSettings GenericResizeSettings `json:"resizeSettings,omitempty"`
ResizeSettings GenericResizeSettings `json:"resizeSettings,omitempty"`
}

// CassandraStatus defines the observed state of Cassandra
Expand Down
14 changes: 7 additions & 7 deletions apis/clusters/v1beta1/cassandra_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,17 @@ func (cv *cassandraValidator) ValidateUpdate(ctx context.Context, old runtime.Ob
return fmt.Errorf("cannot assert object %v to cassandra", new.GetObjectKind())
}

cassandralog.Info("validate update", "name", c.Name)

// skip validation when we receive cluster specification update from the Instaclustr Console.
if c.Annotations[models.ResourceStateAnnotation] == models.CreatingEvent {
return nil
}

// skip validation when we receive cluster specification update from the Instaclustr Console.
if c.Status.ID == "" {
return cv.ValidateCreate(ctx, c)
}

cassandralog.Info("validate update", "name", c.Name)

if c.Annotations[models.ExternalChangesAnnotation] == models.True {
return nil
}
Expand All @@ -200,10 +204,6 @@ func (cv *cassandraValidator) ValidateUpdate(ctx context.Context, old runtime.Ob
return nil
}

if c.Status.ID == "" {
return cv.ValidateCreate(ctx, c)
}

err := c.Spec.validateUpdate(oldCluster.Spec)
if err != nil {
return fmt.Errorf("cannot update immutable fields: %v", err)
Expand Down
Loading

0 comments on commit f07cd8d

Please sign in to comment.