feat: define Function and Trigger CRD types

Function:
  - runtime (go1.21/python3.11/nodejs20)
  - entrypoint, s3Bucket, s3Key
  - memoryMB (default 128), timeoutSec (default 30)
  - env map
  - status: phase (Pending/Building/Ready/Failed), imageRef, conditions

Trigger:
  - type (http/cron), functionRef
  - schedule (cron only)
  - preWarmSeconds (default 300) - pre-warm before cron run
  - status: active, url, lastScheduleTime

printcolumns for kubectl get output
This commit is contained in:
“Naeel”
2026-03-07 08:24:33 +04:00
parent 3e10ac1d63
commit d9f5ab56bb
5 changed files with 332 additions and 70 deletions
+58 -7
View File
@@ -14,10 +14,26 @@ spec:
singular: trigger
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .spec.type
name: Type
type: string
- jsonPath: .spec.functionRef
name: Function
type: string
- jsonPath: .status.active
name: Active
type: boolean
- jsonPath: .status.url
name: URL
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Trigger is the Schema for the triggers API
description: Trigger — ресурс для управления способом вызова Function.
properties:
apiVersion:
description: |-
@@ -37,15 +53,50 @@ spec:
metadata:
type: object
spec:
description: TriggerSpec defines the desired state of Trigger
description: TriggerSpec — желаемое состояние триггера.
properties:
foo:
description: Foo is an example field of Trigger. Edit trigger_types.go
to remove/update
functionRef:
description: FunctionRef — имя Function ресурса в том же namespace
type: string
preWarmSeconds:
default: 300
description: |-
PreWarmSeconds — за сколько секунд до запуска прогреть контейнер.
Актуально для cron: запускаем pod заранее чтобы избежать cold start.
format: int32
type: integer
schedule:
description: 'Schedule — расписание в формате cron (только для type=cron,
например: "0 2 * * *")'
type: string
type:
description: 'Type — тип триггера: http или cron'
enum:
- http
- cron
type: string
required:
- functionRef
- type
type: object
status:
description: TriggerStatus defines the observed state of Trigger
description: TriggerStatus — наблюдаемое состояние триггера (заполняет
контроллер).
properties:
active:
description: Active — активен ли триггер в данный момент
type: boolean
lastScheduleTime:
description: LastScheduleTime — время последнего запуска по расписанию
(только для type=cron)
format: date-time
type: string
message:
description: Message — человекочитаемое сообщение об ошибке или статусе
type: string
url:
description: URL — публичный URL для вызова функции (только для type=http)
type: string
type: object
type: object
served: true