diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d1f787a..7ba070d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,7 +42,7 @@ jobs: - name: Create Kubernetes Cluster uses: helm/kind-action@v1 - name: Install CRDs - run: kubectl create -f https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.47.0/strimzi-crds-0.47.0.yaml + run: kubectl create -f https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.48.0/strimzi-crds-0.48.0.yaml # Test the project - name: Test the project run: make test diff --git a/README.md b/README.md index 0457cd2..e1d00a4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ The following table shows the supported Strimzi versions | `0.2.x` | 0.45.0 | | `0.3.x` | 0.46.0 | | `0.4.x` | 0.47.x | +| `0.5.x` | 0.48.x | ## Examples @@ -25,6 +26,7 @@ If you are using the Strimzi Go API, feel free to open a PR and add your project * [Keksposé](https://github.com/scholzj/kekspose): Expose your Strimzi-based Apache Kafka cluster outside your Minikube, Kind, or Docker Desktop clusters * [Strimzi Shutdown](https://github.com/scholzj/strimzi-shutdown): Simple utility to temporarily stop or restart your Strimzi-based Apache Kafka cluster +* [Strimzi Backup](https://github.com/scholzj/strimzi-backup): Backup or restore Strimzi-managed Apache Kafka clusters ## Updating the APIs diff --git a/examples/create-kafka/main.go b/examples/create-kafka/main.go index 1daa7c7..12958f4 100644 --- a/examples/create-kafka/main.go +++ b/examples/create-kafka/main.go @@ -3,6 +3,10 @@ package main import ( "context" "flag" + "log" + "path/filepath" + "time" + kafkav1beta2 "github.com/scholzj/strimzi-go/pkg/apis/kafka.strimzi.io/v1beta2" strimziclient "github.com/scholzj/strimzi-go/pkg/client/clientset/versioned" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -10,9 +14,6 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/util/homedir" - "log" - "path/filepath" - "time" ) func main() { diff --git a/examples/delete-kafka/main.go b/examples/delete-kafka/main.go index 9a9be49..4b731fa 100644 --- a/examples/delete-kafka/main.go +++ b/examples/delete-kafka/main.go @@ -3,12 +3,13 @@ package main import ( "context" "flag" + "log" + "path/filepath" + strimziclient "github.com/scholzj/strimzi-go/pkg/client/clientset/versioned" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/util/homedir" - "log" - "path/filepath" ) func main() { diff --git a/examples/update-kafka/main.go b/examples/update-kafka/main.go index 89402fd..b7820a4 100644 --- a/examples/update-kafka/main.go +++ b/examples/update-kafka/main.go @@ -3,6 +3,10 @@ package main import ( "context" "flag" + "log" + "path/filepath" + "time" + kafkav1beta2 "github.com/scholzj/strimzi-go/pkg/apis/kafka.strimzi.io/v1beta2" strimziclient "github.com/scholzj/strimzi-go/pkg/client/clientset/versioned" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -10,9 +14,6 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/util/homedir" - "log" - "path/filepath" - "time" ) func main() { @@ -112,7 +113,7 @@ func isReady(event watch.Event) bool { for _, condition := range k.Status.Conditions { if condition.Type == "Ready" && condition.Status == "True" { if k.Status.ObservedGeneration == k.ObjectMeta.Generation { - //log.Print("The Kafka cluster is ready and up-to-date") + //log.Print("The Kafka cluster is ready and up to date") return true } } diff --git a/pkg/apis/kafka.strimzi.io/v1beta2/types.go b/pkg/apis/kafka.strimzi.io/v1beta2/types.go index 2d8d9bb..b8948b9 100644 --- a/pkg/apis/kafka.strimzi.io/v1beta2/types.go +++ b/pkg/apis/kafka.strimzi.io/v1beta2/types.go @@ -470,6 +470,7 @@ type KafkaBridgeSpec struct { ClientRackInitImage string `json:"clientRackInitImage,omitempty"` Rack *Rack `json:"rack,omitempty"` EnableMetrics bool `json:"enableMetrics,omitempty"` + MetricsConfig *MetricsConfig `json:"metricsConfig,omitempty"` LivenessProbe *Probe `json:"livenessProbe,omitempty"` ReadinessProbe *Probe `json:"readinessProbe,omitempty"` Template *KafkaBridgeTemplate `json:"template,omitempty"` @@ -598,6 +599,27 @@ type Probe struct { FailureThreshold *int32 `json:"failureThreshold,omitempty"` } +type MetricsConfigType string + +const ( + JMXPROMETHEUSEXPORTER_METRICSCONFIGTYPE MetricsConfigType = "jmxPrometheusExporter" + STRIMZIMETRICSREPORTER_METRICSCONFIGTYPE MetricsConfigType = "strimziMetricsReporter" +) + +type MetricsConfig struct { + Type MetricsConfigType `json:"type,omitempty"` + ValueFrom *ExternalConfigurationReference `json:"valueFrom,omitempty"` + Values *StrimziMetricsReporterValues `json:"values,omitempty"` +} + +type StrimziMetricsReporterValues struct { + AllowList []string `json:"allowList,omitempty"` +} + +type ExternalConfigurationReference struct { + ConfigMapKeyRef *corev1.ConfigMapKeySelector `json:"configMapKeyRef,omitempty"` +} + type Rack struct { TopologyKey string `json:"topologyKey,omitempty"` } @@ -615,10 +637,6 @@ type Logging struct { ValueFrom *ExternalConfigurationReference `json:"valueFrom,omitempty"` } -type ExternalConfigurationReference struct { - ConfigMapKeyRef *corev1.ConfigMapKeySelector `json:"configMapKeyRef,omitempty"` -} - type JvmOptions struct { XX map[string]string `json:"-XX,omitempty"` Xmx string `json:"-Xmx,omitempty"` @@ -665,6 +683,7 @@ const ( SCRAM_SHA_512_KAFKACLIENTAUTHENTICATIONTYPE KafkaClientAuthenticationType = "scram-sha-512" PLAIN_KAFKACLIENTAUTHENTICATIONTYPE KafkaClientAuthenticationType = "plain" OAUTH_KAFKACLIENTAUTHENTICATIONTYPE KafkaClientAuthenticationType = "oauth" + CUSTOM_KAFKACLIENTAUTHENTICATIONTYPE KafkaClientAuthenticationType = "custom" ) type KafkaClientAuthentication struct { @@ -672,6 +691,7 @@ type KafkaClientAuthentication struct { Type KafkaClientAuthenticationType `json:"type,omitempty"` AccessTokenIsJwt bool `json:"accessTokenIsJwt,omitempty"` TlsTrustedCertificates []CertSecretSource `json:"tlsTrustedCertificates,omitempty"` + Sasl bool `json:"sasl,omitempty"` SaslExtensions map[string]string `json:"saslExtensions,omitempty"` DisableTlsHostnameVerification bool `json:"disableTlsHostnameVerification,omitempty"` Scope string `json:"scope,omitempty"` @@ -692,6 +712,8 @@ type KafkaClientAuthentication struct { PasswordSecret *PasswordSecretSource `json:"passwordSecret,omitempty"` IncludeAcceptHeader bool `json:"includeAcceptHeader,omitempty"` HttpRetries *int32 `json:"httpRetries,omitempty"` + GrantType string `json:"grantType,omitempty"` + Config MapStringObject `json:"config,omitempty"` Username string `json:"username,omitempty"` RefreshToken *GenericSecretSource `json:"refreshToken,omitempty"` } @@ -808,23 +830,6 @@ type BuildConfigTemplate struct { PullSecret string `json:"pullSecret,omitempty"` } -type MetricsConfigType string - -const ( - JMXPROMETHEUSEXPORTER_METRICSCONFIGTYPE MetricsConfigType = "jmxPrometheusExporter" - STRIMZIMETRICSREPORTER_METRICSCONFIGTYPE MetricsConfigType = "strimziMetricsReporter" -) - -type MetricsConfig struct { - Type MetricsConfigType `json:"type,omitempty"` - ValueFrom *ExternalConfigurationReference `json:"valueFrom,omitempty"` - Values *StrimziMetricsReporterValues `json:"values,omitempty"` -} - -type StrimziMetricsReporterValues struct { - AllowList []string `json:"allowList,omitempty"` -} - type KafkaJmxOptions struct { Authentication *KafkaJmxAuthentication `json:"authentication,omitempty"` } @@ -1152,11 +1157,12 @@ type KafkaExporterSpec struct { } type KafkaExporterTemplate struct { - Deployment *DeploymentTemplate `json:"deployment,omitempty"` - Pod *PodTemplate `json:"pod,omitempty"` - Service *ResourceTemplate `json:"service,omitempty"` - Container *ContainerTemplate `json:"container,omitempty"` - ServiceAccount *ResourceTemplate `json:"serviceAccount,omitempty"` + Deployment *DeploymentTemplate `json:"deployment,omitempty"` + Pod *PodTemplate `json:"pod,omitempty"` + Service *ResourceTemplate `json:"service,omitempty"` + Container *ContainerTemplate `json:"container,omitempty"` + ServiceAccount *ResourceTemplate `json:"serviceAccount,omitempty"` + PodDisruptionBudget *PodDisruptionBudgetTemplate `json:"podDisruptionBudget,omitempty"` } type JmxTransSpec struct { @@ -1292,15 +1298,16 @@ type EntityOperatorSpec struct { } type EntityOperatorTemplate struct { - Deployment *DeploymentTemplate `json:"deployment,omitempty"` - Pod *PodTemplate `json:"pod,omitempty"` - TopicOperatorContainer *ContainerTemplate `json:"topicOperatorContainer,omitempty"` - UserOperatorContainer *ContainerTemplate `json:"userOperatorContainer,omitempty"` - TlsSidecarContainer *ContainerTemplate `json:"tlsSidecarContainer,omitempty"` - ServiceAccount *ResourceTemplate `json:"serviceAccount,omitempty"` - EntityOperatorRole *ResourceTemplate `json:"entityOperatorRole,omitempty"` - TopicOperatorRoleBinding *ResourceTemplate `json:"topicOperatorRoleBinding,omitempty"` - UserOperatorRoleBinding *ResourceTemplate `json:"userOperatorRoleBinding,omitempty"` + Deployment *DeploymentTemplate `json:"deployment,omitempty"` + Pod *PodTemplate `json:"pod,omitempty"` + TopicOperatorContainer *ContainerTemplate `json:"topicOperatorContainer,omitempty"` + UserOperatorContainer *ContainerTemplate `json:"userOperatorContainer,omitempty"` + TlsSidecarContainer *ContainerTemplate `json:"tlsSidecarContainer,omitempty"` + ServiceAccount *ResourceTemplate `json:"serviceAccount,omitempty"` + PodDisruptionBudget *PodDisruptionBudgetTemplate `json:"podDisruptionBudget,omitempty"` + EntityOperatorRole *ResourceTemplate `json:"entityOperatorRole,omitempty"` + TopicOperatorRoleBinding *ResourceTemplate `json:"topicOperatorRoleBinding,omitempty"` + UserOperatorRoleBinding *ResourceTemplate `json:"userOperatorRoleBinding,omitempty"` } type EntityUserOperatorSpec struct { @@ -1593,6 +1600,7 @@ type KafkaListenerAuthentication struct { JwksRefreshSeconds *int32 `json:"jwksRefreshSeconds,omitempty"` EnableOauthBearer bool `json:"enableOauthBearer,omitempty"` ClientId string `json:"clientId,omitempty"` + ClientGrantType string `json:"clientGrantType,omitempty"` GroupsClaimDelimiter string `json:"groupsClaimDelimiter,omitempty"` ConnectTimeoutSeconds *int32 `json:"connectTimeoutSeconds,omitempty"` UserNameClaim string `json:"userNameClaim,omitempty"` diff --git a/pkg/apis/kafka.strimzi.io/v1beta2/zz_generated.deepcopy.go b/pkg/apis/kafka.strimzi.io/v1beta2/zz_generated.deepcopy.go index 9b9989d..330bef8 100644 --- a/pkg/apis/kafka.strimzi.io/v1beta2/zz_generated.deepcopy.go +++ b/pkg/apis/kafka.strimzi.io/v1beta2/zz_generated.deepcopy.go @@ -742,6 +742,11 @@ func (in *EntityOperatorTemplate) DeepCopyInto(out *EntityOperatorTemplate) { *out = new(ResourceTemplate) (*in).DeepCopyInto(*out) } + if in.PodDisruptionBudget != nil { + in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget + *out = new(PodDisruptionBudgetTemplate) + (*in).DeepCopyInto(*out) + } if in.EntityOperatorRole != nil { in, out := &in.EntityOperatorRole, &out.EntityOperatorRole *out = new(ResourceTemplate) @@ -1807,6 +1812,11 @@ func (in *KafkaBridgeSpec) DeepCopyInto(out *KafkaBridgeSpec) { *out = new(Rack) **out = **in } + if in.MetricsConfig != nil { + in, out := &in.MetricsConfig, &out.MetricsConfig + *out = new(MetricsConfig) + (*in).DeepCopyInto(*out) + } if in.LivenessProbe != nil { in, out := &in.LivenessProbe, &out.LivenessProbe *out = new(Probe) @@ -1977,6 +1987,7 @@ func (in *KafkaClientAuthentication) DeepCopyInto(out *KafkaClientAuthentication *out = new(int32) **out = **in } + in.Config.DeepCopyInto(&out.Config) if in.RefreshToken != nil { in, out := &in.RefreshToken, &out.RefreshToken *out = new(GenericSecretSource) @@ -2687,6 +2698,11 @@ func (in *KafkaExporterTemplate) DeepCopyInto(out *KafkaExporterTemplate) { *out = new(ResourceTemplate) (*in).DeepCopyInto(*out) } + if in.PodDisruptionBudget != nil { + in, out := &in.PodDisruptionBudget, &out.PodDisruptionBudget + *out = new(PodDisruptionBudgetTemplate) + (*in).DeepCopyInto(*out) + } return } diff --git a/strimzi-go-generator/pom.xml b/strimzi-go-generator/pom.xml index 09d58db..43a4507 100644 --- a/strimzi-go-generator/pom.xml +++ b/strimzi-go-generator/pom.xml @@ -22,7 +22,7 @@ 3.10.1 - 0.47.0 + 0.48.0 2.20.0