Skip to content

Commit

Permalink
Add schema registry support to the conduit type
Browse files Browse the repository at this point in the history
With schema support in the latest Conduit releases, this allows for multiple
conduit instances to share their schema via another schema registry.

Essentially overriding the builtin implementation.

Details are provided directly via the Conduit resource.
User, password and token can be provided as secrets but will be copied over
into controller owned secrets for management and ease of use.
  • Loading branch information
lyuboxa committed Oct 16, 2024
1 parent e5f2ee1 commit efc5497
Show file tree
Hide file tree
Showing 10 changed files with 867 additions and 4 deletions.
10 changes: 10 additions & 0 deletions api/v1alpha/conduit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
const (
ConditionConduitReady ConditionType = "Ready"
ConditionConduitConfigReady ConditionType = "ConfigReady"
ConditionConduitSecretReady ConditionType = "SecretReady"
ConditionConduitVolumeReady ConditionType = "VolumeBound"
ConditionConduitDeploymentRunning ConditionType = "DeploymentRunning"
ConditionConduitServiceReady ConditionType = "ServiceReady"
Expand All @@ -33,6 +34,7 @@ const (
var conduitConditions = NewConditionSet(
ConditionConduitReady,
ConditionConduitConfigReady,
ConditionConduitSecretReady,
ConditionConduitVolumeReady,
ConditionConduitDeploymentRunning,
ConditionConduitServiceReady,
Expand Down Expand Up @@ -67,6 +69,7 @@ type ConduitSpec struct {
Running *bool `json:"running,omitempty"`
Version string `json:"version,omitempty"`

Registry *SchemaRegistry `json:"schemaRegistry,omitempty"`
Connectors []*ConduitConnector `json:"connectors,omitempty"`
Processors []*ConduitProcessor `json:"processors,omitempty"`
}
Expand Down Expand Up @@ -94,6 +97,13 @@ type ConduitProcessor struct {
Settings []SettingsVar `json:"settings,omitempty"`
}

type SchemaRegistry struct {
URL string `json:"url,omitempty"`
Username SettingsVar `json:"basicAuthUser,omitempty"`
Password SettingsVar `json:"basicAuthPassword,omitempty"`
Token SettingsVar `json:"bearerToken,omitempty"`
}

type GlobalConfigMapRef struct {
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
Expand Down
23 changes: 23 additions & 0 deletions api/v1alpha/zz_generated.deepcopy.go

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

125 changes: 125 additions & 0 deletions charts/conduit-operator/templates/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,131 @@ spec:
type: array
running:
type: boolean
schemaRegistry:
properties:
basicAuthPassword:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
basicAuthUser:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
bearerToken:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
url:
type: string
type: object
version:
type: string
type: object
Expand Down
125 changes: 125 additions & 0 deletions config/crd/bases/operator.conduit.io_conduits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,131 @@ spec:
type: array
running:
type: boolean
schemaRegistry:
properties:
basicAuthPassword:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
basicAuthUser:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
bearerToken:
properties:
configMapRef:
properties:
key:
type: string
name:
type: string
namespace:
type: string
type: object
name:
type: string
secretRef:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
value:
type: string
type: object
url:
type: string
type: object
version:
type: string
type: object
Expand Down
31 changes: 31 additions & 0 deletions config/samples/conduit-with-schema-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: operator.conduit.io/v1alpha
kind: Conduit
metadata:
name: conduit-generator-schema-registry
spec:
running: true
name: generator.standalone.log
description: generator pipeline
schemaRegistry:
url: http://schema-registry-apicurio-registry.tenant:8080/apis/ccompat/v7
connectors:
- name: source-connector
type: source
plugin: conduitio/conduit-connector-generator
settings:
- name: format.type
value: structured
- name: format.options.id
value: "int"
- name: format.options.name
value: "string"
- name: format.options.company
value: "string"
- name: format.options.trial
value: "bool"
- name: recordCount
value: "3"
- name: destination-connector
type: destination
plugin: conduitio/conduit-connector-log
pluginVersion: v0.4.0
Loading

0 comments on commit efc5497

Please sign in to comment.