Skip to content

Commit

Permalink
feat: Introduce CloudEventSources CRD and adding ClusterName parameter (
Browse files Browse the repository at this point in the history
#572)

* Add CloudEventSources Crd and ClustetName Parameter

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Update

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Update

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Update keda/values.yaml

Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>
Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Fix

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Update

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

* Revert unnecessary update

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>

---------

Signed-off-by: SpiritZhou <iammrzhouzhenghan@gmail.com>
Co-authored-by: Tom Kerkhove <kerkhove.tom@gmail.com>
  • Loading branch information
SpiritZhou and tomkerkhove authored Nov 28, 2023
1 parent bb6c9af commit 39d4d11
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ jobs:

- name: Verify scaledobjects.keda.sh CRD is installed
run: kubectl get crd/scaledobjects.keda.sh -o wide

- name: Verify cloudeventsources.eventing.keda.sh CRD is installed
run: kubectl get crd/cloudeventsources.eventing.keda.sh -o wide

- name: Get all ScaledObjects
run: kubectl get scaledobjects -o wide
Expand All @@ -210,6 +213,9 @@ jobs:
- name: Get all ClusterTriggerAuthentication
run: kubectl get clustertriggerauth -o wide

- name: Get all CloudEventSource
run: kubectl get cloudeventsource -o wide

- name: Deploy Nginx with autoscaling
run: kubectl apply -f ./samples/nginx-scaledobject.yml

Expand Down
1 change: 1 addition & 0 deletions keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ their default values.
| `certificates.mountPath` | string | `"/certs"` | Path where KEDA TLS certificates are mounted |
| `certificates.secretName` | string | `"kedaorg-certs"` | Secret name to be mounted with KEDA TLS certificates |
| `clusterDomain` | string | `"cluster.local"` | Kubernetes cluster domain |
| `clusterName` | string | `"kubernetes-default"` | Kubernetes cluster name. Used in features such as emitting CloudEvents |
| `crds.install` | bool | `true` | Defines whether the KEDA CRDs have to be installed or not. |
| `env` | list | `[]` | Additional environment variables that will be passed onto all KEDA components |
| `extraObjects` | list | `[]` | Array of extra K8s manifests to deploy |
Expand Down
96 changes: 96 additions & 0 deletions keda/templates/crds/crd-cloudeventsources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{{- if .Values.crds.install }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
name: cloudeventsources.eventing.keda.sh
spec:
group: eventing.keda.sh
names:
kind: CloudEventSource
listKind: CloudEventSourceList
plural: cloudeventsources
singular: cloudeventsource
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.conditions[?(@.type=="Active")].status
name: Active
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: CloudEventSource defines how a KEDA event will be sent to event
sink
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: CloudEventSourceSpec defines the spec of CloudEventSource
properties:
clusterName:
type: string
destination:
description: Destination defines the various ways to emit events
properties:
http:
properties:
uri:
type: string
required:
- uri
type: object
type: object
required:
- destination
type: object
status:
description: CloudEventSourceStatus defines the observed state of CloudEventSource
properties:
conditions:
description: Conditions an array representation to store multiple
Conditions
items:
description: Condition to store the condition state
properties:
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition
type: string
required:
- status
- type
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
{{- end -}}
7 changes: 7 additions & 0 deletions keda/templates/manager/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ rules:
- leases
verbs:
- '*'
- apiGroups:
- eventing.keda.sh
resources:
- cloudeventsources
- cloudeventsources/status
verbs:
- '*'
- apiGroups:
- keda.sh
resources:
Expand Down
1 change: 1 addition & 0 deletions keda/templates/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ spec:
- "--operator-service-name={{ .Values.operator.name }}"
- "--metrics-server-service-name={{ .Values.operator.name }}-metrics-apiserver"
- "--webhooks-service-name={{ .Values.webhooks.name }}"
- "--k8s-cluster-name={{ .Values.clusterName }}"
- "--k8s-cluster-domain={{ .Values.clusterDomain }}"
{{- if .Values.prometheus.operator.enabled }}
- "--metrics-bind-address=:{{ .Values.prometheus.operator.port }}"
Expand Down
3 changes: 3 additions & 0 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ image:
# -- Image pullPolicy for all KEDA components
pullPolicy: Always

# -- Kubernetes cluster name. Used in features such as emitting CloudEvents
clusterName: kubernetes-default

# -- Kubernetes cluster domain
clusterDomain: cluster.local

Expand Down

0 comments on commit 39d4d11

Please sign in to comment.