Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kafka RestProxy APIs #1262

Merged
merged 5 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apis/kafka/v1alpha1/connect_cluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k *ConnectCluster) ValidateCreate() (admission.Warnings, error) {
if len(allErr) == 0 {
return nil, nil
}
return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "Kafka"}, k.Name, allErr)
return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "ConnectCluster"}, k.Name, allErr)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
Expand Down Expand Up @@ -87,9 +87,9 @@ func (k *ConnectCluster) ValidateDelete() (admission.Warnings, error) {

var allErr field.ErrorList
if k.Spec.DeletionPolicy == dbapi.DeletionPolicyDoNotTerminate {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"),
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deletionPolicy"),
k.Name,
"Can not delete as terminationPolicy is set to \"DoNotTerminate\""))
"Can not delete as deletionPolicy is set to \"DoNotTerminate\""))
return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "ConnectCluster"}, k.Name, allErr)
}
return nil, nil
Expand All @@ -112,7 +112,7 @@ func (k *ConnectCluster) ValidateCreateOrUpdate() field.ErrorList {
}

if k.Spec.DeletionPolicy == dbapi.DeletionPolicyHalt {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"),
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deletionPolicy"),
k.Name,
"DeletionPolicyHalt is not supported for ConnectCluster"))
}
Expand Down
6 changes: 3 additions & 3 deletions apis/kafka/v1alpha1/connector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func (k *Connector) ValidateDelete() (admission.Warnings, error) {

var allErr field.ErrorList
if k.Spec.DeletionPolicy == dbapi.DeletionPolicyDoNotTerminate {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"),
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deletionPolicy"),
k.Name,
"Can not delete as terminationPolicy is set to \"DoNotTerminate\""))
"Can not delete as deletionPolicy is set to \"DoNotTerminate\""))
return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "Connector"}, k.Name, allErr)
}
return nil, nil
Expand All @@ -75,7 +75,7 @@ func (k *Connector) ValidateDelete() (admission.Warnings, error) {
func (k *Connector) ValidateCreateOrUpdate() error {
var allErr field.ErrorList
if k.Spec.DeletionPolicy == dbapi.DeletionPolicyHalt {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"),
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deletionPolicy"),
k.Name,
"DeletionPolicyHalt isn't supported for Connector"))
}
Expand Down
30 changes: 30 additions & 0 deletions apis/kafka/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,33 @@ const (
SchemaRegistryOperatorVolumeConfig = "registry-operator-config"
SchemaRegistryOperatorConfigPath = "/deployments/config"
)

// RestProxy constants

const (
RestProxyPrimaryPortName = "primary"
RestProxyPortName = "restproxy"
RestProxyRESTPort = 8082
RestProxyContainerName = "rest-proxy"
RestProxyOperatorVolumeConfig = "rest-proxy-operator-config"
RestProxyOperatorConfigPath = "/opt/karapace/config"

RestProxyKarapaceLogLevel = "log_level"
RestProxyKarapaceLogLevelWarning = "WARNING"
RestProxyKarapaceLogLevelInfo = "INFO"
RestProxyKarapaceLogLevelDebug = "DEBUG"
RestProxyKarapaceHostName = "host"
RestProxyKarapacePortName = "port"
RestProxyKafkaBootstrapURI = "bootstrap_uri"
RestProxyKafkaSecurityProtocolName = "security_protocol"
RestProxyKafkaSASLMechanismName = "sasl_mechanism"
RestProxyKafkaSASLUsername = "sasl_plain_username"
RestProxyKafkaSASLPassword = "sasl_plain_password"
RestProxyKafkaSSLCAFile = "ssl_cafile"
RestProxyKafkaSSLCertFile = "ssl_certfile"
RestProxyKafkaSSLKeyFile = "ssl_keyfile"
RestProxyKafkaSSLCAFilePath = "/var/private/kafka-client-ssl/ca.crt"
RestProxyKafkaSSLCertFilePath = "/var/private/kafka-client-ssl/tls.crt"
RestProxyKafkaSSLKeyFilePath = "/var/private/kafka-client-ssl/tls.key"
RestProxyConfigFileName = "rest.config.json"
)
235 changes: 235 additions & 0 deletions apis/kafka/v1alpha1/openapi_generated.go

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

2 changes: 2 additions & 0 deletions apis/kafka/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ConnectClusterList{},
&Connector{},
&ConnectorList{},
&RestProxy{},
&RestProxyList{},
&SchemaRegistry{},
&SchemaRegistryList{},
)
Expand Down
Loading
Loading