knative / knative/func

cluster: replace exec with API calls

Open
#3,964 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Description

The `pkg/cluster` package still shells out via `exec` for kind, kubectl, and (where still used) docker/podman CLIs. We already use the Kubernetes and Docker APIs extensively elsewhere in func.

Longer-term goal: replace those `exec` calls with library/API usage (kind Go API, client-go apply, docker/podman SDK) the same way builders graduated from wrapping CLIs to library calls.

### Context

Raised by @matejvasek on #3856 (in-cluster registry migration); tracking here so the stepping-stone path stays explicit:

> why we use `exec()` instead of using Go code, kind/kubectl is Go code. Also why call docker via CLI `exec()`? Why not API?

Scripts -> Go with the current structure is the intentional first step; next is replace execs with stdlib/APIs where possible.

### Suggested Stages:

- kind: create/delete/cluster ops via kind's Go API
- kubectl apply / wait: client-go (or existing apply helpers) for resources we already model as objects
- docker/podman host config: daemon.json / registries.conf via API or small pure-Go writers (already partially pure file I/O)

### See also:

- Parent migration PR: https://github.com/knative/func/pull/3856
- Board: Functions#43

Contributor guide

Open the contributing guide

Research direction

Start by inventorying the exec calls in pkg/cluster and read the parent migration PR #3856 alongside the existing API usage in builders. Work through the suggested kind, kubectl, and docker/podman stages; done means the targeted cluster operations use Go APIs or pure-Go file handling instead of CLI exec calls while preserving current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, kubernetes
Domain
cli, devops, infrastructure
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.