Airflow Operator Custom Resource (API)

The Airflow Operator uses these CustomResourceDefinitions:

AirflowBase includes MySQL, UI, NFS(DagStore). AirflowCluster includes Airflow Scheduler, Workers, Redis.

Multiple AirflowCluster could use the same AirflowBase. The way custom resources are defined allows multi-single-tenant (multiple single users) usecases, where users use different airflow plugins (opeartors, packages etc) in their set up. This improves cluster utilization and provide multiple users (in same trust domain) with some isolation.

AirflowBase API

Fieldjson fieldTypeInfo
SpecspecAirflowBaseSpecThe specfication for Airflow Base cusotm resource
StatusstatusAirflowBaseStatusThe status for the custom resource

AirflowBaseSpec

FieldTypejson fieldInfo
NodeSelectormap[string]stringnodeSelectorSelector for fitting pods to nodes whose labels match the selector
Affinity*corev1.AffinityaffinityDefine scheduling constraints for pods
Annotationsmap[string]stringannotationsCustom annotations to be added to the pods
Labelsmap[string]stringlabelsCustom labels to be added to the pods
MySQL*MySQLSpecmysqlSpec for MySQL component
Storage*NFSStoreSpecstorageSpec for NFS component
UI*AirflowUISpecuiSpec for Airflow UI component
SQLProxy*SQLProxySpecsqlproxySpec for SQLProxy component. Ignored if SQL(MySQLSpec) is specified

MySQLSpec

FieldTypejson fieldInfo
ImagestringimageImage defines the MySQL Docker image name
VersionstringversionVersion defines the MySQL Docker image version
Replicasint32replicasReplicas defines the number of running MySQL instances in a cluster
VolumeClaimTemplate*corev1.PersistentVolumeClaimvolumeClaimTemplateVolumeClaimTemplate allows a user to specify volume claim for MySQL Server files
BackupVolumeClaimTemplate*corev1.PersistentVolumeClaimbackupVolumeClaimTemplateBackupVolumeClaimTemplate allows a user to specify a volume to temporarily store the data for a backup prior to it being shipped to object storage
OperatorbooloperatorFlag when True generates MySQLOperator CustomResource to be handled by MySQL Operator If False, a StatefulSet with 1 replica is created (not for production setups)
Backup*MySQLBackupbackupSpec defining the Backup Custom Resource to be handled by MySQLOperator Ignored when Operator is False
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods
Optionsmap[string]string command line options for mysql

MySQLBackup

FieldTypejson fieldInfo
SchedulestringscheduleSchedule is the cron string used to schedule backup
StorageStorageSpecstorageStorage has the s3 compatible storage spec
StorageSpec
FieldTypejson fieldInfo
StorageProviderstringstorageproviderProvider is the storage type used for backup and restore e.g. s3, oci-s3-compat, aws-s3, gce-s3, etc
SecretRef*corev1.LocalObjectReferencesecretRefSecretRef is a reference to the Kubernetes secret containing the configuration for uploading the backup to authenticated storage
Configmap[string]stringconfigConfig is generic string based key-value map that defines non-secret configuration values for uploading the backup to storage w.r.t the configured storage provider

NFSStoreSpec

FieldTypejson fieldInfo
ImagestringimageImage defines the NFS Docker image.
VersionstringversionVersion defines the NFS Server Docker image version.
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.
Volume*corev1.PersistentVolumeClaimvolumeClaimTemplateVolume allows a user to specify volume claim template to be used for fileserver

SQLProxySpec

FieldTypejson fieldInfo
ImagestringimageImage defines the SQLProxy Docker image name
VersionstringversionVersion defines the SQL Proxy docker image version. example: myProject:us-central1:myInstance=tcp:3306
ProjectstringprojectProject defines the SQL instance project
RegionstringregionRegion defines the SQL instance region
InstancestringinstanceInstance defines the SQL instance name
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.

AirflowBaseStatus

FieldTypejson fieldInfo
ObservedGenerationint64observedGenerationObservedGeneration is the last generation of the AirflowBase as observed by the controller
MySQLComponentStatusmysqlMySQL is the status of the MySQL component
UIComponentStatusuiUI is the status of the Airflow UI component
StorageComponentStatusstorageStorage is the status of the NFS component
SQLProxyComponentStatussqlproxySQLProxy is the status of the SQLProxy component
LastErrorstringlasterrorLastError
StatusstringstatusReaedy or Pending

AirflowCluster

FieldTypejson fieldInfo
SpecAirflowClusterSpecspec
StatusAirflowClusterStatusstatus

AirflowClusterSpec

FieldTypejson fieldInfo
NodeSelectormap[string]stringnodeSelectorSelector for fitting pods to nodes whose labels match the selector
Affinity*corev1.AffinityaffinityDefine scheduling constraints for pods.
Annotationsmap[string]stringannotationsCustom annotations to be added to the pods.
Labelsmap[string]stringlabelsCustom labels to be added to the pods.
ExecutorstringexecutorAirflow Executor desired: local,celery,kubernetes
Redis*RedisSpecredisSpec for Redis component.
Scheduler*SchedulerSpecschedulerSpec for Airflow Scheduler component.
Worker*WorkerSpecworkerSpec for Airflow Workers
UI*AirflowUISpecuiSpec for Airflow UI component.
Flower*FlowerSpecflowerSpec for Flower component.
DAGs*DagSpecdagsSpec for DAG source and location
AirflowBaseRef*corev1.LocalObjectReferenceairflowbaseAirflowBaseRef is a reference to the AirflowBase CR

AirflowClusterStatus

FieldTypejson fieldInfo
ObservedGenerationint64observedGeneration"ObservedGeneration is the last generation of the AirflowCluster as observed by the controller.
RedisComponentStatusredisRedis is the status of the Redis component
SchedulerSchedulerStatusschedulerScheduler is the status of the Airflow Scheduler component
WorkerComponentStatusworkerWorker is the status of the Workers
UIComponentStatusuiUI is the status of the Airflow UI component
FlowerComponentStatusflowerFlower is the status of the Airflow UI component
LastErrorstringlasterrorLastError
StatusstringstatusStatus

RedisSpec

FieldTypejson fieldInfo
Imagestringimage"Image defines the Redis Docker image name
OperatorbooloperatorVersion defines the Redis Docker image version. Flag when True generates RedisReplica CustomResource to be handled by Redis Operator If False, a StatefulSet with 1 replica is created
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.
VolumeClaimTemplate*corev1.PersistentVolumeClaimvolumeClaimTemplateVolumeClaimTemplate allows a user to specify volume claim for MySQL Server files
AdditionalArgsstringadditionalargsAdditionalArgs for redis-server

RedisSpec

FieldTypejson fieldInfo
Imagestringimage"Image defines the Redis Docker image name
Versionstringversion"Version defines the Redis Docker image version.
OperatorbooloperatorFlag when True generates RedisReplica CustomResource to be handled by Redis Operator If False, a StatefulSet with 1 replica is created
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.
VolumeClaimTemplate*corev1.PersistentVolumeClaimvolumeClaimTemplateVolumeClaimTemplate allows a user to specify volume claim for MySQL Server files
AdditionalArgsstringadditionalargsAdditionalArgs for redis-server

FlowerSpec

FieldTypejson fieldInfo
Imagestringimage"Image defines the Flower Docker image.
Versionstringversion"Version defines the Flower Docker image version.
Replicasint32replicasReplicas defines the number of running Flower instances in a cluster
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.

SchedulerSpec

FieldTypejson fieldInfo
Imagestringimage"Image defines the Airflow custom server Docker image.
Versionstringversion"Version defines the Airflow Docker image version
DBNamestringdatabase"DBName defines the Airflow Database to be used
DBUserstringdbuser"DBUser defines the Airflow Database user to be used
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.

WorkerSpec

FieldTypejson fieldInfo
Imagestringimage"Image defines the Airflow worker Docker image.
Versionstringversion"Version defines the Airflow worker Docker image version
Replicasint32replicasReplicas is the count of number of workers
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.

AirflowUISpec

FieldTypejson fieldInfo
ImagestringimageImage defines the AirflowUI Docker image.
VersionstringversionVersion defines the AirflowUI Docker image version.
Replicasint32replicasReplicas defines the number of running Airflow UI instances in a cluster
Resourcescorev1.ResourceRequirementsresourcesResources is the resource requests and limits for the pods.

GCSSpec

FieldTypejson fieldInfo
BucketstringbucketBucket describes the GCS bucket
OnceboolonceOnce syncs initially and quits (use init container instead of sidecar)

GitSpec

FieldTypejson fieldInfo
Repostringrepo,"Repo describes the http/ssh uri for git repo
BranchstringbranchBranch describes the branch name to be synced
RevstringrevRev is the git hash to be used for syncing
UserstringuserUser for git access
OnceboolonceOnce syncs initially and quits (use init container instead of sidecar)
CredSecretRef*corev1.LocalObjectReferencecredReference to a Secret that has git credentials in field password. It is injected as env GIT_SYNC_PASSWORD in git-sync container.Refer to how the password is used in git-sync

DagSpec

FieldTypejson fieldInfo
DagSubdirstringsubdirDagSubdir is the directory under source where the dags are present
Git*GitSpecgitGitSpec defines details to pull DAGs from a git repo using github.com/kubernetes/git-sync sidecar
NfsPV*corev1.PersistentVolumeClaimnfspvNfsPVSpec
Storage*StorageSpecstorageStorage has s3 compatible storage spec for copying files from
GCS*GCSSpecgcsGcs config which uses storage spec

SchedulerStatus

FieldTypejson fieldInfo
ResourcesComponentStatusresourcesStatus is a string describing Scheduler status
DagCountint32dagcountDagCount is a count of number of Dags observed
RunCountint32runcountRunCount is a count of number of Dag Runs observed

Common

ComponentStatus

FieldTypejson fieldInfo
STS[]StsStatusstsStatefulSet status
SVC[]SvcStatussvcService status
PDB[]PdbStatuspdbPDB status
LastErrorstringlasterrorLastError
StatusstringstatusStatus

StsStatus

FieldTypejson fieldInfo
LinkstringlinkLink to sts
NamestringnameName of sts
StatusstringstatusStatus to rsrc
Replicasint32replicasReplicas defines the no of MySQL instances desired
ReadyReplicasint32readycountReadyReplicas defines the no of MySQL instances that are ready
CurrentReplicasint32currentcountCurrentReplicas defines the no of MySQL instances that are created

SvcStatus

FieldTypejson fieldInfo
LinkstringlinkLink to rsrc
Namestringnameservice name
StatusstringstatusStatus to rsrc

PdbStatus

FieldTypejson fieldInfo
LinkstringlinkLink to rsrc
NamestringnameName of pdb
StatusstringstatusStatus to rsrc
CurrentHealthyint32currenthealthycurrentHealthy
DesiredHealthyint32desiredhealthydesiredHealthy

ResourceRequests

FieldTypejson fieldInfo
CPUstringcpuCpu is the amount of CPU requested for a pod.
MemorystringmemoryMemory is the amount of RAM requested for a Pod.
DiskstringdiskDisk is the amount of Disk requested for a pod.
DiskStorageClassstringdiskStorageClassDiskStorageClass is the storage class for Disk. Disk must be present or this field is invalid.

ResourceLimits

FieldTypejson fieldInfo
CPUstringcpuCpu is the CPU limit for a pod.
MemorystringmemoryMemory is the RAM limit for a pod.