Skip to content

Commit

Permalink
Generates CRDs from the Pydantic models (#3)
Browse files Browse the repository at this point in the history
This also refactors the operator into some more focus modules, adds project
setup, versioning, and a CLI.
  • Loading branch information
chrisguidry authored Aug 2, 2024
1 parent daee741 commit cc7696c
Show file tree
Hide file tree
Showing 11 changed files with 897 additions and 643 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ repos:
hooks:
- id: mypy
additional_dependencies: [pytest==8.3.2, types-pyyaml==6.0.12.20240724]
- repo: local
hooks:
- id: generate-crds
name: Generate CRD manifests
entry: bash -c 'python -m prefect_operator generate-crds > crds.yaml'
language: system
types: [python]
pass_filenames: false
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif

mv .bookkeeping/uv.next .bookkeeping/uv

.bookkeeping/development.txt: .bookkeeping/uv requirements.txt
.bookkeeping/development.txt: .bookkeeping/uv requirements.txt pyproject.toml
mkdir -p .bookkeeping
cat requirements.txt > .bookkeeping/development.txt.next

Expand Down
190 changes: 115 additions & 75 deletions crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,138 @@ metadata:
name: prefectservers.prefect.io
spec:
group: prefect.io
scope: Namespaced
names:
kind: PrefectServer
plural: prefectservers
singular: prefectserver
kind: PrefectServer
scope: Namespaced
versions:
- name: v3
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
version:
type: string
sqlite:
type: object
- name: v3
schema:
openAPIV3Schema:
properties:
spec:
properties:
postgres:
default: null
properties:
database:
title: Database
type: string
host:
title: Host
type: string
passwordSecretKeyRef:
properties:
key:
title: Key
type: string
name:
title: Name
type: string
required:
- name
- key
title: SecretKeyReference
type: object
port:
title: Port
type: integer
user:
title: User
type: string
required:
- host
- port
- user
- passwordSecretKeyRef
- database
title: PrefectPostgresDatabase
type: object
settings:
default: []
items:
properties:
storageClassName:
name:
title: Name
type: string
size:
value:
title: Value
type: string
required:
- storageClassName
- size
postgres:
- name
- value
title: PrefectSetting
type: object
properties:
host:
type: string
port:
type: number
user:
type: string
passwordSecretKeyRef:
type: object
properties:
name:
type: string
key:
type: string
database:
type: string
settings:
type: array
items:
type: object
properties:
name:
type: string
value:
type: string
required:
- spec
title: Settings
type: array
sqlite:
default: null
properties:
size:
title: Size
type: string
storageClassName:
title: Storageclassname
type: string
required:
- storageClassName
- size
title: PrefectSqliteDatabase
type: object
version:
default: 3.0.0rc13
title: Version
type: string
title: PrefectServer
type: object
type: object
served: true
storage: true
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: prefectworkpools.prefect.io
spec:
group: prefect.io
scope: Namespaced
names:
kind: PrefectWorkPool
plural: prefectworkpools
singular: prefectworkpool
kind: PrefectWorkPool
scope: Namespaced
versions:
- name: v3
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
version:
type: string
server:
type: object
properties:
namespace:
type: string
name:
type: string
required:
- name
workers:
type: number
required:
- spec
- name: v3
schema:
openAPIV3Schema:
properties:
spec:
properties:
server:
properties:
name:
title: Name
type: string
namespace:
default: ''
title: Namespace
type: string
required:
- name
title: PrefectServerReference
type: object
version:
default: 3.0.0rc13
title: Version
type: string
workers:
default: 1
title: Workers
type: integer
required:
- server
title: PrefectWorkPool
type: object
type: object
served: true
storage: true
1 change: 1 addition & 0 deletions deploy-example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
python -m prefect_operator generate-crds > crds.yaml
kubectl apply -f crds.yaml

for f in examples/$1/*.yaml; do
Expand Down
Loading

0 comments on commit cc7696c

Please sign in to comment.