{"modulePath":"github.com/coder/coder-k8s","version":"v0.1.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package controller\n\nPackage controller contains Kubernetes controllers for coder-k8s resources.\n\nPackage controller contains Kubernetes controllers for coder-k8s resources.\n\nPackage controller contains Kubernetes controllers for coder-k8s resources.\n\n## Types\n\n```go\ntype CleanupRecordReconciler struct {\n\tclient.Client\n\t// APIReader reads the object of a record live, so a stale cache never\n\t// makes a living object look gone.\n\tAPIReader         client.Reader\n\tOperatorNamespace string\n\tClock             clock.Clock\n\tRecorder          events.EventRecorder\n\t// contains filtered or unexported fields\n}\n```\nCleanupRecordReconciler sweeps the cleanup records of objects that went without a confirmed delete in Coder (#353). It acts only through a ready control plane whose current Coder deployment ID equals the record's, and it deletes only the recorded provider ID, the provider with the recorded nonce, or the AI Gateway keys whose names start with the recorded prefix.\n\n```go\nfunc (r *CleanupRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile sweeps one record.\n\n```go\nfunc (r *CleanupRecordReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager watches the records in the operator namespace. It wakes a record when its CoderAIProvider or CoderAIGatewayKey is deleted, and every record when a control plane gets operator access, since that control plane can match them.\n\n```go\ntype CoderAIGatewayKeyReconciler struct {\n\tclient.Client\n\t// APIReader reads the output Secret and the objects of the reserved-name\n\t// check live, not from the cache.\n\tAPIReader client.Reader\n\tScheme    *runtime.Scheme\n\tClock     clock.PassiveClock\n\t// OperatorNamespace holds the cleanup records (#353).\n\tOperatorNamespace string\n\t// contains filtered or unexported fields\n}\n```\nCoderAIGatewayKeyReconciler reconciles CoderAIGatewayKey objects (#156). It issues a Coder AI Gateway key into an owned Secret, rotates it, retires replaced keys, and deletes every key of the object when the object goes.\n\n```go\nfunc (r *CoderAIGatewayKeyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile handles deletion first, stores the finalizer before any Coder call, then runs the observe step and at most one action.\n\n```go\nfunc (r *CoderAIGatewayKeyReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime. A change of the output Secret, or of any control plane in the namespace (any of them can reserve the Secret name), requeues the object at once.\n\n```go\ntype CoderAIProviderReconciler struct {\n\tclient.Client\n\tScheme *runtime.Scheme\n\n\t// OperatorNamespace holds the cleanup records (#353): the operator's own\n\t// namespace, which only the operator can write ConfigMaps in.\n\tOperatorNamespace string\n\t// APIReader reads the cleanup records live: a record written moments ago\n\t// can be missing from the cache.\n\tAPIReader client.Reader\n\t// contains filtered or unexported fields\n}\n```\nCoderAIProviderReconciler reconciles CoderAIProvider objects (#154). It checks the spec, the credential Secret and the control plane, creates the Coder provider when the name is free, and sets the spec values on the provider that it created. It never changes a provider that it did not create.\n\n```go\nfunc (r *CoderAIProviderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile runs the checks in order and reports the first one that fails.\n\n```go\nfunc (r *CoderAIProviderReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime. A change of the referenced control plane or of the key Secret requeues the provider.\n\n```go\ntype CoderControlPlaneReconciler struct {\n\tclient.Client\n\tAPIReader client.Reader\n\tScheme    *runtime.Scheme\n\n\tOperatorAccessProvisioner coderbootstrap.OperatorAccessProvisioner\n\tLicenseUploader           LicenseUploader\n\tEntitlementsInspector     EntitlementsInspector\n\t// Clock is optional (nil: the real clock). Tests set it to move the\n\t// dependent hold of a deleted control plane.\n\tClock clock.PassiveClock\n}\n```\nCoderControlPlaneReconciler reconciles a CoderControlPlane object.\n\n```go\nfunc (r *CoderControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile converges the desired CoderControlPlane spec into Deployment and Service resources.\n\n```go\nfunc (r *CoderControlPlaneReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime.\n\n```go\ntype CoderMCPServerReconciler struct {\n\tclient.Client\n\tScheme *runtime.Scheme\n\t// contains filtered or unexported fields\n}\n```\nCoderMCPServerReconciler reconciles CoderMCPServer objects (#155). It checks the control plane, the organization and its opt-in, and the credential Secrets, reports a slug that a config of someone else holds, creates the config, and syncs it on every reconcile.\n\n```go\nfunc (r *CoderMCPServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile runs the checks in order and reports the first one that fails.\n\n```go\nfunc (r *CoderMCPServerReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime. The controller watches its own kind without a generation predicate, so an annotation change also triggers a reconcile. A change of the referenced control plane or of a credential Secret requeues the object.\n\n```go\ntype CoderProvisionerReconciler struct {\n\tclient.Client\n\tScheme          *runtime.Scheme\n\tBootstrapClient coderbootstrap.Client\n}\n```\nCoderProvisionerReconciler reconciles a CoderProvisioner object.\n\n```go\nfunc (r *CoderProvisionerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error)\n```\nReconcile converges the desired CoderProvisioner spec into Deployment, RBAC, and Secret resources.\n\n```go\nfunc (r *CoderProvisionerReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime.\n\n```go\ntype CoderTemplateTestReconciler struct {\n\tclient.Client\n\tScheme *runtime.Scheme\n\tClock  clock.PassiveClock\n\t// contains filtered or unexported fields\n}\n```\nCoderTemplateTestReconciler runs CoderTemplateTest objects (#152): it creates a throwaway workspace from a template version, waits until every agent is ready, records the result, and deletes the workspace.\n\n```go\nfunc (r *CoderTemplateTestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile runs the first step of the test that applies, then returns.\n\n```go\nfunc (r *CoderTemplateTestReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime. Nothing calls it until activation (#152). A change of a control plane requeues the tests that use it, so cleanup that waits for Coder resumes at once.\n\n```go\ntype CoderWorkspacePoolMemberReconciler struct {\n\tclient.Client\n\t// APIReader reads the pool and the control plane's consent without the\n\t// cache right before the create request.\n\tAPIReader client.Reader\n\tScheme    *runtime.Scheme\n\tClock     clock.PassiveClock\n\t// contains filtered or unexported fields\n}\n```\nCoderWorkspacePoolMemberReconciler makes the Coder workspace of one CoderWorkspacePoolMember (#153 plan 6.2). Nothing registers it yet. This version runs the steps up to the create request: readiness, the watch rules, and cleanup follow before activation.\n\n```go\nfunc (r *CoderWorkspacePoolMemberReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile runs the first step of the member that applies, then returns.\n\n```go\ntype CoderWorkspacePoolReconciler struct {\n\tclient.Client\n\t// APIReader reads members without the cache, so a stale cache never\n\t// makes the pool count too few members.\n\tAPIReader client.Reader\n\tScheme    *runtime.Scheme\n\tClock     clock.PassiveClock\n}\n```\nCoderWorkspacePoolReconciler resolves the inputs of one CoderWorkspacePool, creates its members, and reports them (#153 plan 6.3). Nothing registers it yet.\n\n```go\nfunc (r *CoderWorkspacePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile resolves the pool's inputs, counts its members, and writes the pool status.\n\n```go\ntype CoderWorkspaceProxyReconciler struct {\n\tclient.Client\n\tScheme          *runtime.Scheme\n\tBootstrapClient coderbootstrap.Client\n}\n```\nCoderWorkspaceProxyReconciler reconciles a CoderWorkspaceProxy object.\n\n```go\nfunc (r *CoderWorkspaceProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)\n```\nReconcile converges the desired CoderWorkspaceProxy spec into Deployment and Service resources.\n\n```go\nfunc (r *CoderWorkspaceProxyReconciler) SetupWithManager(mgr ctrl.Manager) error\n```\nSetupWithManager wires the reconciler into controller-runtime.\n\n```go\ntype EntitlementsInspector interface {\n\tEntitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)\n}\n```\nEntitlementsInspector inspects coderd entitlements.\n\n```go\nfunc NewSDKEntitlementsInspector() EntitlementsInspector\n```\nNewSDKEntitlementsInspector returns an EntitlementsInspector backed by codersdk.\n\n```go\ntype LicenseUploader interface {\n\tAddLicense(ctx context.Context, coderURL, sessionToken, licenseJWT string) error\n\tHasAnyLicense(ctx context.Context, coderURL, sessionToken string) (bool, error)\n}\n```\nLicenseUploader uploads and inspects Coder Enterprise licenses in a coderd instance.\n\n```go\nfunc NewSDKLicenseUploader() LicenseUploader\n```\nNewSDKLicenseUploader returns a LicenseUploader backed by codersdk.\n\n","path":"github.com/coder/coder-k8s/internal/controller","name":"controller","synopsis":"Package controller contains Kubernetes controllers for coder-k8s resources.","isRedistributable":true}
