Skip to content

Kedify Custom Resource Definitions

Kedify utilizes YAML-based custom resource definition (CRDs) for configuring ScaledJobs, ScaledObjects and other autoscaling parameters. These custom resources allow users to leverage all existing functionalities of KEDA as well as extend them according to their needs. Kedify and KEDA both use YAML-based customer resource definition to define and implement configuration changes.

Kedify Custom Types

Kedify provides additional custom types to enhance the functionality and customization of KEDA deployments. These types are designed to offer more control and flexibility over the scaling behavior and configuration management of Kubernetes workloads.

KedifyConfiguration

The KedifyConfiguration custom resource is used to manage the installation and configuration of KEDA and its components within a Kubernetes cluster. This resource allows users to specify various installation parameters, resource settings, and custom configurations for KEDA. It is also a source of Helm values for KEDA and KEDA HTTP Add-On. Any updates to the installation should be done via this resource.

Example KedifyConfiguration

apiVersion: install.kedify.io/v1alpha1
kind: KedifyConfiguration
metadata:
name: kedify
namespace: keda
spec:
kedaInstallations:
- helm:
values: |
customManagedBy: "kedify"
# Version
image:
keda:
tag: v2.14.0-4
repository: ghcr.io/kedify/keda
metricsApiServer:
tag: v2.14.0-4
repository: ghcr.io/kedify/keda-metrics-apiserver
webhooks:
tag: v2.14.0-4
repository: ghcr.io/kedify/keda-admission-webhooks
# What namespace should KEDA operator look into ("" means whole cluster)
watchNamespace: ""
# Custom rbac for scalable CRDs and/or secrets
rbac:
scaledRefKinds:
- apiGroup: "*"
kind: "*"
#permissions:
# operator:
# restrict:
# namesAllowList: ["super-secret", "some-credentials"]
# Custom resources and limits for KEDA components
# resources:
# operator:
# limits:
# cpu: 1
# memory: 500Mi
# requests:
# cpu: 100m
# memory: 100Mi
# Following list of environment variables will be added to all KEDA components
# env:
# - name: HTTP_PROXY
# value: 'http://www.example.com:3128'
# Logging levels for individual KEDA components
logging:
operator:
level: info
stackTracesEnabled: false
metricServer:
level: 0
webhooks:
level: info
# Keep the switches on if you want Kedify to monitor your KEDA installation and provide insights
prometheus:
operator:
enabled: true
metricServer:
enabled: true
webhooks:
enabled: true
version: v2.14.2-2
httpAddonHelm:
values: |
images:
tag: "v0.8.0-2"
operator: ghcr.io/kedify/http-add-on-operator
interceptor: ghcr.io/kedify/http-add-on-interceptor
scaler: ghcr.io/kedify/http-add-on-scaler
# interceptor configuration
interceptor:
replicas:
min: 1
resources:
requests:
cpu: "0.1"
memory: 32Mi
limits:
cpu: 1
memory: 512Mi
# scaler configuration
scaler:
replicas: 1
resources:
requests:
cpu: "0.1"
memory: 16Mi
limits:
cpu: 0.5
memory: 64Mi
# operator configuration
operator:
replicas: 1
resources:
requests:
cpu: "0.1"
memory: 16Mi
limits:
cpu: 0.5
memory: 64Mi
version: v0.8.0-2
mode: Managed
name: keda
namespace: keda
telemetry:
controlPlane:
interval: 30
kedaResources:
interval: 30
kubernetesResources:
interval: 30

ScalingPolicy

A scaling policy is a set of rules that allows you to perform scaling actions on targets based on triggers. For example, a cron-based trigger supports dynamic configuration of ScaledObjects and ScaledJobs based on the time and day. For more details, please see the specific documentation on ScalingPolicy.

Example ScalingPolicy

apiVersion: keda.kedify.io/v1alpha1
kind: ScalingPolicy
metadata:
name: scalingpolicy-sample
spec:
targets:
- apiVersion: 'keda.sh/v1alpha1'
kind: ScaledObject
name: sample-so
- apiVersion: 'keda.sh/v1alpha1'
kind: ScaledJob
name: sample-sj
actions:
- name: day
priority: 2
trigger:
schedule:
start: '30 6 * * *'
end: '0 14 * * *'
timezone: 'Europe/Prague'
adjustment:
minReplicaCount: 5
maxReplicaCount: 10
- name: night
priority: 2
trigger:
schedule:
start: '0 18 * * *'
end: '0 6 * * *'
timezone: 'Europe/Prague'
adjustment:
minReplicaCount: 0
maxReplicaCount: 2

KEDA Types

At it’s core, Kedify and KEDA define and map event sources, with or without authentication as necessary, to cluster resources for scaling purposes. Depending on the type and source requirements, custom configuration definitions may include customer authentication references.

ScaledObject

A ScaledObject configuration definition maps an event source target (see also Scalers) to a specific resource in order to define autoscaling behavior.

Example ScaledObject

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: kedify-sample-so
namespace: default
spec:
scaleTargetRef:
name: kedify-sample-app
pollingInterval: 10
cooldownPeriod: 5
minReplicaCount: 0
maxReplicaCount: 10
advanced:
horizontalPodAutoscalerConfig:
behavior:
scaleUp:
stabilizationWindowSeconds: 15
scaleDown:
stabilizationWindowSeconds: 15
triggers:
- type: metrics-api
metadata:
url: 'http://kedify-sample-minute-metrics.default.svc.cluster.local/api/v1/minutemetrics'
valueLocation: 'value'
targetValue: '1'

ScaledJob

A ScaledJob configuration definition maps an event source target (see also Scalers) to a Kubernetes Job.

Example ScaledJob

apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
name: compliance-log-processing-job
namespace: default
spec:
jobTargetRef:
template:
spec:
containers:
- name: log-compliance-processor
image: compliance-processor:latest
restartPolicy: Never
pollingInterval: 600 # Every 10 minutes
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 3
maxReplicaCount: 5
triggers:
- type: kafka
metadata:
bootstrapServers: kafka.svc:9092
consumerGroup: compliance-log-group
topic: compliance-log-topic
lagThreshold: '50'

TriggerAuthentication

A TriggerAuthentication resource is used to define authentication parameters for triggers that require authentication.

Example TriggerAuthentication

apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: sample-trigger-auth
namespace: default
spec:
secretTargetRef:
- parameter: saslPassword
name: kafka-secret
key: saslPassword
podIdentity:
provider: azure
identityId: 'your-azure-identity-id'

ClusterTriggerAuthentication

A ClusterTriggerAuthentication resource is similar to TriggerAuthentication but is available at the cluster scope rather than the namespace scope.

Example ClusterTriggerAuthentication

apiVersion: keda.sh/v1alpha1
kind: ClusterTriggerAuthentication
metadata:
name: cluster-sample-trigger-auth
spec:
secretTargetRef:
- parameter: saslPassword
name: kafka-secret
key: saslPassword
podIdentity:
provider: aws-iam
identityId: 'your-aws-iam-role'