Skip to content

refactor kubernetes client - #782

Merged
klihub merged 3 commits into
containers:mainfrom
bart0sh:PR002-refactor-kubernetes-client
Sep 15, 2026
Merged

klihub merged 3 commits into
containers:mainfrom
bart0sh:PR002-refactor-kubernetes-client

Conversation

@bart0sh

@bart0sh bart0sh commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This PR is based on #536
It's a preparation PR for upcoming DRA integration PR #774

  • Move pkg/agent/watch to pkg/kubernetes/watch (plain rename) so kubernetes-related helpers live under a common package, ahead of adding a new client package there.
  • Add pkg/kubernetes/client: wraps REST config, HTTP client, and clientset construction (from a kubeconfig file or in-cluster config) behind a single Client type, so callers don't need to wire up all three separately.
  • Switch pkg/agent to use client.Client instead of its own hand-rolled REST config/HTTP client/clientset setup, dropping the now-redundant getRESTConfig helper and exposing the wrapped client, kubeconfig path, and REST config via new KubeClient/KubeConfig/RestConfig accessors.

@bart0sh
bart0sh marked this pull request as ready for review September 14, 2026 08:09
@bart0sh

bart0sh commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@klihub PTAL

@klihub klihub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@klihub klihub changed the title Refactor kubernetes client agent,kubernetes: refactor kubernetes client Sep 14, 2026
@askervin

Copy link
Copy Markdown
Collaborator

Could we change git commit messages a bit, changing from:

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

to:

Assisted-by:  Claude Sonnet 5 <noreply@anthropic.com>

or, alternatively, no mention about the model at all, if you see no reason for it.

@askervin

Copy link
Copy Markdown
Collaborator

Otherwise, this looks good to me.

Kubernetes-related helpers are being consolidated under
pkg/kubernetes so they can be shared beyond the agent. Move the
watch package there first, as a plain rename, ahead of adding the
new kubernetes client package.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Add a pkg/kubernetes/client package that bundles the REST config,
HTTP client, and clientset construction (from a kubeconfig file or
in-cluster config) behind a single Client type, so callers no longer
need to wire up all three separately.

Not yet used by anything; pkg/agent will be switched over next.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Replace the agent's hand-rolled REST config/HTTP client/clientset
setup with the new pkg/kubernetes/client wrapper. This also drops
the now-redundant getRESTConfig helper and exposes the wrapped
client, kubeconfig path, and REST config to callers via new
KubeClient/KubeConfig/RestConfig accessors.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
@bart0sh
bart0sh force-pushed the PR002-refactor-kubernetes-client branch from 7f036c6 to ba5f16e Compare September 14, 2026 16:39
@bart0sh

bart0sh commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@askervin Removed "Co-Authored-By" from all commits. The PR should be ready for a merge.

@askervin askervin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klihub
klihub merged commit afd1a60 into containers:main Sep 15, 2026
12 checks passed
@bart0sh bart0sh changed the title agent,kubernetes: refactor kubernetes client refactor kubernetes client Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants