diff --git a/apis/kubedb/v1/helpers.go b/apis/kubedb/v1/helpers.go index 1a3fecfb44..7a2ef65d55 100644 --- a/apis/kubedb/v1/helpers.go +++ b/apis/kubedb/v1/helpers.go @@ -19,6 +19,7 @@ package v1 import ( "context" "fmt" + "time" "kubedb.dev/apimachinery/apis/kubedb" @@ -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 +} diff --git a/apis/kubedb/v1/kafka_types.go b/apis/kubedb/v1/kafka_types.go index f526bc5549..ed77f58065 100644 --- a/apis/kubedb/v1/kafka_types.go +++ b/apis/kubedb/v1/kafka_types.go @@ -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"` diff --git a/apis/kubedb/v1/openapi_generated.go b/apis/kubedb/v1/openapi_generated.go index 75df963983..f66051e805 100644 --- a/apis/kubedb/v1/openapi_generated.go +++ b/apis/kubedb/v1/openapi_generated.go @@ -26921,6 +26921,13 @@ func schema_apimachinery_apis_kubedb_v1_KafkaSpec(ref common.ReferenceCallback) Description: "KafkaSpec defines the desired state of Kafka", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "autoOps": { + SchemaProps: spec.SchemaProps{ + Description: "AutoOps contains configuration of automatic ops-request-recommendation generation", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1.AutoOpsSpec"), + }, + }, "version": { SchemaProps: spec.SchemaProps{ Description: "Version of Kafka to be deployed.", @@ -27052,7 +27059,7 @@ func schema_apimachinery_apis_kubedb_v1_KafkaSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "kmodules.xyz/client-go/api/v1.HealthCheckSpec", "kmodules.xyz/client-go/api/v1.TLSConfig", "kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec", "kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1.KafkaClusterTopology", "kubedb.dev/apimachinery/apis/kubedb/v1.KafkaCruiseControl", "kubedb.dev/apimachinery/apis/kubedb/v1.NamedServiceTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1.SecretReference"}, + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "kmodules.xyz/client-go/api/v1.HealthCheckSpec", "kmodules.xyz/client-go/api/v1.TLSConfig", "kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec", "kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1.AutoOpsSpec", "kubedb.dev/apimachinery/apis/kubedb/v1.KafkaClusterTopology", "kubedb.dev/apimachinery/apis/kubedb/v1.KafkaCruiseControl", "kubedb.dev/apimachinery/apis/kubedb/v1.NamedServiceTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1.SecretReference"}, } } diff --git a/apis/kubedb/v1/zz_generated.deepcopy.go b/apis/kubedb/v1/zz_generated.deepcopy.go index aae7c40370..0308843cae 100644 --- a/apis/kubedb/v1/zz_generated.deepcopy.go +++ b/apis/kubedb/v1/zz_generated.deepcopy.go @@ -906,6 +906,7 @@ func (in *KafkaNode) DeepCopy() *KafkaNode { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KafkaSpec) DeepCopyInto(out *KafkaSpec) { *out = *in + out.AutoOps = in.AutoOps if in.Replicas != nil { in, out := &in.Replicas, &out.Replicas *out = new(int32) diff --git a/crds/kubedb.com_kafkas.yaml b/crds/kubedb.com_kafkas.yaml index e57b8634c7..00df86be6f 100644 --- a/crds/kubedb.com_kafkas.yaml +++ b/crds/kubedb.com_kafkas.yaml @@ -60,6 +60,11 @@ spec: type: string type: object x-kubernetes-map-type: atomic + autoOps: + properties: + disabled: + type: boolean + type: object configSecret: properties: name: