From 82a309b93ff3083dbd3ba25d4ca155228ff31977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Mon, 3 Jun 2024 15:10:14 +0000 Subject: [PATCH] wip: add salesforce source.yaml --- config/300-salesforcesource.yaml | 268 +++++++++++++++++++++ schemas/com.salesforce.stream.message.json | 60 +++++ 2 files changed, 328 insertions(+) create mode 100644 config/300-salesforcesource.yaml create mode 100644 schemas/com.salesforce.stream.message.json diff --git a/config/300-salesforcesource.yaml b/config/300-salesforcesource.yaml new file mode 100644 index 00000000..42e4378c --- /dev/null +++ b/config/300-salesforcesource.yaml @@ -0,0 +1,268 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: salesforcesources.sources.typhoon.zeiss.com + labels: + eventing.knative.dev/source: 'true' + duck.knative.dev/source: 'true' + knative.dev/crd-install: 'true' + typhoon.zeiss.com/crd-install: 'true' + annotations: + registry.knative.dev/eventTypes: | + [ + { + "type": "com.salesforce.stream.message", + "schema": "https://raw.githubusercontent.com/zeiss/typhoon/main/schemas/com.salesforce.stream.message.json" + } + ] +spec: + group: sources.typhoon.zeiss.com + scope: Namespaced + names: + kind: SalesforceSource + plural: salesforcesources + categories: + - all + - knative + - eventing + - sources + versions: + - name: v1alpha1 + served: true + storage: true + subresources: + status: {} + schema: + openAPIV3Schema: + description: Typhoon event source for Salesforce. + type: object + properties: + spec: + description: Desired state of the event source. + type: object + properties: + auth: + description: Authentication method to interact with the Salesforce API. + type: object + properties: + auth: + type: object + description: Authentication method to interact with the Salesforce API. + properties: + clientID: + description: Salesforce client ID. + type: string + clientSecret: + instanaceURL: + description: Salesforce instance URL. + type: string + properties: + value: + description: Literal value of the certificate key. + type: string + valueFromSecret: + description: A reference to a Kubernetes Secret containing the certificate key. + type: object + properties: + name: + type: string + key: + type: string + required: + - name + - key + oneOf: + - required: [value] + - required: [valueFromSecret] + required: + - clientID + - instanceURL + - auth + apiVersion: + description: Salesforce API version. + type: string + subscription: + description: Subscription to a Salesforce channel. + type: object + properties: + channel: + type: string + replayID: + type: integer + required: + - channel + sink: + description: The destination of events received via Salesforce streams. + type: object + properties: + ref: + description: Reference to an addressable Kubernetes object to be used as the destination of events. + type: object + properties: + apiVersion: + type: string + kind: + type: string + namespace: + type: string + name: + type: string + required: + - apiVersion + - kind + - name + uri: + description: URI to use as the destination of events. + type: string + format: uri + anyOf: + - required: [ref] + - required: [uri] + adapterOverrides: + description: Kubernetes object parameters to apply on top of default adapter values. + type: object + properties: + annotations: + description: Adapter annotations. + type: object + additionalProperties: + type: string + labels: + description: Adapter labels. + type: object + additionalProperties: + type: string + env: + description: Adapter environment variables. + type: array + items: + type: object + properties: + name: + type: string + value: + type: string + resources: + description: Compute Resources required by the adapter. More info at https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Limits describes the maximum amount of compute resources allowed. More info at https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Requests describes the minimum amount of compute resources required. If Requests is omitted + for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined + value. More info at https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ + type: object + tolerations: + description: Pod tolerations, as documented at https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ + Tolerations require additional configuration for Knative-based deployments - https://knative.dev/docs/serving/configuration/feature-flags/ + type: array + items: + type: object + properties: + key: + description: Taint key that the toleration applies to. + type: string + operator: + description: Key's relationship to the value. + type: string + enum: [Exists, Equal] + value: + description: Taint value the toleration matches to. + type: string + effect: + description: Taint effect to match. + type: string + enum: [NoSchedule, PreferNoSchedule, NoExecute] + tolerationSeconds: + description: Period of time a toleration of effect NoExecute tolerates the taint. + type: integer + format: int64 + nodeSelector: + description: NodeSelector only allow the object pods to be created at nodes where all selector labels + are present, as documented at https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector. + NodeSelector require additional configuration for Knative-based deployments - https://knative.dev/docs/serving/configuration/feature-flags/ + type: object + additionalProperties: + type: string + affinity: + description: Scheduling constraints of the pod. More info at https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity. + Affinity require additional configuration for Knative-based deployments - https://knative.dev/docs/serving/configuration/feature-flags/ + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - auth + - subscription + - sink + status: + description: Reported status of the event source. + type: object + properties: + sinkUri: + description: URI of the sink where events are currently sent to. + type: string + format: uri + ceAttributes: + type: array + items: + type: object + properties: + type: + type: string + source: + type: string + required: + - type + - source + observedGeneration: + type: integer + format: int64 + conditions: + type: array + items: + type: object + properties: + type: + type: string + status: + type: string + enum: ['True', 'False', Unknown] + severity: + type: string + enum: [Error, Warning, Info] + reason: + type: string + message: + type: string + lastTransitionTime: + type: string + format: date-time + required: + - type + - status + additionalPrinterColumns: + - name: Ready + type: string + jsonPath: .status.conditions[?(@.type=='Ready')].status + - name: Reason + type: string + jsonPath: .status.conditions[?(@.type=='Ready')].reason + - name: Sink + type: string + jsonPath: .status.sinkUri + - name: Age + type: date + jsonPath: .metadata.creationTimestamp \ No newline at end of file diff --git a/schemas/com.salesforce.stream.message.json b/schemas/com.salesforce.stream.message.json new file mode 100644 index 00000000..1611b92a --- /dev/null +++ b/schemas/com.salesforce.stream.message.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "event": { + "properties": { + "createdDate": { + "type": "string", + "format": "date-time" + }, + "replayId": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "schema": { + "type": "string" + }, + "sobject": true, + "payload": true + }, + "additionalProperties": false, + "type": "object", + "examples": [{ + "event": { + "createdDate": "2022-06-01T12:00:00Z", + "replayId": 12345, + "type": "customer_created" + }, + "schema": "v1", + "sobject": true, + "payload": { + "customerId": "123456789", + "name": "John Smith", + "email": "john.smith@example.com" + } + }, { + "event": { + "createdDate": "2022-06-01T13:00:00Z", + "replayId": 12346, + "type": "order_placed" + }, + "schema": "v1", + "sobject": true, + "payload": { + "orderId": "987654321", + "customerId": "123456789", + "total": 49.99, + "items": [{ + "name": "Widget", + "quantity": 2, + "price": 24.99 + }] + } + }] +} \ No newline at end of file