Skip to content

Latest commit

 

History

History
128 lines (85 loc) · 3.47 KB

File metadata and controls

128 lines (85 loc) · 3.47 KB

Contributing to func-operator

Thank you for your interest in contributing to func-operator! This guide will help you get started.

How to Contribute

Reporting Issues

If you find a bug or have a feature request, please open an issue on GitHub.

Submitting Pull Requests

  1. Fork the repository and create your branch from main.
  2. Make your changes, ensuring they follow the guidelines below.
  3. Run tests and linting locally before pushing.
  4. Open a pull request against main.

All CI checks must pass before a pull request can be merged.

Development

Prerequisites

  • Go (see go.mod for the required version)
  • Docker
  • Kind (for local development)
  • kubectl

Local Development Cluster

For local development, you can use the provided script to set up a Kind cluster with all prerequisites:

./hack/create-kind-cluster.sh

This script will:

  • Create a local Kind cluster with multiple worker nodes
  • Set up a local container registry on localhost:5001
  • Install Tekton Pipelines
  • Install Knative Serving with Kourier
  • Configure the cluster to use the local registry

Note: The local registry uses HTTPS with a self-signed certificate. When running E2E tests locally, you need to set REGISTRY_INSECURE=true so the operator accepts the self-signed certificate (see E2E Tests).

Build and Install the Operator

make docker-build IMG=<your-registry>/func-operator:latest
make deploy IMG=<your-registry>/func-operator:latest

Debugging

For debugging the operator with Delve, use the debug targets:

# Build the debug image (includes Delve debugger and debug symbols)
make docker-build-debugger IMAGE_TAG_BASE=<your-registry>/func-operator

# Push the debug image
make docker-push-debugger IMAGE_TAG_BASE=<your-registry>/func-operator

# Deploy the operator in debug mode
make deploy-debugger IMAGE_TAG_BASE=<your-registry>/func-operator

The debug deployment runs the operator under Delve in headless mode, listening on port 40000. To connect your debugger:

# Port-forward to access the debugger
kubectl port-forward -n func-operator-system deployment/func-operator-controller-manager 40000:40000

# Connect with Delve CLI
dlv connect localhost:40000

You can also connect using your IDE's remote debugging features (VS Code, GoLand, etc.) by configuring it to connect to localhost:40000.

Code Generation

After modifying API types or interfaces, regenerate the derived code:

make update-codegen

This runs three sub-targets:

  • generate — DeepCopy and DeepCopyInto methods
  • manifests — CRDs, ClusterRoles, and webhook configurations
  • gen-mocks — Mock implementations via mockery

Testing

Unit Tests

make test

E2E Tests

E2E tests require a Kind cluster with Gitea (an in-cluster Git server providing complete test isolation):

make create-kind-cluster  # Sets up cluster with Gitea
REGISTRY_INSECURE=true make test-e2e

The REGISTRY_INSECURE=true flag is required because the local Kind registry uses a self-signed TLS certificate.

See Gitea Integration for details on the test infrastructure.

Bundle Tests

REGISTRY_INSECURE=true make test-e2e-bundle

Linting

# Run linter
make lint

# Run linter with auto-fix
make lint-fix