Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,22 @@ func (e *StdEngine) loadPluginInternal(p plugin.EnginePlugin, allowOverride bool
}
}
}
// Register any platform.kubernetes backends the plugin serves into module's
// package-level registry, so `platform.kubernetes` configs with a
// plugin-provided `type:` (e.g. gke) dispatch to the plugin-served
// ResourceDriver-backed backend. Per ADR 0037 — folds into the existing
// ResourceDriver contract, no new proto surface.
if kb, ok := p.(plugin.KubernetesBackendProvider); ok {
clients, err := kb.KubernetesBackendClients()
if err != nil {
return fmt.Errorf("load plugin %q: kubernetes backends: %w", p.EngineManifest().Name, err)
}
for name, client := range clients {
if err := module.RegisterKubernetesBackendClient(name, client); err != nil {
return fmt.Errorf("load plugin %q: %w", p.EngineManifest().Name, err)
}
}
}
e.enginePlugins = append(e.enginePlugins, p)
return nil
}
Expand Down
34 changes: 26 additions & 8 deletions module/platform_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,33 @@ func (m *PlatformKubernetes) Init(app modular.Application) error {
clusterType = "kind"
}

factory, ok := kubernetesBackendRegistry[clusterType]
if !ok {
return fmt.Errorf("platform.kubernetes %q: unsupported type %q", m.name, clusterType)
}
backend, err := factory(m.config)
if err != nil {
return fmt.Errorf("platform.kubernetes %q: creating backend: %w", m.name, err)
if _, isCore := reservedKubernetesBackendTypes[clusterType]; isCore {
// SDK-free in-core backend (kind/k3s/eks/aks) — use the in-process
// factory map unchanged.
factory, ok := kubernetesBackendRegistry[clusterType]
if !ok {
return fmt.Errorf("platform.kubernetes %q: unsupported type %q", m.name, clusterType)
}
backend, err := factory(m.config)
if err != nil {
return fmt.Errorf("platform.kubernetes %q: creating backend: %w", m.name, err)
}
m.backend = backend
} else {
// Not an in-core cluster type — consult the plugin-backend registry.
// The engine populates kubernetesBackendClientRegistryInstance at
// plugin-load time; a resolved type (e.g. gke) is served over gRPC via
// the ResourceDriver contract, wrapped in grpcKubernetesBackend. Per
// ADR 0037.
client, ok := kubernetesBackendClientRegistryInstance.resolve(clusterType)
if !ok {
return fmt.Errorf("platform.kubernetes %q: cluster type %q is not built into workflow core "+
"(in-core types: 'kind', 'k3s', 'eks', 'aks'). If %q is a plugin-provided backend "+
"(e.g. 'gke' via workflow-plugin-gcp), install and load that plugin",
m.name, clusterType, clusterType)
}
m.backend = newGRPCKubernetesBackend(client)
}
m.backend = backend

version, _ := m.config["version"].(string)
m.state = &KubernetesClusterState{
Expand Down
Loading
Loading