New to KubeDB? Please start here.
Connector
is a Kubernetes Custom Resource Definitions
(CRD). It provides declarative configuration for Connector in a Kubernetes native way. You only need to describe the desired configuration in a Connector
object, and the KubeDB operator will create Kubernetes objects in the desired state for you.
As with all other Kubernetes objects, a Connector needs apiVersion
, kind
, and metadata
fields. It also needs a .spec
section. Below is an example Connector object.
apiVersion: kafka.kubedb.com/v1alpha1
kind: Connector
metadata:
name: mongodb-source-connector
namespace: demo
spec:
configSecret:
name: mongodb-source-config
connectClusterRef:
name: connectcluster-quickstart
namespace: demo
terminationPolicy: WipeOut
spec.configSecret
is a required field that specifies the name of the secret containing the configuration for the Connector. The secret should contain a key config.properties
which contains the configuration for the Connector.
spec:
configSecret:
name: <config-secret-name>
spec.connectClusterRef
is a required field that specifies the name and namespace of the ConnectCluster
object that the Connector
object is associated with. This is an appbinding reference for ConnectCluster
object.
spec:
connectClusterRef:
name: <connectcluster-appbinding-name>
namespace: <connectcluster-appbinding-namespace>
spec.terminationPolicy
gives flexibility whether to nullify
(reject) the delete operation of Connector
CR or which resources KubeDB should keep or delete when you delete Connector
CR. KubeDB provides following four termination policies:
When terminationPolicy
is DoNotTerminate
, KubeDB takes advantage of ValidationWebhook
feature in Kubernetes 1.9.0 or later clusters to implement DoNotTerminate
feature. If admission webhook is enabled, DoNotTerminate
prevents users from deleting the resource as long as the spec.terminationPolicy
is set to DoNotTerminate
.
Termination policy WipeOut
will delete the connector from the ConnectCluster when the Connector CR is deleted and Delete
keep the connector after deleting the Connector CR.