Skip to content

Commit

Permalink
Add AutoOps for Kafka (#1362)
Browse files Browse the repository at this point in the history
* Add AutoOps for Kafka

Signed-off-by: raihankhan <[email protected]>
  • Loading branch information
raihankhan authored Dec 10, 2024
1 parent cac99cb commit 9ab2b7b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
12 changes: 12 additions & 0 deletions apis/kubedb/v1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1
import (
"context"
"fmt"
"time"

"kubedb.dev/apimachinery/apis/kubedb"

Expand Down Expand Up @@ -167,3 +168,14 @@ func GetSelectorForNetworkPolicy() map[string]string {
meta_util.ManagedByLabelKey: kubedb.GroupName,
}
}

func GetActivationTimeFromSecret(secretName *core.Secret) (*metav1.Time, error) {
if val, exists := secretName.Annotations[kubedb.AuthActiveFromAnnotation]; exists {
t, err := time.Parse(time.RFC3339, val)
if err != nil {
return nil, err
}
return &metav1.Time{Time: t}, nil
}
return nil, nil
}
4 changes: 4 additions & 0 deletions apis/kubedb/v1/kafka_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type Kafka struct {

// KafkaSpec defines the desired state of Kafka
type KafkaSpec struct {
// AutoOps contains configuration of automatic ops-request-recommendation generation
// +optional
AutoOps AutoOpsSpec `json:"autoOps,omitempty"`

// Version of Kafka to be deployed.
Version string `json:"version"`

Expand Down
9 changes: 8 additions & 1 deletion apis/kubedb/v1/openapi_generated.go

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

1 change: 1 addition & 0 deletions apis/kubedb/v1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions crds/kubedb.com_kafkas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
autoOps:
properties:
disabled:
type: boolean
type: object
configSecret:
properties:
name:
Expand Down

0 comments on commit 9ab2b7b

Please sign in to comment.