Skip to content

Commit 799b264

Browse files
committed
Add usage and development information
1 parent e5494c9 commit 799b264

1 file changed

Lines changed: 172 additions & 1 deletion

File tree

README.md

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,172 @@
1-
# func-operator
1+
# func-operator
2+
3+
A Kubernetes operator for managing serverless functions using the `func` CLI. This operator automates the deployment and lifecycle management of functions from Git repositories to Kubernetes clusters with Knative.
4+
5+
## Prerequisites
6+
7+
- Kubernetes cluster (1.31+)
8+
- [Knative Serving](https://knative.dev/docs/install/) installed
9+
- [Tekton Pipelines](https://tekton.dev/docs/installation/) installed
10+
- Container registry for storing function images
11+
12+
## Installation
13+
14+
### Install the Operator
15+
16+
Deploy the operator to your cluster:
17+
18+
```bash
19+
# Build and deploy the operator
20+
make docker-build docker-push IMG=<your-registry>/func-operator:v0.0.1
21+
make deploy IMG=<your-registry>/func-operator:v0.0.1
22+
```
23+
24+
Or use the pre-built installer:
25+
26+
```bash
27+
# Generate installer manifests
28+
make build-installer IMG=<your-registry>/func-operator:v0.0.1
29+
30+
# Apply the installer
31+
kubectl apply -f dist/install.yaml
32+
```
33+
34+
## Usage
35+
36+
### Create a Function
37+
38+
Create a `Function` custom resource to deploy a function from a Git repository:
39+
40+
```yaml
41+
apiVersion: functions.dev/v1alpha1
42+
kind: Function
43+
metadata:
44+
name: my-function
45+
namespace: default
46+
spec:
47+
source:
48+
repositoryUrl: https://github.com/your-org/your-function.git
49+
registry:
50+
path: quay.io/your-username/my-function
51+
authSecretRef:
52+
name: registry-credentials
53+
```
54+
55+
Apply the resource:
56+
57+
```bash
58+
kubectl apply -f function.yaml
59+
```
60+
61+
### Registry Authentication
62+
63+
For private registries, create a secret with registry credentials:
64+
65+
```yaml
66+
apiVersion: v1
67+
kind: Secret
68+
metadata:
69+
name: registry-credentials
70+
namespace: default
71+
type: kubernetes.io/dockerconfigjson
72+
data:
73+
.dockerconfigjson: <base64-encoded-docker-config>
74+
```
75+
76+
Or use kubectl:
77+
78+
```bash
79+
kubectl create secret docker-registry registry-credentials \
80+
--docker-server=<registry-url> \
81+
--docker-username=<username> \
82+
--docker-password=<password> \
83+
--docker-email=<email>
84+
```
85+
86+
### Check Function Status
87+
88+
View the status of your function:
89+
90+
```bash
91+
kubectl get function my-function -o yaml
92+
```
93+
94+
The status will include:
95+
- Function name and runtime
96+
- Deployed image reference
97+
- Middleware version
98+
- Deployment conditions
99+
100+
## Development
101+
102+
### Local Development Cluster
103+
104+
For local development, you can use the provided script to set up a Kind cluster with all prerequisites:
105+
106+
```bash
107+
./hack/create-kind-cluster.sh
108+
```
109+
110+
This script will:
111+
- Create a local Kind cluster with multiple worker nodes
112+
- Set up a local container registry on `localhost:5001`
113+
- Install Tekton Pipelines
114+
- Install Knative Serving with Kourier
115+
- Configure the cluster to use the local registry
116+
117+
### Build and Install the Operator
118+
119+
```bash
120+
make docker-build IMG=<your-registry>/func-operator:latest
121+
make deploy IMG=<your-registry>/func-operator:latest
122+
```
123+
124+
### Run Tests
125+
126+
```bash
127+
# Unit tests
128+
make test
129+
130+
# E2E tests
131+
make test-e2e
132+
```
133+
134+
### Linting
135+
136+
```bash
137+
# Run linter
138+
make lint
139+
```
140+
141+
## API Reference
142+
143+
### Function Spec
144+
145+
| Field | Type | Required | Description |
146+
|-------|------|----------|-------------|
147+
| `source.repositoryUrl` | string | Yes | Git repository URL containing the function source code |
148+
| `registry.path` | string | Yes | Container registry path for the function image |
149+
| `registry.insecure` | boolean | No | Allow insecure registry connections |
150+
| `registry.authSecretRef` | object | No | Reference to registry authentication secret |
151+
152+
### Function Status
153+
154+
| Field | Type | Description |
155+
|-------|------|-------------|
156+
| `name` | string | Function name from metadata |
157+
| `runtime` | string | Detected function runtime |
158+
| `deployedImage` | string | Full image reference of deployed function |
159+
| `middlewareVersion` | string | Version of function middleware |
160+
| `conditions` | array | Status conditions |
161+
162+
## Uninstallation
163+
164+
Remove the operator and CRDs:
165+
166+
```bash
167+
# Undeploy operator
168+
make undeploy
169+
170+
# Uninstall CRDs
171+
make uninstall
172+
```

0 commit comments

Comments
 (0)