controller

package
v0.6.76 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 120 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentRunFinalizer = "deployments.plural.sh/agentrun-protection"

	EnvConsoleURL  = "PLRL_CONSOLE_URL"
	EnvDeployToken = "PLRL_DEPLOY_TOKEN"
	EnvAgentRunID  = "PLRL_AGENT_RUN_ID"

	EnvOpenCodeProvider         = "PLRL_OPENCODE_PROVIDER"
	EnvOpenCodeEndpoint         = "PLRL_OPENCODE_ENDPOINT"
	EnvOpenCodeModel            = "PLRL_OPENCODE_MODEL"
	EnvOpenCodeMethod           = "PLRL_OPENCODE_METHOD"
	EnvOpenCodeToken            = "PLRL_OPENCODE_TOKEN"
	EnvOpenCodeOpenAICompatible = "PLRL_OPENCODE_OPENAI_COMPATIBLE"

	EnvClaudeModel              = "PLRL_CLAUDE_MODEL"
	EnvClaudeToken              = "PLRL_CLAUDE_TOKEN"
	EnvClaudeArgs               = "PLRL_CLAUDE_ARGS"
	EnvClaudeBashDefaultTimeout = "PLRL_CLAUDE_BASH_DEFAULT_TIMEOUT"
	EnvClaudeBashMaxTimeout     = "PLRL_CLAUDE_BASH_MAX_TIMEOUT"
	EnvClaudeEndpoint           = "PLRL_CLAUDE_ENDPOINT"

	EnvGeminiModel             = "PLRL_GEMINI_MODEL"
	EnvGeminiAPIKey            = "PLRL_GEMINI_API_KEY"
	EnvGeminiInactivityTimeout = "PLRL_GEMINI_INACTIVITY_TIMEOUT"
	EnvGeminiEndpoint          = "PLRL_GEMINI_ENDPOINT"

	EnvCodexModel    = "PLRL_CODEX_MODEL"
	EnvCodexAPIKey   = "PLRL_CODEX_API_KEY"
	EnvCodexEndpoint = "PLRL_CODEX_ENDPOINT"
	EnvCodexMethod   = "PLRL_CODEX_METHOD"

	EnvPiModel    = "PLRL_PI_MODEL"
	EnvPiAPIKey   = "PLRL_PI_API_KEY"
	EnvPiProvider = "PLRL_PI_PROVIDER"
	EnvPiEndpoint = "PLRL_PI_ENDPOINT"
	EnvPiMethod   = "PLRL_PI_METHOD"

	EnvDindEnabled    = "PLRL_DIND_ENABLED"
	EnvBrowserEnabled = "PLRL_BROWSER_ENABLED"
	EnvMemoryEnabled  = "PLRL_MEMORY_ENABLED"
	EnvMiseBootstrap  = "PLRL_MISE_BOOTSTRAP"
	EnvExecTimeout    = "PLRL_EXEC_TIMEOUT"

	EnvMiseGlobalConfigFile    = "MISE_GLOBAL_CONFIG_FILE"
	EnvMiseDataDir             = "MISE_DATA_DIR"
	EnvMiseErlangCompile       = "MISE_ERLANG_COMPILE"
	EnvMiseErlangPrecompiledOS = "MISE_ERLANG_PRECOMPILED_OS"

	EnvGitProxy = "PLRL_GIT_PROXY"

	EnvExaConnection   = "PLRL_EXA_CONNECTION"
	EnvMcpExcludeTools = "PLRL_EXCLUDE_TOOLS"
	EnvStreamingProxy  = "PLRL_STREAMING_PROXY"
	EnvMCPServers      = "PLRL_MCP_SERVERS"
	EnvWorkbenchMCPURL = "PLRL_WORKBENCH_MCP_URL"
)
View Source
const (
	DevboxProbeLabel           = probe.Label
	DevboxProbeLabelRequest    = probe.LabelRequest
	DevboxProbeRevisionLabel   = probe.RevisionLabel
	DevboxProbeStateAnnotation = probe.StateAnnotation
	DevboxProbeStateDone       = probe.StateDone
	DevboxProbeStateFailed     = probe.StateFailed
	DevboxProbeRequestKey      = probe.RequestKey
	DevboxProbeResultKey       = probe.ResultKey
	DevboxProbeErrorKey        = probe.ErrorKey
	DevboxProbeTokenSecretName = probe.TokenSecretName
)

Agent probe handoff between the operator and the devbox gateway; the contract is documented in pkg/devbox/probe. The operator writes the request ConfigMap and the probe token, minted with console's mintDevboxProbeToken. It fails the revision if any declared agent is MISSING, or the probe failed or timed out, so the previous revision keeps serving. An agent whose probe is FAILED is surfaced as an AgentProbe warning. The result of the serving revision is kept as the agent catalog upserted to console, and deleted with the revision.

View Source
const (
	AgentRuntimeFinalizer = "deployments.plural.sh/agent-runtime-protection"
)
View Source
const (
	DevboxRunnerFinalizer = "deployments.plural.sh/devbox-runner-protection"
)
View Source
const PluralCAPIClusterFinalizer = "deployments.plural.sh/plural-capi-cluster-protection"
View Source
const (
	SentinelRunJobFinalizer = "deployments.plural.sh/sentinel-run-job-protection"
)
View Source
const StackRunJobFinalizer = "deployments.plural.sh/stack-run-job-protection"
View Source
const (
	VirtualClusterFinalizer = "deployments.plural.sh/virtualcluster-protection"
)

Variables

View Source
var ErrDevboxSnapshotsRemain = errors.New("devbox snapshots remain")

Functions

func CreateConfigMap

func CreateConfigMap(ctx context.Context, client k8sClient.Client, restore *velerov1.Restore) error

func DevboxProbeConfigMapName added in v0.6.76

func DevboxProbeConfigMapName(runner string, revision int64) string

func ExtractResourceRequests

func ExtractResourceRequests(obj *unstructured.Unstructured) map[string]*ResourceRequests

ExtractResourceRequests fetches CPU and memory requests from an Unstructured Kubernetes workload object.

func GetObjectFromOwnerReference

func GetObjectFromOwnerReference(ctx context.Context, client k8sClient.Client, ref v1.OwnerReference, namespace string) (*unstructured.Unstructured, error)

func IsJobStatusConditionPresentAndEqual

func IsJobStatusConditionPresentAndEqual(conditions []batchv1.JobCondition, conditionType batchv1.JobConditionType, status corev1.ConditionStatus) bool

IsJobStatusConditionPresentAndEqual returns true when conditionType is present and equal to status.

func IsJobStatusConditionTrue

func IsJobStatusConditionTrue(conditions []batchv1.JobCondition, conditionType batchv1.JobConditionType) bool

IsJobStatusConditionTrue returns true when the conditionType is present and set to `metav1.ConditionTrue`

func Job

Job reconciles a k8s job object.

func LogOverriddenCRDValues

func LogOverriddenCRDValues(ctx context.Context, spec v1alpha1.AgentConfigurationSpec)

Types

type AgentConfigurationReconciler

type AgentConfigurationReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

func (*AgentConfigurationReconciler) Reconcile

func (r *AgentConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile AgentConfiguration custom resources to ensure that Console stays in sync with Kubernetes cluster.

func (*AgentConfigurationReconciler) SetupWithManager

func (r *AgentConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type AgentRunReconciler

type AgentRunReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	ConsoleClient    pluralclient.Client
	ConsoleURL       string
	DeployToken      string
	CacheSyncTimeout time.Duration
}

AgentRunReconciler is a controller for the AgentRun custom resource. It manages the lifecycle of individual agent runs by: 1. Creating pods to execute agent tasks 2. Monitoring pod status and updating AgentRun status 3. Reporting status back to Console API

func (*AgentRunReconciler) Reconcile

func (r *AgentRunReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, retErr error)

func (*AgentRunReconciler) SetupWithManager

func (r *AgentRunReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager configures the controller with the manager.

type AgentRuntimeReconciler

type AgentRuntimeReconciler struct {
	client.Client
	ConsoleClient     consoleclient.Client
	Scheme            *runtime.Scheme
	CacheSyncTimeout  time.Duration
	Ctx               context.Context
	ClusterID         string
	OperatorNamespace string
}

AgentRuntimeReconciler reconciles a AgentRuntime object

func (*AgentRuntimeReconciler) Publish

func (r *AgentRuntimeReconciler) Publish(runID string, kick bool)

func (*AgentRuntimeReconciler) Reconcile

func (r *AgentRuntimeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, retErr error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile

func (*AgentRuntimeReconciler) SetupWithManager

func (r *AgentRuntimeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ArgoRolloutReconciler

type ArgoRolloutReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient client.Client
	ConsoleURL    string
	HttpClient    *http.Client
	ArgoClientSet roclientset.Interface
	DynamicClient dynamic.Interface
	KubeClient    kubernetes.Interface
	SvcReconciler v1.Reconciler
}

ArgoRolloutReconciler reconciles a Argo Rollout custom resource.

func (*ArgoRolloutReconciler) Reconcile

func (r *ArgoRolloutReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile Argo Rollout custom resources to ensure that Console stays in sync with Kubernetes cluster.

func (*ArgoRolloutReconciler) SetupWithManager

func (r *ArgoRolloutReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type BackupReconciler

type BackupReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient client.Client
}

BackupReconciler reconciles a Velero Backup custom resource.

func (*BackupReconciler) Reconcile

func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile Velero Backup custom resources to ensure that Console stays in sync with Kubernetes cluster.

func (*BackupReconciler) SetupWithManager

func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type BundleData

type BundleData struct {
	Description       string `json:"description" yaml:"description"`
	Severity          string `json:"severity" yaml:"severity"`
	BundleName        string `json:"bundleName" yaml:"bundleName"`
	BundleDisplayName string `json:"bundleDisplayName" yaml:"bundleDisplayName"`
	Remediation       string `json:"remediation" yaml:"remediation"`
}

type CloudProvider

type CloudProvider interface {
	UpgradeInsights(context.Context, v1alpha1.UpgradeInsights) ([]console.UpgradeInsightAttributes, []console.CloudAddonAttributes, error)
}

func NewCloudProvider

func NewCloudProvider(distro *console.ClusterDistro, kubeClient runtimeclient.Client, clusterName string) (CloudProvider, error)

type ClusterDrainReconciler

type ClusterDrainReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ClusterDrainReconciler reconciles a ClusterDrain object

func (*ClusterDrainReconciler) Reconcile

func (r *ClusterDrainReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile executes the drain logic once per ClusterDrain object

func (*ClusterDrainReconciler) SetupWithManager

func (r *ClusterDrainReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the controller

type ClusterSubstrateClients added in v0.6.76

type ClusterSubstrateClients struct {
	Client client.Client
	// Reader lists ClusterTrustBundles uncached.
	Reader client.Reader
	// Namespace holds every ServiceAccount tokens are minted for.
	Namespace             string
	DefaultAddress        string
	DefaultServiceAccount string
	// contains filtered or unexported fields
}

ClusterSubstrateClients reaches Substrate with nothing mounted into the operator: it mints ServiceAccount tokens for Substrate's audience through the TokenRequest API and verifies ate-api-server against the live ClusterTrustBundles of its signer. Clients are cached per address, ServiceAccount and signer, and redialed when the CA bundle changes.

func (*ClusterSubstrateClients) For added in v0.6.76

type ConfigMapProbeClient added in v0.6.76

type ConfigMapProbeClient struct {
	Client client.Client
	// Reader reads probe ConfigMaps and the token Secret, normally the manager's uncached API reader.
	Reader    client.Reader
	Namespace string
	Timeout   time.Duration
	// Tokens mints probe tokens. Without it requests carry no token and the probe runs unauthenticated.
	Tokens DevboxProbeTokenMinter
	// Now is overridable in tests.
	Now func() time.Time
}

ConfigMapProbeClient implements the pkg/devbox/probe contract.

func (*ConfigMapProbeClient) Cleanup added in v0.6.76

func (c *ConfigMapProbeClient) Cleanup(ctx context.Context, runner string, revision int64) error

func (*ConfigMapProbeClient) ReleaseToken added in v0.6.76

func (c *ConfigMapProbeClient) ReleaseToken(ctx context.Context, runner string, revision int64) error

ReleaseToken drops a revision's probe token once its probe finished.

func (*ConfigMapProbeClient) Request added in v0.6.76

Request writes the probe token, then the request ConfigMap if it doesn't exist yet. While the request is pending it keeps the token valid, so a gateway that picks the request up late still gets a usable one.

func (*ConfigMapProbeClient) Result added in v0.6.76

func (c *ConfigMapProbeClient) Result(ctx context.Context, runner string, revision int64) (*DevboxProbeResult, error)

type ConfigurationFetcher added in v0.6.60

type ConfigurationFetcher interface {
	GetSecret(ctx context.Context, selector corev1.SecretKeySelector) (*corev1.Secret, error)
	GetConfigMap(ctx context.Context, selector corev1.ConfigMapKeySelector) (*corev1.ConfigMap, error)
}

ConfigurationFetcher loads Secrets and ConfigMaps referenced by AgentRuntime configuration.

type ConstraintReconciler

type ConstraintReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient consoleclient.Client
	Reader        k8sClient.Reader
	Constraints   map[string]console.PolicyConstraintAttributes
}

func (*ConstraintReconciler) ConstraintPodStatusToUnstructured

func (*ConstraintReconciler) Reconcile

func (*ConstraintReconciler) SetupWithManager

func (r *ConstraintReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type CrdRegisterControllerReconciler

type CrdRegisterControllerReconciler struct {
	k8sClient.Client
	Scheme           *runtime.Scheme
	ReconcilerGroups map[schema.GroupVersionKind]SetupWithManager
	Mgr              ctrl.Manager
	DiscoveryCache   discoverycache.Cache
	// contains filtered or unexported fields
}

CrdRegisterControllerReconciler reconciles a custom resource.

func (*CrdRegisterControllerReconciler) Reconcile

Reconcile Custom resources to ensure that Console stays in sync with Kubernetes cluster.

func (*CrdRegisterControllerReconciler) SetupWithManager

func (r *CrdRegisterControllerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type CustomHealthReconciler

type CustomHealthReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

CustomHealthReconciler reconciles a LuaScript object

func (*CustomHealthReconciler) Reconcile

func (r *CustomHealthReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile

func (*CustomHealthReconciler) SetupWithManager

func (r *CustomHealthReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type CustomInsightPriorityReconciler added in v0.6.72

type CustomInsightPriorityReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Registry *insightpriority.Registry
	Recorder events.EventRecorder
}

CustomInsightPriorityReconciler registers the scripts that decide the priority of failing objects in the cluster insights, and reports how they are doing. The scripts run when the cluster is pinged, not here.

func (*CustomInsightPriorityReconciler) Reconcile added in v0.6.72

func (r *CustomInsightPriorityReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile compiles the script and registers it when it is valid, then copies the result of its last evaluation to the status.

func (*CustomInsightPriorityReconciler) SetupWithManager added in v0.6.72

func (r *CustomInsightPriorityReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type DebounceReconciler

type DebounceReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

DebounceReconciler is a Reconciler that debounces reconcile requests.

func NewDebounceReconciler

func NewDebounceReconciler(client client.Client, duration time.Duration, actual reconcile.Reconciler) *DebounceReconciler

NewDebounceReconciler creates a new DebounceReconciler.

func (*DebounceReconciler) Reconcile

Reconcile implements the reconcile.Reconciler interface.

func (*DebounceReconciler) Start

func (r *DebounceReconciler) Start(ctx context.Context)

Start begins the debouncing mechanism.

type DefaultScope

type DefaultScope[T client.Object] struct {
	// contains filtered or unexported fields
}

func (*DefaultScope[T]) PatchObject

func (in *DefaultScope[T]) PatchObject() error

PatchObject ignores not found errors, since removing the last finalizer deletes the object before the remaining (eg. status) patches are issued.

type DevboxConfig added in v0.6.76

type DevboxConfig struct {
	// Enabled is DEVBOXES_ENABLED; the controller is only registered when it is true.
	Enabled bool
	// OperatorVersion is IMAGE_TAG, used for default images and the daemon compatibility check.
	OperatorVersion string
	// OperatorNamespace holds the gateway and, unless WorkerPoolNamespace is set, the WorkerPools.
	OperatorNamespace string
	// OperatorServiceAccount is the operator's own ServiceAccount, granted owner on each atespace.
	OperatorServiceAccount string

	// DefaultImage is DEVBOX_DEFAULT_IMAGE, the image for runners without spec.image. When unset, DevboxImage
	// falls back to devbox-fat at OperatorVersion on the agent's base registry.
	DefaultImage string
	// GatewayImage is DEVBOX_GATEWAY_IMAGE. When unset, GatewayImageRef falls back like DefaultImage.
	GatewayImage string
	// GatewayReplicas is DEVBOX_GATEWAY_REPLICAS.
	GatewayReplicas int32
	// GatewayServiceAccountAnnotations is DEVBOX_GATEWAY_SA_ANNOTATIONS (k=v,k=v), e.g. workload identity.
	GatewayServiceAccountAnnotations map[string]string

	// WorkerImages maps a sandbox class to its Substrate worker image (DEVBOX_WORKER_IMAGE_GVISOR, DEVBOX_WORKER_IMAGE_MICROVM).
	WorkerImages map[v1alpha1.DevboxSandboxClass]string
	// WorkerPoolNamespace is DEVBOX_WORKERPOOL_NAMESPACE, defaults to OperatorNamespace.
	WorkerPoolNamespace string

	// SubstrateNamespace is SUBSTRATE_NAMESPACE, where atenet-egress and atenet-router run.
	SubstrateNamespace string
	// SubstrateAddress is ATE_API_ADDRESS, ate-api-server's address for runners without spec.substrate.address.
	SubstrateAddress string
	// RouterAddress is DEVBOX_ROUTER_ADDRESS, atenet-router's gRPC address; defaults to atenet-router.<SubstrateNamespace>.svc:443.
	RouterAddress string
	// ActorJWTIssuer is DEVBOX_ACTOR_JWT_ISSUER, Substrate's actor JWT issuer; defaults to the agent-substrate chart's https://idp.<SubstrateNamespace>.svc.
	ActorJWTIssuer string

	// ConsoleURL and DeployToken are the operator's own; the gateway gets the same.
	ConsoleURL  string
	DeployToken string
	// KasURL is KAS's devbox listener, which the gateway tunnels through.
	KasURL    string
	ClusterID string

	DrainTimeout      time.Duration
	HeartbeatInterval time.Duration
}

DevboxConfig is the operator-wide devbox configuration. It comes from environment variables the deployment-operator chart sets when devboxes.enabled is true, so cmd/agent's flag set stays untouched.

func LoadDevboxConfig added in v0.6.76

func LoadDevboxConfig(operatorNamespace, consoleURL, deployToken, clusterID string) DevboxConfig

func (DevboxConfig) DevboxImage added in v0.6.76

func (c DevboxConfig) DevboxImage() string

DevboxImage is the image for runners without spec.image. The base registry is read on every call since the agent configuration can change it at runtime.

func (DevboxConfig) GatewayImageRef added in v0.6.76

func (c DevboxConfig) GatewayImageRef() string

func (DevboxConfig) GatewayPrincipal added in v0.6.76

func (c DevboxConfig) GatewayPrincipal() string

GatewayPrincipal is the gateway's Substrate API principal, as an access policy member ("user:<id>").

func (DevboxConfig) GatewaySpiffeID added in v0.6.76

func (c DevboxConfig) GatewaySpiffeID() string

GatewaySpiffeID is the identity the gateway presents to atenet-router; it must be in --ingress-allowed-spiffe-ids.

func (DevboxConfig) OperatorPrincipal added in v0.6.76

func (c DevboxConfig) OperatorPrincipal() string

type DevboxConsoleClient added in v0.6.76

type DevboxConsoleClient interface {
	UpsertDevbox(ctx context.Context, attrs console.DevboxAttributes) (*console.DevboxFragment, error)
	HeartbeatDevbox(ctx context.Context, id string, attrs console.DevboxHeartbeatAttributes) error
	// GetDevboxByName returns nil without error when this cluster has no Devbox with that name.
	GetDevboxByName(ctx context.Context, name string) (*console.DevboxFragment, error)
	// DeleteDevbox returns ErrDevboxSnapshotsRemain while workbench snapshots of the box exist.
	DeleteDevbox(ctx context.Context, id string) error
}

DevboxConsoleClient is the console API the DevboxRunner controller uses. It is kept narrow and local so the shared consoleclient.Client interface (and its mocks) need not change.

type DevboxGuestAgentSpec added in v0.6.76

type DevboxGuestAgentSpec struct {
	Type           v1alpha1.DevboxAgentType `json:"type"`
	Default        bool                     `json:"default"`
	AdapterVersion string                   `json:"adapterVersion,omitempty"`
	Models         []string                 `json:"models,omitempty"`
	DefaultModel   string                   `json:"defaultModel,omitempty"`
	ACPV2          bool                     `json:"acpV2"`
}

type DevboxImageContractResult added in v0.6.76

type DevboxImageContractResult struct {
	// Violations make the image unusable; the template revision is not built.
	Violations []string
	// Outdated is set when the daemon is more than one minor release behind the operator.
	Outdated      string
	DaemonVersion string
}

DevboxImageContractResult is the outcome of checking a resolved image against contract v1 (section 4.1a).

func CheckDevboxImageContract added in v0.6.76

func CheckDevboxImageContract(img *ResolvedDevboxImage, operatorVersion string) DevboxImageContractResult

CheckDevboxImageContract checks what can be checked from the image config without pulling layers: the contract label, the devbox-daemon entrypoint, UID 1000, the trust directory, and daemon/operator version compatibility. Agent presence and trust-store writability are verified in the guest by the golden-boot agent probe.

func (DevboxImageContractResult) OK added in v0.6.76

type DevboxImageResolver added in v0.6.76

type DevboxImageResolver interface {
	Resolve(ctx context.Context, image string, pullSecrets []corev1.SecretReference) (*ResolvedDevboxImage, error)
}

DevboxImageResolver resolves an image reference to a digest and reads its config.

type DevboxProbeClient added in v0.6.76

type DevboxProbeClient interface {
	// Request creates the probe request for a revision if it doesn't exist yet.
	Request(ctx context.Context, req DevboxProbeRequest) error
	// Result returns nil until the probe finished.
	Result(ctx context.Context, runner string, revision int64) (*DevboxProbeResult, error)
	// ReleaseToken drops the probe token of a finished revision, keeping its result.
	ReleaseToken(ctx context.Context, runner string, revision int64) error
	// Cleanup deletes the request, token and result of a revision.
	Cleanup(ctx context.Context, runner string, revision int64) error
}

DevboxProbeClient hands a golden tag to whoever runs the agent probe and collects the result.

type DevboxProbeEvaluation added in v0.6.76

type DevboxProbeEvaluation struct {
	Violations []string
	Warnings   []string
}

func EvaluateDevboxProbe added in v0.6.76

func EvaluateDevboxProbe(runner *v1alpha1.DevboxRunner, result *DevboxProbeResult) DevboxProbeEvaluation

EvaluateDevboxProbe checks the probe result against the declared agents.

func (DevboxProbeEvaluation) Message added in v0.6.76

func (e DevboxProbeEvaluation) Message() string

func (DevboxProbeEvaluation) OK added in v0.6.76

func (e DevboxProbeEvaluation) OK() bool

type DevboxProbeRequest added in v0.6.76

type DevboxProbeRequest struct {
	probe.Request `json:",inline"`
	// Agents are the declared agents; Probe carries the same as a ProbeAgentsRequest.
	Agents []DevboxGuestAgentSpec `json:"agents"`
}

type DevboxProbeResult added in v0.6.76

type DevboxProbeResult struct {
	Response *devboxv1.ProbeAgentsResponse
	// Error is set when the probe could not run at all.
	Error string
}

type DevboxProbeTokenMinter added in v0.6.76

type DevboxProbeTokenMinter interface {
	MintDevboxProbeToken(ctx context.Context, devboxID string) (probe.Token, error)
}

DevboxProbeTokenMinter mints the box-scoped AI proxy token the probe runs with (console's mintDevboxProbeToken).

type DevboxRunnerGuestConfig added in v0.6.76

type DevboxRunnerGuestConfig struct {
	Runner          string                 `json:"runner"`
	BootstrapScript string                 `json:"bootstrapScript,omitempty"`
	Mise            string                 `json:"mise,omitempty"`
	Browser         bool                   `json:"browser"`
	Agents          []DevboxGuestAgentSpec `json:"agents"`
}

DevboxRunnerGuestConfig is DEVBOX_RUNNER_CONFIG, the part of the runner spec the daemon applies inside the guest during the golden boot. Everything else (allowlist, identities, idle policy) is enforced by the gateway and console, so changing it does not roll a new template revision.

type DevboxRunnerReconciler added in v0.6.76

type DevboxRunnerReconciler struct {
	client.Client
	// APIReader reads ConfigMaps uncached, so the operator doesn't cache every ConfigMap in the cluster.
	APIReader        client.Reader
	Scheme           *runtime.Scheme
	Config           DevboxConfig
	Console          DevboxConsoleClient
	Substrate        SubstrateClients
	Images           DevboxImageResolver
	Probe            DevboxProbeClient
	CacheSyncTimeout time.Duration
	// WatchWorkerPools adds an Owns watch on WorkerPools; only possible when the Substrate CRDs are installed.
	WatchWorkerPools bool
	// contains filtered or unexported fields
}

DevboxRunnerReconciler reconciles a DevboxRunner: it resolves and checks the image, keeps the Substrate WorkerPool, atespace and ActorTemplate revisions in sync with the spec, hands golden tags to the gateway for the agent probe, upserts the Devbox (with the probed catalog) to console, and runs the per-cluster gateway.

func (*DevboxRunnerReconciler) Reconcile added in v0.6.76

func (r *DevboxRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, retErr error)

func (*DevboxRunnerReconciler) SetupWithManager added in v0.6.76

func (r *DevboxRunnerReconciler) SetupWithManager(mgr ctrl.Manager) error

type EKSCloudProvider

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

type GraphQLDevboxConsoleClient added in v0.6.76

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

GraphQLDevboxConsoleClient implements DevboxConsoleClient with the generated go/client operations, authenticated with the cluster deploy token.

func NewGraphQLDevboxConsoleClient added in v0.6.76

func NewGraphQLDevboxConsoleClient(consoleURL, deployToken string) *GraphQLDevboxConsoleClient

func (*GraphQLDevboxConsoleClient) DeleteDevbox added in v0.6.76

func (c *GraphQLDevboxConsoleClient) DeleteDevbox(ctx context.Context, id string) error

func (*GraphQLDevboxConsoleClient) GetDevboxByName added in v0.6.76

func (c *GraphQLDevboxConsoleClient) GetDevboxByName(ctx context.Context, name string) (*console.DevboxFragment, error)

func (*GraphQLDevboxConsoleClient) HeartbeatDevbox added in v0.6.76

func (*GraphQLDevboxConsoleClient) MintDevboxProbeToken added in v0.6.76

func (c *GraphQLDevboxConsoleClient) MintDevboxProbeToken(ctx context.Context, devboxID string) (probe.Token, error)

func (*GraphQLDevboxConsoleClient) UpsertDevbox added in v0.6.76

type HelmReleaseReconciler

type HelmReleaseReconciler struct {
	client.Client
	Scheme    *runtime.Scheme
	ClientSet kubernetes.Interface
}

func (*HelmReleaseReconciler) Reconcile

func (r *HelmReleaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile executes the drain logic once per HelmRelease object

func (*HelmReleaseReconciler) SetupWithManager

func (r *HelmReleaseReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the controller

type ImageWarmerReconciler added in v0.6.67

type ImageWarmerReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ImageWarmerReconciler reconciles an ImageWarmer object.

func (*ImageWarmerReconciler) Reconcile added in v0.6.67

func (r *ImageWarmerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, retErr error)

func (*ImageWarmerReconciler) SetupWithManager added in v0.6.67

func (r *ImageWarmerReconciler) SetupWithManager(mgr ctrl.Manager) error

type IngressReplicaReconciler

type IngressReplicaReconciler struct {
	k8sClient.Client
	Scheme *runtime.Scheme
}

IngressReplicaReconciler reconciles a IngressReplica resource.

func (*IngressReplicaReconciler) Reconcile

func (r *IngressReplicaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile IngressReplica ensure that stays in sync with Kubernetes cluster.

func (*IngressReplicaReconciler) SetupWithManager

func (r *IngressReplicaReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type K8sObjectIdentifier

type K8sObjectIdentifier struct {
	GVK       schema.GroupVersionKind // Group, Version, Kind
	Namespace string                  // Namespace (empty for cluster-scoped objects)
	Name      string                  // Name
}

func (K8sObjectIdentifier) String

func (gvk K8sObjectIdentifier) String() string

type KubecostExtractorReconciler

type KubecostExtractorReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	KubeClient       kubernetes.Interface
	ExtConsoleClient consoleclient.Client
	Tasks            cmap.ConcurrentMap[string, context.CancelFunc]
	ServiceIDCache   *ServiceIDCache
	Proxy            bool
}

KubecostExtractorReconciler reconciles a KubecostExtractor object

func (*KubecostExtractorReconciler) Reconcile

func (r *KubecostExtractorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile

func (*KubecostExtractorReconciler) RunOnInterval

func (r *KubecostExtractorReconciler) RunOnInterval(ctx context.Context, key string, interval time.Duration, condition wait.ConditionWithContextFunc)

func (*KubecostExtractorReconciler) SetupWithManager

func (r *KubecostExtractorReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MetricsAggregateReconciler

type MetricsAggregateReconciler struct {
	k8sClient.Client
	Scheme         *runtime.Scheme
	DiscoveryCache discoverycache.Cache
}

MetricsAggregateReconciler reconciles a MetricsAggregate resource.

func (*MetricsAggregateReconciler) Reconcile

func (r *MetricsAggregateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

Reconcile IngressReplica ensure that stays in sync with Kubernetes cluster.

func (*MetricsAggregateReconciler) SetupWithManager

func (r *MetricsAggregateReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PipelineGateReconciler

type PipelineGateReconciler struct {
	runtimeclient.Client
	ConsoleClient consoleclient.Client
	Scheme        *runtime.Scheme
	GateCache     *cache.Cache[console.PipelineGateFragment]
}

PipelineGateReconciler reconciles a PipelineGate object

func (*PipelineGateReconciler) Reconcile

func (r *PipelineGateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

func (*PipelineGateReconciler) SetupWithManager

func (r *PipelineGateReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PluralCAPIClusterController

type PluralCAPIClusterController struct {
	k8sClient.Client
	Scheme         *runtime.Scheme
	ConsoleUrl     string
	UserGroupCache cache.UserGroupCache
	// contains filtered or unexported fields
}

func (*PluralCAPIClusterController) Reconcile

func (in *PluralCAPIClusterController) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, reterr error)

func (*PluralCAPIClusterController) SetupWithManager

func (in *PluralCAPIClusterController) SetupWithManager(mgr ctrl.Manager) error

type RegistryImageResolver added in v0.6.76

type RegistryImageResolver struct {
	Client client.Client
	// SecretNamespace is used for pull secrets without a namespace.
	SecretNamespace string
	// Platform selects the config of multi-platform images, defaults to linux/amd64.
	Platform *v1.Platform
	// Options are extra remote options, e.g. a transport in tests.
	Options []remote.Option
	// contains filtered or unexported fields
}

RegistryImageResolver resolves through the registry with cloud workload-identity keychains (ECR, Artifact Registry/GCR, ACR) plus the runner's imagePullSecrets.

func (*RegistryImageResolver) Resolve added in v0.6.76

func (r *RegistryImageResolver) Resolve(ctx context.Context, image string, pullSecrets []corev1.SecretReference) (*ResolvedDevboxImage, error)

type ResolvedDevboxImage added in v0.6.76

type ResolvedDevboxImage struct {
	// Reference is <repository>@<digest>; the digest is the index digest for multi-platform images.
	Reference  string
	Digest     string
	Labels     map[string]string
	Entrypoint []string
	User       string
	Env        map[string]string
}

ResolvedDevboxImage is spec.image pinned by digest, plus the config fields the image contract checks.

type ResourceRequests

type ResourceRequests struct {
	CPU    float64
	Memory float64
}

type RestoreReconciler

type RestoreReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient client.Client
}

RestoreReconciler reconciles a Velero Restore custom resource.

func (*RestoreReconciler) Reconcile

func (r *RestoreReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile Velero Restore custom resources to ensure that Console stays in sync with Kubernetes cluster.

func (*RestoreReconciler) SetupWithManager

func (r *RestoreReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Scope

type Scope[T client.Object] interface {
	PatchObject() error
}

func NewDefaultScope

func NewDefaultScope[T client.Object](ctx context.Context, client client.Client, object T) (Scope[T], error)

type SentinelRunJobReconciler

type SentinelRunJobReconciler struct {
	client.Client
	ConsoleClient consoleclient.Client
	Scheme        *runtime.Scheme
	ConsoleURL    string
	DeployToken   string
}

func (*SentinelRunJobReconciler) GenerateRunJob

func (r *SentinelRunJobReconciler) GenerateRunJob(run *console.SentinelRunJobFragment, jobSpec *batchv1.JobSpec, name, namespace string) (*batchv1.Job, error)

func (*SentinelRunJobReconciler) GetRunResourceName

func (r *SentinelRunJobReconciler) GetRunResourceName(run *console.SentinelRunJobFragment) string

GetRunResourceName returns a resource name used for a job and a secret connected to a given run.

func (*SentinelRunJobReconciler) Reconcile

func (r *SentinelRunJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, retErr error)

func (*SentinelRunJobReconciler) SetupWithManager

func (r *SentinelRunJobReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager configures the controller with the manager.

type ServiceIDCache

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

func NewServiceIDCache

func NewServiceIDCache(clearAfter time.Duration) *ServiceIDCache

NewServiceIDCache self-cleaning cache

func (*ServiceIDCache) Get

func (*ServiceIDCache) Set

func (c *ServiceIDCache) Set(key K8sObjectIdentifier, value string)

type SetupWithManager

type SetupWithManager func(mgr ctrl.Manager) error

type StackRunJobReconciler

type StackRunJobReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient client.Client
	ConsoleURL    string
	DeployToken   string
}

StackRunJobReconciler reconciles a Job resource.

func (*StackRunJobReconciler) GenerateRunJob

func (r *StackRunJobReconciler) GenerateRunJob(run *console.StackRunMinimalFragment, jobSpec *batchv1.JobSpec, name, namespace string) (*batchv1.Job, error)

func (*StackRunJobReconciler) GetRunResourceName

func (r *StackRunJobReconciler) GetRunResourceName(run *console.StackRunMinimalFragment) string

GetRunResourceName returns a resource name used for a job and a secret connected to a given run.

func (*StackRunJobReconciler) Reconcile

func (r *StackRunJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ reconcile.Result, retErr error)

Reconcile StackRun's Job ensure that Console stays in sync with Kubernetes cluster.

func (*StackRunJobReconciler) SetupWithManager

func (r *StackRunJobReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type StatusViolation

type StatusViolation struct {
	Group     string `json:"group"`
	Version   string `json:"version"`
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace,omitempty"`
	Message   string `json:"message"`
}

type SubstrateClients added in v0.6.76

type SubstrateClients interface {
	For(ctx context.Context, runner *v1alpha1.DevboxRunner) (substrate.API, error)
}

SubstrateClients hands out the Substrate API client a runner is reconciled with.

type UpgradeInsightsController

type UpgradeInsightsController struct {
	k8sClient.Client

	Scheme        *runtime.Scheme
	ConsoleClient client.Client
	// contains filtered or unexported fields
}

UpgradeInsightsController reconciler a v1alpha1.UpgradeInsights resource. Implements reconcile.Reconciler interface.

func (*UpgradeInsightsController) Reconcile

func (in *UpgradeInsightsController) Reconcile(ctx context.Context, req reconcile.Request) (_ reconcile.Result, reterr error)

func (*UpgradeInsightsController) SetupWithManager

func (in *UpgradeInsightsController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type VirtualClusterController

type VirtualClusterController struct {
	k8sClient.Client

	Scheme           *runtime.Scheme
	ExtConsoleClient client.Client
	ConsoleUrl       string
	UserGroupCache   cache.UserGroupCache
	// contains filtered or unexported fields
}

VirtualClusterController reconciler a v1alpha1.VirtualCluster resource. Implements reconcile.Reconciler interface.

func (*VirtualClusterController) Reconcile

func (in *VirtualClusterController) Reconcile(ctx context.Context, req reconcile.Request) (_ reconcile.Result, reterr error)

func (*VirtualClusterController) SetupWithManager

func (in *VirtualClusterController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type VulnerabilityReportReconciler

type VulnerabilityReportReconciler struct {
	k8sClient.Client
	Scheme        *runtime.Scheme
	ConsoleClient client.Client
	Ctx           context.Context
	// contains filtered or unexported fields
}

VulnerabilityReportReconciler reconciles a Trivy VulnerabilityReport resource.

func (*VulnerabilityReportReconciler) Reconcile

func (*VulnerabilityReportReconciler) SetupWithManager

func (r *VulnerabilityReportReconciler) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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