kubernetes

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 54 Imported by: 0

Documentation

Overview

Package k8s wraps all Kubernetes access. Everything goes through the user's kubeconfig and client-go — donkey never shells out to kubectl.

Index

Constants

This section is empty.

Variables

View Source
var (
	// FilesHelperImage is the default toolbox for clients without an explicit
	// image. Installations configure their mirror through busyboxImage.
	FilesHelperImage = config.DefaultBusyboxImage
)

Functions

func Ping

func Ping(ctx context.Context, kubeContext string) (string, error)

Ping contacts the cluster and returns its version string.

Types

type AppRef

type AppRef struct {
	Space     string
	App       string
	Namespace string
}

AppRef identifies one deployed app.

type Client

type Client struct {
	Dynamic   dynamic.Interface
	Clientset k8sclient.Interface
	Config    *rest.Config

	// Installation is the installation this client speaks for — the control
	// plane's namespace, which is unique per installation by construction.
	// Everything applied is stamped with it and every cluster-wide sweep
	// requires it, so two donkeys on one cluster stay out of each other's
	// objects. Empty means the default installation.
	Installation string

	// Namespaces narrows every sweep that would otherwise cross the whole
	// cluster. Empty means the cluster, which is what an installation with a
	// namespace per space needs — and has the rights for. An installation
	// confined to namespaces it was given lists only those: it holds no
	// cluster-scoped permission, so a cluster-wide List would not merely
	// return too much, it would be refused.
	Namespaces []string
	// contains filtered or unexported fields
}

Client bundles the two client flavors donkey uses: dynamic for server-side apply of anything, typed for reads (pods, logs, rollout status).

func New

func New(kubeContext string) (*Client, error)

func NewInCluster

func NewInCluster() (*Client, error)

NewInCluster is used by donkey-server, which runs inside the cluster it manages.

func (*Client) AppNetwork

func (c *Client) AppNetwork(ctx context.Context, namespace, objectName, space, app string) (*rt.NetworkState, error)

func (*Client) AppStatus

func (c *Client) AppStatus(ctx context.Context, namespace, objectName, space, app string) (*rt.AppStatus, error)

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, objs []runtime.Object) error

Apply server-side-applies every object with donkey as field manager. It is idempotent: create and update are the same operation.

func (*Client) CheckNamespaceFree

func (c *Client) CheckNamespaceFree(ctx context.Context, namespace, space string) error

CheckNamespaceFree refuses to move into a namespace that exists but isn't donkey's — a space name must never let donkey take over (or later delete) somebody else's namespace. Only the managed annotation counts: a label somebody put on their own namespace must not turn it into one donkey may delete.

func (*Client) Confined

func (c *Client) Confined() bool

Confined reports whether this installation lives in namespaces it was given rather than ones it made. A confined donkey must not create or delete a namespace — and must not read one either, since its rights stop at the namespace boundary and the attempt would simply be refused.

func (*Client) DeleteAddon

func (c *Client) DeleteAddon(ctx context.Context, namespace, space, addon string, keepData bool) error

DeleteAddon removes one space service and optionally keeps its disk.

func (*Client) DeleteAppResources

func (c *Client) DeleteAppResources(ctx context.Context, namespace, space, app string, keepData bool) error

DeleteAppResources deletes only one logical app. A space is a separate lifecycle boundary and is removed only through DeleteSpace.

func (*Client) DeleteAppRoute

func (c *Client) DeleteAppRoute(ctx context.Context, namespace, space, app string) error

DeleteAppRoute removes the app's own-hostname route by immutable identity. The path-route cleanup separately deletes names obtained from an owned label query, but this route starts from a deterministic name and therefore must not grant that name deletion authority by itself.

func (*Client) DeleteAppTraffic

func (c *Client) DeleteAppTraffic(ctx context.Context, namespace, space, app string) error

DeleteAppTraffic retracts one app's system-namespace traffic objects. Labels, rather than deterministic names, are the deletion authority.

func (*Client) DeleteLegacySystemConfig

func (c *Client) DeleteLegacySystemConfig(ctx context.Context, namespace string) error

Run only after the new manifests have rolled out: old pods may still read the previous Secret while the update is in progress.

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, kind, namespace, name string, identity map[string]string) error

DeleteObject removes one named object only after its immutable identity matches. Missing objects are fine. The caller gets the name from an owned query, but the second check closes the list/delete race.

func (*Client) DeleteObsoleteAppTraffic

func (c *Client) DeleteObsoleteAppTraffic(ctx context.Context, namespace, space, app string, keepCertificate, keepDNS bool) error

DeleteObsoleteAppTraffic retracts objects omitted by the active certificate and DNS settings after their replacements have been applied.

func (*Client) DeleteObsoleteSystemTraffic

func (c *Client) DeleteObsoleteSystemTraffic(ctx context.Context, namespace string, keepCertificate, keepDNS bool) error

DeleteObsoleteSystemTraffic retracts installation-host objects omitted by the active certificate and DNS settings. Named, ownership-checked deletes avoid touching the gateway's separate ACME cache or built-in CA Secrets, which carry the same system role.

func (*Client) DeleteSpace

func (c *Client) DeleteSpace(ctx context.Context, namespace, space string) error

DeleteSpace removes an owned space namespace and everything in it. The namespace ownership annotation is the deletion authority; labels alone are never enough to make somebody else's namespace deletable.

func (*Client) DeleteSpaceIsolation

func (c *Client) DeleteSpaceIsolation(ctx context.Context, namespace, space string) error

DeleteSpaceIsolation retracts only the space's network fence when an installation turns isolation off. The deterministic policy name is not deletion authority; installation + logical space + role are.

func (*Client) DeleteSpaceObjects

func (c *Client) DeleteSpaceObjects(ctx context.Context, namespace, space string) error

DeleteSpaceObjects removes a logical space from a shared namespace. The installation + space selector keeps every other tenant and installation outside the deletion boundary.

func (*Client) DeleteSpaceTraffic

func (c *Client) DeleteSpaceTraffic(ctx context.Context, namespace, space string) error

DeleteSpaceTraffic retracts Certificates, generated TLS Secrets and DNS records from the system namespace before their workload namespace disappears.

func (*Client) DeploymentAnnotation

func (c *Client) DeploymentAnnotation(ctx context.Context, namespace, name, space, app, key string) (string, error)

DeploymentAnnotation reads one annotation off a Deployment; a missing Deployment (or annotation) is "".

func (*Client) DeploymentIdentity

func (c *Client) DeploymentIdentity(ctx context.Context, namespace, name string) (map[string]string, bool, error)

DeploymentIdentity reports the stable role of a named Deployment.

func (*Client) DetachAddon

func (c *Client) DetachAddon(ctx context.Context, namespace, space, app, addon string) error

DetachAddon removes only one app's copy of a space service binding.

func (*Client) ForInstallation

func (c *Client) ForInstallation(system, workload string) *Client

ForInstallation is WithInstallation spelled from an installation's settings: confined to the two namespaces it was given when a workload namespace is named, cluster-wide otherwise. The one rule the server and the gateway must agree on, so it is written once.

func (*Client) GetEnv

func (c *Client) GetEnv(ctx context.Context, namespace, space, app, objectName string) (map[string]string, error)

GetEnv returns the app's current env vars from its env secret.

func (*Client) GetOwnedSecretData

func (c *Client) GetOwnedSecretData(ctx context.Context, namespace, name string, identity map[string]string) (map[string]string, error)

GetOwnedSecretData reads a donkey-created Secret only after its complete immutable identity matches. GetSecretData remains for explicitly configured source Secrets that belong to the cluster operator, not donkey.

func (*Client) GetSecretData

func (c *Client) GetSecretData(ctx context.Context, namespace, name string) (map[string]string, error)

GetSecretData returns a secret's data as strings; a missing secret is an empty map.

func (*Client) HasDataClaim

func (c *Client) HasDataClaim(ctx context.Context, namespace, objectName, space, app string) bool

HasDataClaim reports whether the app's data volume exists — used to tell the user about a disk left over from an earlier configuration.

func (*Client) HasDefaultStorageClass

func (c *Client) HasDefaultStorageClass(ctx context.Context) (bool, error)

HasDefaultStorageClass reports whether the cluster can provision volumes without naming a class — what app storage and provisioned addons rely on.

func (*Client) HasResource

func (c *Client) HasResource(groupVersion, kind string) (bool, error)

HasResource reports whether the cluster serves a kind — how the installer finds out, before applying anything, that a configuration names a CRD (Certificate or DNSEndpoint) whose operator isn't installed. An absent group is an answer, not an error.

func (*Client) ListAddonAttachments

func (c *Client) ListAddonAttachments(ctx context.Context, namespace, space, addon string) ([]string, error)

ListAddonAttachments names the apps holding a copy of the shared addon's binding.

The space is part of the selector, not a nicety: where every space shares one namespace, "addon-postgres" is a binding name several spaces have, and without it removing one space's database would detach another's apps.

func (*Client) ListAddonBindings

func (c *Client) ListAddonBindings(ctx context.Context, namespace, space, app string) ([]rt.ServiceBindingInfo, error)

ListAddonBindings finds the app's addon binding Secrets. An empty app selects the space's canonical bindings, which deliberately have no pseudo-app label.

func (*Client) ListApps

func (c *Client) ListApps(ctx context.Context) ([]AppRef, error)

ListApps finds every deployed donkey app in the cluster, grouped later by space. Apps are their Deployments — a namespace alone says nothing now that a space holds many apps.

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, namespace, objectName, space, app, subPath string) ([]rt.FileEntry, error)

ListFiles returns the entries of one folder on the app's disk. An empty subPath lists the root of the volume, where each app storage path has its own folder.

func (*Client) ListGatewayConfigMaps

func (c *Client) ListGatewayConfigMaps(ctx context.Context) ([]corev1.ConfigMap, error)

ListGatewayConfigMaps returns the installation's routes and access policies together so the gateway rebuilds them from the same snapshot.

The installation label is the ownership boundary. Do not select on app.kubernetes.io/managed-by here: a route may be managed by Helm or GitOps even though donkey-gateway serves it. A route.yaml data entry identifies a route; legacy backend annotations remain readable during upgrades.

func (*Client) ListManagedRoutes

func (c *Client) ListManagedRoutes(ctx context.Context) ([]corev1.ConfigMap, error)

ListManagedRoutes returns only routing entries from the gateway snapshot.

func (*Client) ListRouteNames

func (c *Client) ListRouteNames(ctx context.Context, namespace, space, app string) ([]string, error)

ListRouteNames returns the shared-address routes an app currently owns — the ones donkey renders from `routes:` in donkey.yaml.

func (*Client) ListSpaceMarkers

func (c *Client) ListSpaceMarkers(ctx context.Context, namespace string) ([]AppRef, error)

ListSpaceMarkers finds the spaces of an installation that shares one namespace, where a space is an object rather than a namespace. A space with apps has them; one holding only services — or nothing at all, freshly made in the console — has only this.

func (*Client) ListSpaces

func (c *Client) ListSpaces(ctx context.Context) ([]AppRef, error)

ListSpaces finds every donkey space namespace, including ones holding no app — a space can carry only services now, and it must not vanish from view for that.

func (*Client) MakeDir

func (c *Client) MakeDir(ctx context.Context, namespace, objectName, space, app, subPath string) error

MakeDir creates one folder. Its parent must already exist, so a typo makes a folder in the wrong place impossible rather than merely unlikely.

func (*Client) MigrateGatewaySecrets

func (c *Client) MigrateGatewaySecrets(ctx context.Context, namespace string) error

MigrateGatewaySecrets runs before the gateway starts issuing certificates, including when an operator applies a rendered bundle instead of the CLI. The original cache stays available to gateway pods during their rollout.

func (*Client) MoveFile

func (c *Client) MoveFile(ctx context.Context, namespace, objectName, space, app, from, to string) error

MoveFile renames or moves something on the disk. A destination that is an existing folder means "move it in there", as everywhere else.

func (*Client) NamespaceLabels

func (c *Client) NamespaceLabels(ctx context.Context, name string) (map[string]string, bool, error)

NamespaceLabels returns a namespace's labels and whether it exists at all. The installer reads them to find out what Pod Security Standard a namespace it was given enforces — the one thing that silently stops donkey after a clean install, because admission rejects the pod and the Deployment just never produces one.

func (*Client) ReadFile

func (c *Client) ReadFile(ctx context.Context, namespace, objectName, space, app, subPath string, w io.Writer) error

ReadFile streams one file off the disk into w. Nothing is buffered, so a large file costs the server no memory.

func (*Client) RemoveFile

func (c *Client) RemoveFile(ctx context.Context, namespace, objectName, space, app, subPath string) error

RemoveFile deletes a file or a whole folder. Deleting something that isn't there is not an error — the point is that it is gone.

func (*Client) RemoveFilesHelper

func (c *Client) RemoveFilesHelper(ctx context.Context, namespace, objectName, space, app string) error

RemoveFilesHelper stops the app's helper pod if one is running. Destroying an app must call this: a pod still holding the volume keeps the disk from being released.

func (*Client) RestartApp

func (c *Client) RestartApp(ctx context.Context, namespace, objectName, space, app string) (bool, error)

RestartApp triggers a fresh rollout so pods pick up changed env vars. Returns false when the app isn't deployed yet (nothing to restart).

func (*Client) RolloutEvidenceFor

func (c *Client) RolloutEvidenceFor(ctx context.Context, namespace, objectName, space, app string) rt.Evidence

RolloutEvidenceFor collects the same pod summaries, problem-pod logs and warning events a failed rollout reports — for on-demand diagnosis of an app that is currently unhealthy.

func (*Client) ServiceEndpoint

func (c *Client) ServiceEndpoint(ctx context.Context, namespace, name, space, addon string) (string, int32, error)

ServiceEndpoint returns the in-cluster host and port of a space service ("" when none runs) — donkey-server sits in the cluster and can dial it directly, which is what the tunnel rides on.

func (*Client) SetAddonEnvFrom

func (c *Client) SetAddonEnvFrom(ctx context.Context, namespace, objectName, space, app, secret string, add bool) (bool, error)

SetAddonEnvFrom adds or removes an addon's binding secret on the app Deployment's envFrom and removes aliases when detached, so a change reaches the running app without a deploy (the template change triggers the rollout). Returns false when the app isn't deployed yet — the next deploy wires it instead.

func (*Client) SetAnnotations

func (c *Client) SetAnnotations(ctx context.Context, kind, namespace, name string, identity map[string]string, annotations map[string]*string) error

SetAnnotations merge-patches annotations on one object; a nil value removes the annotation. Used for the console's own records (donkey.local/console on the Deployment) — a patch instead of an apply, so the field stays out of the deploy's server-side-apply ownership and survives the next deploy untouched.

func (*Client) SetAppNetworkMetadata

func (c *Client) SetAppNetworkMetadata(ctx context.Context, namespace, name, space, app, mode, cors string) error

SetAppNetworkMetadata records network choices on the workload as well as its route. Internal apps have no own route, so the Deployment is the source that lets status and the console retain their mode and CORS policy.

func (*Client) SetEnv

func (c *Client) SetEnv(ctx context.Context, namespace, space, app, objectName string, env map[string]string) error

SetEnv replaces the app's env secret with the given variables.

func (*Client) SharedBindingValues

func (c *Client) SharedBindingValues(ctx context.Context, key, matchKey, matchValue string) ([]string, error)

SharedBindingValues collects a key only from canonical bindings matching the expected endpoint, so another provider's credentials are never accepted.

func (*Client) StorageFolders

func (c *Client) StorageFolders(ctx context.Context, namespace, objectName, space, app string) ([]rt.StorageFolder, error)

StorageFolders reports which folder of the disk belongs to which path inside the app — the volume root is a list of subPath folders, and only the Deployment knows that "app-data" is the app's /app/data.

func (*Client) StreamLogs

func (c *Client) StreamLogs(ctx context.Context, namespace, space, app string, opts rt.LogOptions, out io.Writer) error

StreamLogs writes the logs of every pod of the selected Donkey role to out, prefixed with the pod name when there is more than one.

func (*Client) SwitchToRecreate

func (c *Client) SwitchToRecreate(ctx context.Context, namespace, name, space, app string) error

SwitchToRecreate clears a Deployment's rolling-update settings so its strategy can become Recreate. Kubernetes defaults spec.strategy.rollingUpdate for rolling deployments and then refuses that field together with type: Recreate — so an app that gains storage (and must stop before its replacement starts, since a disk attaches to one machine at a time) would otherwise be stuck on its old strategy. A missing Deployment is fine: the first deploy renders Recreate directly.

func (*Client) SystemSecretData

func (c *Client) SystemSecretData(ctx context.Context, namespace string) (map[string]string, error)

SystemSecretData retains credentials when upgrading to the shared donkey resource name. An ownership or read error must never rotate session keys.

func (*Client) UpdateSecurity

func (c *Client) UpdateSecurity(ctx context.Context, namespace, name, space, app, image, security string) error

func (*Client) WaitForRollout

func (c *Client) WaitForRollout(ctx context.Context, namespace, name string, identity map[string]string) error

WaitForRollout polls the Deployment until the new generation is fully available, or fails with collected evidence.

func (*Client) WaitForRolloutWithin

func (c *Client) WaitForRolloutWithin(ctx context.Context, namespace, name string, identity map[string]string, timeout time.Duration) error

WaitForRolloutWithin is WaitForRollout with a deadline of the caller's. donkey-orchestrator needs one: with Recreate its new pod only starts once the old one has finished the deploys it was running.

func (*Client) WithInstallation

func (c *Client) WithInstallation(installation string, namespaces ...string) *Client

WithInstallation returns the client bound to one installation, sweeping only the given namespaces (none means the whole cluster). The installer and the server both call it once they know where the control plane lives.

func (*Client) WriteFile

func (c *Client) WriteFile(ctx context.Context, namespace, objectName, space, app, subPath string, r io.Reader) error

WriteFile stores r at subPath, replacing whatever was there. The upload lands in a temporary file next to the target and is moved into place only once it arrived complete — a broken connection never destroys the old file.

type GatewayAdapter

type GatewayAdapter struct {
	Client    *Client
	Namespace string
}

GatewayAdapter confines all edge access to this installation's runtime.

func (*GatewayAdapter) GatewayCA

func (g *GatewayAdapter) GatewayCA(ctx context.Context, create func() ([]byte, []byte, error)) ([]byte, []byte, error)

func (*GatewayAdapter) GatewayCertificateCache

func (g *GatewayAdapter) GatewayCertificateCache() autocert.Cache

func (*GatewayAdapter) GatewayCertificates

func (g *GatewayAdapter) GatewayCertificates(ctx context.Context) ([]rt.GatewayCertificate, error)

func (*GatewayAdapter) GatewaySnapshot

func (g *GatewayAdapter) GatewaySnapshot(ctx context.Context) (rt.GatewaySnapshot, error)

func (*GatewayAdapter) PrepareGateway

func (g *GatewayAdapter) PrepareGateway(ctx context.Context) error

type Options

type Options struct {
	// Placement decides where a space's objects live and what they are
	// called: a namespace per space, or one namespace for the installation.
	Placement manifests.Placement
	// SystemNamespace is where the control plane lives. It is also this
	// installation's identity — see manifests.LabelInstallation.
	SystemNamespace string
	// Domain serves apps as <app>.<space>.<domain>.
	Domain string
	// Registry feeds the per-app image pull secret.
	Registry config.Registry
	// AddonImages are direct repository overrides for managed services.
	AddonImages     config.InstallAddonImages
	CommonOfferings config.CommonOfferings
	// BusyboxImage is the file-browser helper's toolbox.
	BusyboxImage string
	// AddonImagePullSecrets are existing secrets referenced by managed service
	// and file-helper pods when Kubernetes pulls their images.
	AddonImagePullSecrets []string
	// TLS selects the certificate source. cert-manager mode creates one
	// exact-host Certificate per exposed app.
	TLS config.InstallTLS
	// ExternalDNS optionally creates exact-host DNSEndpoints at the gateway
	// LoadBalancer's configured target.
	ExternalDNS config.InstallExternalDNS
	// TelemetryKey derives an app-scoped OTLP credential. It is the
	// installation key already held by donkey-server, never exposed directly.
	TelemetryKey []byte
	// IsolateSpaces fences every space with an ingress NetworkPolicy — see
	// manifests.SpaceIsolationPolicy.
	IsolateSpaces bool
	// RestrictEgress adds the egress half of that fence — only meaningful
	// together with IsolateSpaces.
	RestrictEgress bool
}

Options is what the Kubernetes runtime needs to know about the installation — how spaces map to namespaces, where apps are served, and which certificate and DNS settings their public hostnames use.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime runs donkey's apps on a Kubernetes cluster. It deliberately does not embed Client: every Provider verb takes a space where the Client takes a namespace, and an inherited method with the wrong meaning would satisfy the interface silently.

func NewRuntime

func NewRuntime(client *Client, opts Options) *Runtime

func (*Runtime) AIProxyTokens

func (r *Runtime) AIProxyTokens(ctx context.Context) ([]string, error)

func (*Runtime) AppMeta

func (r *Runtime) AppMeta(ctx context.Context, space, app, key string) (string, error)

func (*Runtime) AppSummaries

func (r *Runtime) AppSummaries(ctx context.Context) ([]rt.AppSummary, error)

AppSummaries makes five lists per sweep namespace, regardless of app count. Only display values survive the read: no Secret data or management policies enter this cache. A lock coalesces concurrent portal refreshes, including the initial read, and serializes invalidation with an in-flight snapshot.

func (*Runtime) ApplyNetwork

func (r *Runtime) ApplyNetwork(ctx context.Context, cfg *config.AppConfig) (string, error)

ApplyNetwork changes how the app is reached — without a deploy. The route and optional Certificate/DNSEndpoint are re-rendered from cluster state; existing shared-address routes keep serving under their existing names.

func (*Runtime) AttachService

func (r *Runtime) AttachService(ctx context.Context, space, app, name string, binding map[string]string) (bool, error)

func (*Runtime) CheckSpaceFree

func (r *Runtime) CheckSpaceFree(ctx context.Context, space string) error

func (*Runtime) Checks

func (r *Runtime) Checks(ctx context.Context) []rt.Check

func (*Runtime) Client

func (r *Runtime) Client() *Client

Client exposes the underlying cluster client for Kubernetes-specific callers (the installer, the gateway) that need more than the Provider.

func (*Runtime) CreateSpace

func (r *Runtime) CreateSpace(ctx context.Context, space string) error

func (*Runtime) DeleteSpace

func (r *Runtime) DeleteSpace(ctx context.Context, space string) error

func (*Runtime) Deploy

func (r *Runtime) Deploy(ctx context.Context, spec rt.DeploySpec, out rt.Progress) error

Deploy applies the app's objects with the given image and waits for the rollout (unless spec.NoWait). Everything the Deployment needs — secrets, the disk, addon bindings — goes first, so the new version comes up with its configuration already in place.

func (*Runtime) Destroy

func (r *Runtime) Destroy(ctx context.Context, space, app string, keepData bool) error

func (*Runtime) DetachService

func (r *Runtime) DetachService(ctx context.Context, space, app, name string) error

func (*Runtime) EndpointStatus

func (r *Runtime) EndpointStatus(ctx context.Context, space, app, host string) rt.EndpointStatus

EndpointStatus checks the asynchronous pieces behind one live public hostname. Every failure stays local to its row in the console: an API or resolver hiccup must not turn the app's workload status into a 502.

func (*Runtime) EnsureService

func (r *Runtime) EnsureService(ctx context.Context, space string, spec rt.ServiceSpec) (map[string]string, map[string]any, error)

EnsureService creates (or re-applies) one service of the space — provisioned in-cluster, or external as a binding-only Secret — and returns its binding values.

func (*Runtime) EnsureSpaceConfigs

func (r *Runtime) EnsureSpaceConfigs(ctx context.Context) error

func (*Runtime) Evidence

func (r *Runtime) Evidence(ctx context.Context, space, app string) rt.Evidence

func (*Runtime) ExaProxyTokens

func (r *Runtime) ExaProxyTokens(ctx context.Context) ([]string, error)

func (*Runtime) FinishConfigMigration

func (r *Runtime) FinishConfigMigration(ctx context.Context) error

FinishConfigMigration runs after the new control plane is ready. A binding still referenced by a Pod is retained until its Deployment finishes rolling. Re-running an install or deploying that app retries cleanup safely.

func (*Runtime) GetEnv

func (r *Runtime) GetEnv(ctx context.Context, space, app string) (map[string]string, error)

func (*Runtime) HasData

func (r *Runtime) HasData(ctx context.Context, space, app string) bool

func (*Runtime) InitPlatformConfig

func (r *Runtime) InitPlatformConfig(ctx context.Context, initial config.PlatformConfig) (config.PlatformConfig, error)

Creation is atomic: simultaneous first sign-ins all use the one saved list. Subsequent saves deliberately use last-write-wins semantics.

func (*Runtime) InternalURL

func (r *Runtime) InternalURL(space, app string, port int) string

func (*Runtime) InvalidateAppSummaries

func (r *Runtime) InvalidateAppSummaries()

func (*Runtime) ListApps

func (r *Runtime) ListApps(ctx context.Context) ([]rt.AppRef, error)

func (*Runtime) ListFiles

func (r *Runtime) ListFiles(ctx context.Context, space, app, path string) ([]rt.FileEntry, error)

func (*Runtime) ListServices

func (r *Runtime) ListServices(ctx context.Context, space, owner string) ([]rt.ServiceBindingInfo, error)

func (*Runtime) ListSpaceConfigs

func (r *Runtime) ListSpaceConfigs(ctx context.Context) (map[string]config.SpaceConfig, error)

ListSpaceConfigs keeps fleet authorization fresh with one ConfigMap list and, for per-space placement, one namespace list. It shares no policy cache with the workload overview. Legacy or conflicting markers use the existing ownership-checked reader, so a bulk read cannot bypass migration or RBAC.

func (*Runtime) ListSpaces

func (r *Runtime) ListSpaces(ctx context.Context) ([]string, error)

func (*Runtime) Logs

func (r *Runtime) Logs(ctx context.Context, space, app string, opts rt.LogOptions, out io.Writer) error

func (*Runtime) MakeDir

func (r *Runtime) MakeDir(ctx context.Context, space, app, path string) error

func (*Runtime) MigrateSystemConfig

func (r *Runtime) MigrateSystemConfig(ctx context.Context) error

MigrateSystemConfig copies platform settings before the installer removes legacy resources. A new installation has no settings until first sign-in.

func (*Runtime) MoveFile

func (r *Runtime) MoveFile(ctx context.Context, space, app, from, to string) error

func (*Runtime) Network

func (r *Runtime) Network(ctx context.Context, space, app string) (*rt.NetworkState, error)

func (*Runtime) PlatformConfig

func (r *Runtime) PlatformConfig(ctx context.Context) (config.PlatformConfig, error)

func (*Runtime) ReadFile

func (r *Runtime) ReadFile(ctx context.Context, space, app, path string, out io.Writer) error

func (*Runtime) ReconcileAppRoutes

func (r *Runtime) ReconcileAppRoutes(ctx context.Context, space, app string, protect bool) error

ReconcileAppRoutes changes only access fields, preserving addresses and backends.

func (*Runtime) ReconcileAppTraffic

func (r *Runtime) ReconcileAppTraffic(ctx context.Context) error

ReconcileAppTraffic brings every deployed app's Certificate and optional DNSEndpoint in line with installation settings. The route ConfigMap records the exact hostname, so an install can change certificate source or DNS publication without reconstructing donkey.yaml.

The installer calls this after applying the control plane. Ordinary deploy, network and destroy operations reconcile the same objects for one app.

func (*Runtime) ReconcileSpaceIsolation

func (r *Runtime) ReconcileSpaceIsolation(ctx context.Context) error

ReconcileSpaceIsolation applies (or retracts) every existing space's fence. The installer calls it, so toggling kubernetes.isolateSpaces takes effect at install time rather than at each space's next deploy.

func (*Runtime) RemoveFile

func (r *Runtime) RemoveFile(ctx context.Context, space, app, path string) error

func (*Runtime) RemoveService

func (r *Runtime) RemoveService(ctx context.Context, space, name string, keepData, force bool) ([]string, error)

func (*Runtime) Render

func (r *Runtime) Render(spec rt.DeploySpec) (string, error)

Render renders the app's objects without touching the cluster.

func (*Runtime) ResourceSamples

func (r *Runtime) ResourceSamples(ctx context.Context) ([]rt.ResourceSample, error)

ResourceSamples joins pod usage from metrics.k8s.io with the web container identities from the core API. The resource metrics API deliberately provides only fresh snapshots; donkey's telemetry service turns those snapshots into retained history.

func (*Runtime) Restart

func (r *Runtime) Restart(ctx context.Context, space, app string) (bool, error)

func (*Runtime) ServiceAttachments

func (r *Runtime) ServiceAttachments(ctx context.Context, space, name string) ([]string, error)

func (*Runtime) ServiceBinding

func (r *Runtime) ServiceBinding(ctx context.Context, space, owner, name string) (map[string]string, error)

func (*Runtime) ServiceConnection

func (r *Runtime) ServiceConnection(ctx context.Context, space, name string) (rt.ServiceConnection, error)

func (*Runtime) ServiceEndpoint

func (r *Runtime) ServiceEndpoint(ctx context.Context, space, name string) (string, int32, error)

func (*Runtime) ServiceProxyAccess

func (r *Runtime) ServiceProxyAccess(ctx context.Context, sourceIP, offering string) (bool, error)

ServiceProxyAccess uses current pod and binding records, never forwarded headers or an IP-to-space cache that could outlive an IP's previous owner.

func (*Runtime) ServiceProxySpaceAccess

func (r *Runtime) ServiceProxySpaceAccess(ctx context.Context, space, offering string) (bool, error)

func (*Runtime) SetAppMeta

func (r *Runtime) SetAppMeta(ctx context.Context, space, app, key string, value *string) error

func (*Runtime) SetEnv

func (r *Runtime) SetEnv(ctx context.Context, space, app string, env map[string]string) error

func (*Runtime) SetPlatformConfig

func (r *Runtime) SetPlatformConfig(ctx context.Context, settings config.PlatformConfig) error

func (*Runtime) SetSpaceConfig

func (r *Runtime) SetSpaceConfig(ctx context.Context, space string, settings config.SpaceConfig) error

func (*Runtime) SpaceConfig

func (r *Runtime) SpaceConfig(ctx context.Context, space string) (config.SpaceConfig, error)

func (*Runtime) Status

func (r *Runtime) Status(ctx context.Context, space, app string) (*rt.AppStatus, error)

func (*Runtime) StorageFolders

func (r *Runtime) StorageFolders(ctx context.Context, space, app string) ([]rt.StorageFolder, error)

func (*Runtime) UpdateSecurity

func (r *Runtime) UpdateSecurity(ctx context.Context, space, app, image, security string) error

func (*Runtime) ValidateApp

func (r *Runtime) ValidateApp(space, app string) error

ValidateApp checks a space and app name together. Apart they are both valid; joined into one object name they may be too long, which is something only the pair can answer.

func (*Runtime) ValidateExistingNames

func (r *Runtime) ValidateExistingNames(ctx context.Context) error

ValidateExistingNames catches incompatible logical names before an upgrade mutates any resource. Spaces, apps and services are never silently renamed.

func (*Runtime) ValidateSpace

func (r *Runtime) ValidateSpace(space string) error

func (*Runtime) WriteFile

func (r *Runtime) WriteFile(ctx context.Context, space, app, path string, in io.Reader) error

Directories

Path Synopsis
Package manifests turns donkey configuration into Kubernetes objects.
Package manifests turns donkey configuration into Kubernetes objects.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL