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 070e4e0
Show file tree
Hide file tree
Showing 21 changed files with 684 additions and 533 deletions.
25 changes: 10 additions & 15 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 @@ -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-07T11:44:08Z"
}
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 070e4e0

Please sign in to comment.