|
| 1 | +# OCI Functions Operator |
| 2 | + |
| 3 | +Kubernetes-native management and job-style invocation of OCI Functions from OKE. |
| 4 | + |
| 5 | +MVP controller image: |
| 6 | + |
| 7 | +```text |
| 8 | +ghcr.io/ronsevet/oci-functions-operator/controller:mvp-events-functionevents-v1 |
| 9 | +``` |
| 10 | + |
| 11 | +## MVP Feature Summary |
| 12 | + |
| 13 | +The MVP adds four namespaced CRDs: |
| 14 | + |
| 15 | +- `Function`: references an existing OCI Function or manages an OCI Functions application/function. |
| 16 | +- `FunctionJob`: invokes a referenced `Function`, fans out inline JSON payloads, retries failed invocations, and records aggregate/per-payload status. |
| 17 | +- `FunctionEventTrigger`: creates OCI Events Rules for OCI service events such as Object Storage events, or routes Kubernetes-native `functionevent.*` events to a referenced `Function`. |
| 18 | +- `FunctionEvent`: Kubernetes-native event object for direct operator-routed invocation through `functionevent.*` event types. |
| 19 | + |
| 20 | +## Two Images |
| 21 | + |
| 22 | +The operator image and function runtime image are different artifacts: |
| 23 | + |
| 24 | +- Operator/controller image: runs as a Kubernetes Deployment in OKE. It can be in GHCR, OCIR, or any registry OKE can pull from. |
| 25 | +- Function runtime image: runs in OCI Functions. It must be an OCI Functions-compatible Fn image in same-region OCIR, for example `jed.ocir.io/<TENANCY_NAMESPACE>/hello-function:fn-v1` for Jeddah. |
| 26 | + |
| 27 | +Do not use GHCR for the OCI Functions runtime image. OCI Functions pulls the runtime image from the Functions application network during invocation, so the application subnet/NSG must have egress to Oracle Services Network/OCIR even when the OCIR repository is public. |
| 28 | + |
| 29 | +## Start Here |
| 30 | + |
| 31 | +- [Helm install](docs/helm-install.md): recommended OKE installation and upgrade path. |
| 32 | +- [MVP demo flow](docs/demo/mvp-demo-flow.md): primary concise handoff/demo guide for the final MVP image. |
| 33 | +- [MVP checklist](docs/demo/mvp-checklist.md): short secondary pre-demo checklist. |
| 34 | +- [MVP video script](docs/demo/mvp-video-script.md): short secondary narration outline. |
| 35 | +- [Managed Function demo](docs/managed-function-demo.md): primary OKE walkthrough for managed application/function creation and invocation. |
| 36 | +- [Function events](docs/function-events.md): Kubernetes-native `functionevent.*` events routed directly by the operator. |
| 37 | +- [Function event triggers](docs/event-triggers.md): OCI Events Rule and FunctionEvent trigger setup. |
| 38 | +- [OKE deployment](docs/oke-deployment.md): supported Helm deployment, Workload Identity, IAM, and network setup. |
| 39 | +- [Design overview](docs/design.md): CRDs, controllers, lifecycle, invoker contracts, and limitations. |
| 40 | +- [Local existing Function demo](docs/oci-mode-demo.md): local `OCI_AUTH_MODE=config` path against an already-created OCI Function. |
| 41 | +- [Debugging Functions](docs/debugging-functions.md): image, CRD, Workload Identity, NSG, and invocation failure checks. |
| 42 | +- [Validation notes](docs/validation-notes.md): template for recording real OCI-mode runs. |
| 43 | +- [Sample function image](examples/hello-function/README.md): Fn-compatible Python function runtime image for the managed demo. |
| 44 | + |
| 45 | +## Modes |
| 46 | + |
| 47 | +`INVOKER_MODE=fake` is the default. It requires no OCI auth, creates no OCI resources, and is useful only for CRD/controller/status demos. |
| 48 | + |
| 49 | +`INVOKER_MODE=oci` uses the OCI Go SDK: |
| 50 | + |
| 51 | +- On OKE, the Helm chart configures Workload Identity with `oci.authMode=workload`. |
| 52 | +- For local development only, use `OCI_AUTH_MODE=config` with `OCI_CONFIG_FILE` and `OCI_CONFIG_PROFILE`. |
| 53 | + |
| 54 | +Existing mode requires `spec.functionId` and `spec.invokeEndpoint` on the `Function`. Managed mode uses `spec.config` to create/update the OCI Functions application and function, then writes `status.applicationId`, `status.functionId`, and `status.invokeEndpoint`. |
| 55 | + |
| 56 | +## Local Fake Demo |
| 57 | + |
| 58 | +Install or refresh generated manifests: |
| 59 | + |
| 60 | +```sh |
| 61 | +make generate |
| 62 | +make manifests |
| 63 | +kubectl apply -k config/crd |
| 64 | +``` |
| 65 | + |
| 66 | +Run the manager against your current kubeconfig: |
| 67 | + |
| 68 | +```sh |
| 69 | +INVOKER_MODE=fake go run ./cmd |
| 70 | +``` |
| 71 | + |
| 72 | +In another terminal: |
| 73 | + |
| 74 | +```sh |
| 75 | +scripts/check-demo-prereqs.sh |
| 76 | +scripts/demo-fake.sh |
| 77 | +``` |
| 78 | + |
| 79 | +Fake mode proves only the Kubernetes reconciliation/status path. It does not prove OCI auth, OCI Functions network egress, OCIR image access, or function image compatibility. |
| 80 | + |
| 81 | +## Primary OKE Path |
| 82 | + |
| 83 | +For OKE managed mode: |
| 84 | + |
| 85 | +1. Build and push the operator/controller image to a registry OKE can pull. |
| 86 | +2. Build a Fn-compatible function runtime image and push it to same-region OCIR. |
| 87 | +3. Deploy the operator with Helm. The chart is the supported OKE path and defaults to OCI mode with Workload Identity. |
| 88 | +4. Apply a managed `Function` with `spec.config.region`, `compartmentId`, `applicationName`, `subnetIds`, optional `nsgIds`, and same-region OCIR `image`. |
| 89 | +5. Submit a `FunctionJob`, create a `FunctionEventTrigger`, or emit a `FunctionEvent` after the `Function` is Ready. |
| 90 | + |
| 91 | +See [docs/helm-install.md](docs/helm-install.md) for installation and [docs/managed-function-demo.md](docs/managed-function-demo.md) for the full Function sequence. |
| 92 | + |
| 93 | +Kustomize under `config/` is kept for Kubebuilder-generated manifests and local controller development only. Do not mix Helm and Kustomize for the same OKE operator install. |
0 commit comments