Skip to content

PAT-1963 Move App-family CRD definitions out of k8s-client - #549

Merged
pepamartinec merged 8 commits into
mainfrom
pepa/PAT-1963-move-app-crd
Jul 27, 2026
Merged

PAT-1963 Move App-family CRD definitions out of k8s-client#549
pepamartinec merged 8 commits into
mainfrom
pepa/PAT-1963-move-app-crd

Conversation

@pepamartinec

@pepamartinec pepamartinec commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Release Notes

https://linear.app/keboola/issue/PAT-1963/move-app-family-crd-definitions-from-keboolak8s-client-into-sandboxes

Note

Pridani podpory pro custom/extra API na client facade, presunuti App-related CRD primo do sandboxes-service

  • nikde jinde se App nepouziva
  • odstranuej zbytecny kolecko updatu k8s-client lib s kazdou zmenou CRD (a ted jich zase bude dost)

Two related breaking changes to keboola/k8s-client, released together as 5.0.0:

1. apps.keboola.com App-family removed. The App/AppRun models, BaseApi, and typed clients (and the facade's apps()/appRuns() accessors) are gone — they now live in sandboxes-service. The App Deployments work iterates heavily on these CRDs; owning them in the consuming service removes the library-release + composer-bump roundtrip for every CRD tweak. The facade instead exposes a generic client(<modelClass>) accessor and an $extraClients registry (array<class-string, ApiClientInterface>) that consumers populate with their own CRD clients; the generic facade methods (mergePatch, deleteAllMatching, get, …) all work for any registered type.

2. Factory layer split into client factories + one universal facade factory. The four Keboola\K8sClient\ClientFacadeFactory\{Generic,InCluster,EnvVariables,AutoDetect}ClientFacadeFactory classes differed only in how they produced a configured client. They are replaced by a Keboola\K8sClient\ClientFactory\ strategy family — KubernetesApiClientFactory (interface, createApiClient(?ns): KubernetesApiClient) with Static/InCluster/EnvVariables/AutoDetect implementations. The facade is then assembled from that client by a static named constructor KubernetesApiClientFacade::create(KubernetesApiClient, LoggerInterface, $extraClients) (no separate facade-factory class). ClientConfigurator + Token\* moved into ClientFactory\, the misleading @internal was dropped from KubernetesApiClient (it's the public construction seam), and the README now documents $extraClients + a Symfony wiring recipe.

Migration (for the other five keboola/k8s-client consumers)

connection, job-queue, job-queue-daemon, runner-sync-api, sandboxes stay on ^4.x (unaffected until they opt into ^5.0) and migrate on their own schedule. When bumping to 5.0.0:

  • Replace new <X>ClientFacadeFactory(...)->createClusterClient(...) with: build a ClientFactory\<X>KubernetesApiClientFactory (credentials in its constructor), call createApiClient(?ns) to get a KubernetesApiClient, then the static KubernetesApiClientFacade::create($apiClient, $logger[, $extraClients]).
  • Repoint any ClientFacadeFactory\ClientConfigurator / ClientFacadeFactory\Token\* imports to ClientFactory\….
  • If you used apps()/appRuns() or any Model\Io\Keboola\Apps\* class (none of these five do today), those are gone — register your own client via $extraClients and use client().

Non-blocking follow-ups noted in review (deferred): identifier-scope the 3 remaining generic-registry @phpstan-ignore; append "plus registered extra CRD types" to the deleteAllMatching default-set docblock; drop leftover apps.keboola.com RBAC in provisioning/local/kubernetes/main.tf.

Plans for customer communication

None.

Impact analysis

No end-user impact. Internal library change; the sole consumer of the removed App-family classes (sandboxes-service) is updated in the linked PR. Breaking for consumers of the old factory classes — the other five are unaffected until they choose to bump to ^5.0 and migrate per the note above.

Change type

Refactoring

Justification

Prerequisite for the App Deployments model — CRD shape changes become single-repo edits in sandboxes-service; the factory split cleanly separates credential resolution from facade assembly.

Deployment

Merge to main, then push tag k8s-client/5.0.0 to publish the major release.

Rollback plan

Revert of this PR.

Post release support plan

None.

…ster via extraClients

BREAKING CHANGE: App/AppRun models, BaseApi, typed clients and the facade apps()/appRuns() accessors are removed. Consumers register their own CRD clients via KubernetesApiClientFacade $extraClients + client().
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

PAT-1963

…sal facade factory

Replace the four *ClientFacadeFactory classes with a KubernetesApiClientFactory
strategy family (Static/InCluster/EnvVariables/AutoDetect), each producing a
single configured KubernetesApiClient, plus one universal
KubernetesApiClientFacadeFactory that assembles a KubernetesApiClientFacade
from any of them. This separates credential resolution from facade assembly
and removes the indirection through a shared "generic" factory.

BREAKING CHANGE: removed Keboola\K8sClient\ClientFacadeFactory\GenericClientFacadeFactory,
InClusterClientFacadeFactory, EnvVariablesClientFacadeFactory and
AutoDetectClientFacadeFactory (and their Token\* originals). Replaced by
Keboola\K8sClient\ClientFactory\StaticKubernetesApiClientFactory,
InClusterKubernetesApiClientFactory, EnvVariablesKubernetesApiClientFactory,
AutoDetectKubernetesApiClientFactory (all implementing
KubernetesApiClientFactory::createApiClient(?string $namespace): KubernetesApiClient)
and KubernetesApiClientFacadeFactory::create(KubernetesApiClient, array $extraClients = []): KubernetesApiClientFacade.
ClientConfigurator and Token\{TokenInterface,StaticToken,InClusterToken} moved
to the Keboola\K8sClient\ClientFactory namespace.
…ct FakeCrdModel fixture

- AutoDetect probes in-cluster availability without the caller namespace, matching the original
  AutoDetectClientFacadeFactory (the in-cluster branch also requires the namespace file).
- Move FakeCrdModel to its own PSR-4 file so KubernetesApiClientFacadeFactoryTest no longer depends
  on a fixture defined inside another test file (fixed an isolation-order error).
…piClientFacade::create()

BREAKING CHANGE: KubernetesApiClientFacadeFactory is removed; build the facade via the static named
constructor KubernetesApiClientFacade::create(KubernetesApiClient, LoggerInterface, array $extraClients).
Also drops the misleading @internal from KubernetesApiClient (it is the public construction seam) and
documents $extraClients + a Symfony wiring recipe in the README.
@pepamartinec
pepamartinec requested a review from romantmb July 27, 2026 07:45
@pepamartinec
pepamartinec marked this pull request as ready for review July 27, 2026 07:45

@keboola-pr-reviewer-bot keboola-pr-reviewer-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: needs_human (risk 3/5) · profile ajda

reviewer stopped after 1/18 turns without emitting a verdict — escalating to human.

@romantmb romantmb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@pepamartinec
pepamartinec merged commit f0dba8d into main Jul 27, 2026
28 checks passed
@pepamartinec
pepamartinec deleted the pepa/PAT-1963-move-app-crd branch July 27, 2026 12:02
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