Skip to content

refactor(kubernetes): drop the typed clientset to shrink the binary by 26MB - #1686

Merged
edenreich merged 1 commit into
mainfrom
refactor/drop-kubernetes-clientset-1649
Nov 3, 2026
Merged

edenreich merged 1 commit into
mainfrom
refactor/drop-kubernetes-clientset-1649

Conversation

@edenreich

@edenreich edenreich commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The teleport workspace imported k8s.io/client-go/kubernetes, whose scheme links all 56 k8s.io/api groups and 55 typed clients into the binary. The package only needs Secrets, one Deployment status field, the port-forward URL, the operator check and the server version.

  • Secrets and the gateway Deployment go through the dynamic client the package already uses, with DefaultUnstructuredConverter keeping corev1.Secret as the working type.
  • The operator check lists Orchestrators with Limit: 1. A cluster without the CRD answers not found, as discovery did.
  • A scheme-free core/v1 REST client builds the port-forward URL and reads /version.
  • Tests run on the dynamic fake alone. kubernetes/fake, discovery/fake and k8s.io/api/apps/v1 are gone.
before after
stripped darwin/arm64 task build 105.2MB 79.4MB
linked k8s.io/api/ packages 56 1 (core/v1)

Verification

  • go list -tags purego -deps ./cmd/infer lists no k8s.io/client-go/kubernetes or discovery package and only k8s.io/api/core/v1.
  • go test ./internal/agent/infrastructure/kubernetes/ ./cmd/daemon/... and task precommit:run pass.
  • Live teleport from this branch to the build-cluster kubernetes workspace (k3s v1.37.1, operator installed):
    • /workspaces probe reports kubernetes=v1.37.1+k3s1 and orchestrators=1
    • the new <name>-tls Secret holds the six keys and its single owner reference is the session's Orchestrator, UID matching
    • the shared credentials Secret gained the new Orchestrator as a second owner with its revision unchanged
    • the parked gateway Deployment scaled to 1/1 and the teleport waited for it
    • the port-forward connected and a prompt round-tripped through the pod daemon

Closes #1649

…y 26MB

The teleport workspace imported k8s.io/client-go/kubernetes, whose scheme
links all 56 k8s.io/api groups and 55 typed clients into the binary. The
package only needs Secrets, one Deployment status field, the port-forward
URL, the operator check and the server version.

Secrets and the gateway Deployment now go through the dynamic client the
package already uses, converted with the unstructured converter. The
operator check lists Orchestrators with a limit of one, which a cluster
without the CRD answers with not found just as discovery did. A scheme-free
core/v1 REST client builds the port-forward URL and reads /version.

Stripped darwin/arm64 drops from 105.2MB to 79.4MB and the linked
k8s.io/api packages from 56 to core/v1 alone.

Closes #1649
@edenreich
edenreich requested a review from a team as a code owner November 3, 2026 00:26
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 3, 2026
@edenreich
edenreich merged commit d2d70ad into main Nov 3, 2026
1 check passed
@edenreich
edenreich deleted the refactor/drop-kubernetes-clientset-1649 branch November 3, 2026 00:45
@edenreich edenreich moved this from Todo to Done in 2026 Nov 3, 2026
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.241.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 3, 2026
edenreich added a commit that referenced this pull request Nov 3, 2026
## Summary

GitHub serves release assets uncompressed, so every install moved the
whole executable, about 105MB per platform (80MB after #1686). Each
platform now ships as `infer-<os>-<arch>.tar.gz` holding one file,
`infer` (`infer.exe` on Windows). `checksums.txt` and its Cosign bundle
cover the archives.

- `release.yml` archives the artifacts in the release job with GNU tar
(`--transform` renames the entry, `--owner=0 --group=0`), checksums the
archives and verifies the new asset list.
- `release.config.mjs` uploads the archives.
- `install.sh`, `install.ps1` and `npm/bin/install.js` download the
archive and extract it with the system `tar`, which macOS, Linux and
Windows 10+ ship.
- `docs/installation.md` and `docs/binary-verification.md` describe the
archives.
- The container image builds from the workflow's raw artifacts via
`--build-context binaries=dist/`, unchanged.

The raw `infer-<os>-<arch>` release assets are gone.

| | before | after |
| --- | --- | --- |
| darwin/arm64 asset | 79.4MB raw | 25.9MB `.tar.gz` |

## Affected repos

Consumers of the raw asset names outside this repository, found with `gh
search code` and a grep of shallow clones:

- **inference-gateway/infer-action**: inference-gateway/infer-action#433
downloads the archive and falls back to the raw asset for pinned older
versions.
- **inference-gateway/desktop**: `backend/src/env.rs` maps the platform
to the raw asset name and `backend/src/cli_install.rs` downloads it from
`releases/latest/download`, verifies it against `checksums.txt` and
renames it into place. inference-gateway/desktop#420 downloads the
archive, verifies it and extracts it. Desktop builds already installed
keep calling the raw URL, so that desktop release should go out before
this merges.
- **inference-gateway/opentask** pins the Nix flake and
**inference-gateway/docs** only points at `install.sh`. Neither changes.

## Verification

- `install.sh` and the npm postinstall run against a local server
holding a `.tar.gz` built from this branch's binary and its
`checksums.txt`: both install a working `infer`, and a tampered checksum
fails the npm install.
- The archive step ran under GNU tar 1.35 from nixpkgs: the Linux
archive holds `infer`, the Windows one `infer.exe`, both owned by root.
- `task precommit:run` passes.

Closes #1687
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor drop the full Kubernetes clientset to shrink the binary by ~26MB

1 participant