Skip to content

Latest commit

 

History

History
268 lines (172 loc) · 4.45 KB

File metadata and controls

268 lines (172 loc) · 4.45 KB

Developing ExploitIQ Operator

This document provides guidance for building, testing, and contributing to the ExploitIQ Operator.

Prerequisites

  • Go 1.24 or later
  • Docker or Podman
  • oc or oc CLI
  • Access to a Kubernetes 1.29+ or OpenShift 4.16+ cluster
  • operator-sdk v1.41.1 (optional, for bundle operations)

Building the Operator

Building the Binary

Build the operator binary locally:

make build

The binary is output to bin/manager.

Building the Container Image

Build the operator container image:

make docker-build IMG=<your-registry>/<image-name>:<tag>

Example:

make docker-build IMG=quay.io/myorg/exploit-iq-operator:v1.0.0

Pushing the Container Image

Push the operator image to a container registry:

make docker-push IMG=<your-registry>/<image-name>:<tag>

Example:

make docker-push IMG=quay.io/myorg/exploit-iq-operator:v1.0.0

Building and Pushing Combined

Build and push in a single command:

make docker-build-push IMG=<your-registry>/<image-name>:<tag>

Multi-Platform Builds

Build for multiple platforms:

make docker-buildx IMG=<your-registry>/<image-name>:<tag> PLATFORMS=linux/amd64,linux/arm64

Code Generation

Generating Manifests

Generate CRDs, RBAC, and other manifests:

make manifests

This command generates:

  • CRDs in config/crd/bases/
  • RBAC in config/rbac/

Generating DeepCopy Methods

Generate DeepCopy, DeepCopyInto, and DeepCopyObject methods:

make generate

Combined Generation

Generate both manifests and code:

make generate manifests

Run this command after modifying API types in api/v1alpha1/.

Testing

Running Unit Tests

Run unit tests with coverage:

make test

This command:

  • Sets up envtest (Kubernetes test environment)
  • Runs all unit tests
  • Generates a coverage report (cover.out)

Running E2E Tests

Run end-to-end tests:

make test-e2e

This command:

  • Creates a Kind cluster (exploit-iq-operator-test-e2e)
  • Runs e2e tests in test/e2e/
  • Cleans up the cluster after tests complete

To manually clean up the test cluster:

make cleanup-test-e2e

Running Linters

Run golangci-lint:

make lint

Auto-fix linting issues:

make lint-fix

Verify linter configuration:

make lint-config

Running Code Formatters

Format code with gofmt:

make fmt

Run go vet:

make vet

Local Development

Installing CRDs

Install the CRDs into your cluster:

make install

Uninstalling CRDs

Remove the CRDs from your cluster:

make uninstall

Deploying the Operator

Deploy the operator to your cluster:

make deploy IMG=<your-registry>/<image-name>:<tag>

The operator deploys into the exploit-iq-operator-system namespace.

Undeploying the Operator

Remove the operator from your cluster:

make undeploy

Running Locally

Run the operator locally (outside the cluster) against your kubeconfig:

make run

This mode is useful for rapid development and debugging.

Quick Redeployment

Rebuild, push, and redeploy the operator:

make redeploy IMG=<your-registry>/<image-name>:<tag>

This command:

  1. Generates manifests
  2. Builds and pushes the image
  3. Deploys to the cluster
  4. Restarts the controller pod

Kubernetes Installation

For deploying the operator on vanilla Kubernetes (without OLM), refer to installing_kubernetes.md.

Bundle and Catalog Management

For all bundle and catalog operations (creating new versions, fixing production bundles, building your own CatalogSource), refer to managing_bundles_catalogs.md.

Debugging

Checking Operator Logs

oc logs -n exploit-iq-operator-system deployment/exploit-iq-operator-controller-manager

Checking CR Status

oc get exploitiqstack <name> -o yaml

Checking Component Deployments

oc get deployments -n <namespace>

Checking Conditions

oc get exploitiqstack <name> -o jsonpath='{.status.conditions}' | jq

Additional Resources