diff --git a/.cspell.json b/.cspell.json index 0bb6cde2..98da0e2b 100644 --- a/.cspell.json +++ b/.cspell.json @@ -31,6 +31,7 @@ "javascripts", "kubeconfig", "kubebuilder", + "corev", "metav", "mkdocs", "pymdownx", diff --git a/docs/reference/api/codercontrolplane.md b/docs/reference/api/codercontrolplane.md index db612314..785bed27 100644 --- a/docs/reference/api/codercontrolplane.md +++ b/docs/reference/api/codercontrolplane.md @@ -13,25 +13,33 @@ | Field | Type | Description | | --- | --- | --- | -| `spec.image` | `string` | Image is the container image used for the Coder control plane pod. | -| `spec.replicas` | `int32` | Replicas is the desired number of control plane pods. | -| `spec.service` | `github.com/coder/coder-k8s/api/v1alpha1.ServiceSpec` | Service controls the service created in front of the control plane. | -| `spec.extraArgs` | `[]string` | ExtraArgs are appended to the default Coder server arguments. | -| `spec.extraEnv` | `[]k8s.io/api/core/v1.EnvVar` | ExtraEnv are injected into the Coder control plane container. | -| `spec.imagePullSecrets` | `[]k8s.io/api/core/v1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | -| `spec.operatorAccess` | `github.com/coder/coder-k8s/api/v1alpha1.OperatorAccessSpec` | OperatorAccess configures bootstrap API access to the coderd instance. | +| `image` | `string` | Image is the container image used for the Coder control plane pod. | +| `replicas` | `int32` | Replicas is the desired number of control plane pods. | +| `service` | `ServiceSpec` | Service controls the service created in front of the control plane. | +|   `type` | `corev1.ServiceType` | Type controls the Kubernetes service type. | +|   `port` | `int32` | Port controls the exposed service port. | +|   `annotations` | `map[string]string` | Annotations are applied to the reconciled service object. | +| `extraArgs` | `[]string` | ExtraArgs are appended to the default Coder server arguments. | +| `extraEnv` | `[]corev1.EnvVar` | ExtraEnv are injected into the Coder control plane container. | +| `imagePullSecrets` | `[]corev1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | +|   `name` | `string` | Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: [https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) | +| `operatorAccess` | `OperatorAccessSpec` | OperatorAccess configures bootstrap API access to the coderd instance. | +|   `disabled` | `bool` | Disabled turns off creation and management of the `coder-k8s-operator` user and API token. | +|   `generatedTokenSecretName` | `string` | GeneratedTokenSecretName stores the generated operator API token. | ## Status | Field | Type | Description | | --- | --- | --- | -| `status.observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | -| `status.readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | -| `status.url` | `string` | URL is the in-cluster URL for the control plane service. | -| `status.operatorTokenSecretRef` | `github.com/coder/coder-k8s/api/v1alpha1.SecretKeySelector` | OperatorTokenSecretRef points to the Secret key containing the `coder-k8s-operator` API token. | -| `status.operatorAccessReady` | `bool` | OperatorAccessReady reports whether operator API access bootstrap succeeded. | -| `status.phase` | `string` | Phase is a high-level readiness indicator. | -| `status.conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | +| `observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | +| `readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | +| `url` | `string` | URL is the in-cluster URL for the control plane service. | +| `operatorTokenSecretRef` | `SecretKeySelector` | OperatorTokenSecretRef points to the Secret key containing the `coder-k8s-operator` API token. | +|   `name` | `string` | Name is the Kubernetes Secret name. | +|   `key` | `string` | Key is the key inside the Secret data map. | +| `operatorAccessReady` | `bool` | OperatorAccessReady reports whether operator API access bootstrap succeeded. | +| `phase` | `string` | Phase is a high-level readiness indicator. | +| `conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | ## Source diff --git a/docs/reference/api/coderprovisioner.md b/docs/reference/api/coderprovisioner.md index a84b7ba9..9574aeff 100644 --- a/docs/reference/api/coderprovisioner.md +++ b/docs/reference/api/coderprovisioner.md @@ -13,35 +13,45 @@ | Field | Type | Description | | --- | --- | --- | -| `spec.controlPlaneRef` | `k8s.io/api/core/v1.LocalObjectReference` | ControlPlaneRef identifies which CoderControlPlane instance to join. | -| `spec.organizationName` | `string` | OrganizationName is the Coder organization. Defaults to "default". | -| `spec.bootstrap` | `github.com/coder/coder-k8s/api/v1alpha1.CoderProvisionerBootstrapSpec` | Bootstrap configures credentials for provisioner key management. | -| `spec.key` | `github.com/coder/coder-k8s/api/v1alpha1.CoderProvisionerKeySpec` | Key configures provisioner key naming and secret storage. | -| `spec.replicas` | `int32` | Replicas is the desired number of provisioner pods. | -| `spec.tags` | `map[string]string` | Tags are attached to the provisioner key for job routing. | -| `spec.image` | `string` | Image is the container image. Defaults to the control plane image. | -| `spec.extraArgs` | `[]string` | ExtraArgs are appended after "provisionerd start". | -| `spec.extraEnv` | `[]k8s.io/api/core/v1.EnvVar` | ExtraEnv are injected into the provisioner container. | -| `spec.resources` | `k8s.io/api/core/v1.ResourceRequirements` | Resources for the provisioner container. | -| `spec.imagePullSecrets` | `[]k8s.io/api/core/v1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | -| `spec.terminationGracePeriodSeconds` | `int64` | TerminationGracePeriodSeconds for the provisioner pods. | +| `controlPlaneRef` | `corev1.LocalObjectReference` | ControlPlaneRef identifies which CoderControlPlane instance to join. | +|   `name` | `string` | Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: [https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) | +| `organizationName` | `string` | OrganizationName is the Coder organization. Defaults to "default". | +| `bootstrap` | `CoderProvisionerBootstrapSpec` | Bootstrap configures credentials for provisioner key management. | +|   `credentialsSecretRef` | `SecretKeySelector` | CredentialsSecretRef points to a Secret containing a Coder session token with permission to manage provisioner keys. | +|     `name` | `string` | Name is the Kubernetes Secret name. | +|     `key` | `string` | Key is the key inside the Secret data map. | +| `key` | `CoderProvisionerKeySpec` | Key configures provisioner key naming and secret storage. | +|   `name` | `string` | Name is the provisioner key name in coderd. Defaults to the CR name. | +|   `secretName` | `string` | SecretName is the Kubernetes Secret to store the key. Defaults to "\{crName\}-provisioner-key". | +|   `secretKey` | `string` | SecretKey is the data key in the Secret. Defaults to "key". | +| `replicas` | `int32` | Replicas is the desired number of provisioner pods. | +| `tags` | `map[string]string` | Tags are attached to the provisioner key for job routing. | +| `image` | `string` | Image is the container image. Defaults to the control plane image. | +| `extraArgs` | `[]string` | ExtraArgs are appended after "provisionerd start". | +| `extraEnv` | `[]corev1.EnvVar` | ExtraEnv are injected into the provisioner container. | +| `resources` | `corev1.ResourceRequirements` | Resources for the provisioner container. | +| `imagePullSecrets` | `[]corev1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | +|   `name` | `string` | Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: [https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) | +| `terminationGracePeriodSeconds` | `int64` | TerminationGracePeriodSeconds for the provisioner pods. | ## Status | Field | Type | Description | | --- | --- | --- | -| `status.observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | -| `status.readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | -| `status.phase` | `string` | Phase is a high-level readiness indicator. | -| `status.conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | -| `status.organizationID` | `string` | OrganizationID is the organization ID last applied to the provisioner key. | -| `status.organizationName` | `string` | OrganizationName is the organization name last applied to the provisioner key. | -| `status.provisionerKeyID` | `string` | ProvisionerKeyID is the provisioner key ID last applied in coderd. | -| `status.provisionerKeyName` | `string` | ProvisionerKeyName is the provisioner key name last applied in coderd. | -| `status.tagsHash` | `string` | TagsHash is a deterministic hash of spec.tags last applied to the provisioner key. | -| `status.controlPlaneRefName` | `string` | ControlPlaneRefName is the control plane ref name last applied to the provisioner key. | -| `status.controlPlaneURL` | `string` | ControlPlaneURL is the control plane URL last applied to the provisioner key. | -| `status.secretRef` | `github.com/coder/coder-k8s/api/v1alpha1.SecretKeySelector` | SecretRef references the provisioner key secret data currently in use. | +| `observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | +| `readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | +| `phase` | `string` | Phase is a high-level readiness indicator. | +| `conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | +| `organizationID` | `string` | OrganizationID is the organization ID last applied to the provisioner key. | +| `organizationName` | `string` | OrganizationName is the organization name last applied to the provisioner key. | +| `provisionerKeyID` | `string` | ProvisionerKeyID is the provisioner key ID last applied in coderd. | +| `provisionerKeyName` | `string` | ProvisionerKeyName is the provisioner key name last applied in coderd. | +| `tagsHash` | `string` | TagsHash is a deterministic hash of spec.tags last applied to the provisioner key. | +| `controlPlaneRefName` | `string` | ControlPlaneRefName is the control plane ref name last applied to the provisioner key. | +| `controlPlaneURL` | `string` | ControlPlaneURL is the control plane URL last applied to the provisioner key. | +| `secretRef` | `SecretKeySelector` | SecretRef references the provisioner key secret data currently in use. | +|   `name` | `string` | Name is the Kubernetes Secret name. | +|   `key` | `string` | Key is the key inside the Secret data map. | ## Source diff --git a/docs/reference/api/codertemplate.md b/docs/reference/api/codertemplate.md index a4b3f200..1760ca02 100644 --- a/docs/reference/api/codertemplate.md +++ b/docs/reference/api/codertemplate.md @@ -13,23 +13,23 @@ | Field | Type | Description | | --- | --- | --- | -| `spec.organization` | `string` | Organization is the Coder organization name (must match the organization prefix in metadata.name). | -| `spec.versionID` | `string` | VersionID is the Coder template version UUID used on creation (required for CREATE). | -| `spec.displayName` | `string` | | -| `spec.description` | `string` | | -| `spec.icon` | `string` | | -| `spec.running` | `bool` | Running is a legacy flag retained temporarily for in-repo callers that still read template run-state directly. | +| `organization` | `string` | Organization is the Coder organization name (must match the organization prefix in metadata.name). | +| `versionID` | `string` | VersionID is the Coder template version UUID used on creation (required for CREATE). | +| `displayName` | `string` | | +| `description` | `string` | | +| `icon` | `string` | | +| `running` | `bool` | Running is a legacy flag retained temporarily for in-repo callers that still read template run-state directly. | ## Status | Field | Type | Description | | --- | --- | --- | -| `status.id` | `string` | | -| `status.organizationName` | `string` | | -| `status.activeVersionID` | `string` | | -| `status.deprecated` | `bool` | | -| `status.updatedAt` | `metav1.Time` | | -| `status.autoShutdown` | `metav1.Time` | AutoShutdown is a legacy timestamp retained temporarily for in-repo callers that still surface template shutdown timestamps. | +| `id` | `string` | | +| `organizationName` | `string` | | +| `activeVersionID` | `string` | | +| `deprecated` | `bool` | | +| `updatedAt` | `metav1.Time` | | +| `autoShutdown` | `metav1.Time` | AutoShutdown is a legacy timestamp retained temporarily for in-repo callers that still surface template shutdown timestamps. | ## Source diff --git a/docs/reference/api/coderworkspace.md b/docs/reference/api/coderworkspace.md index 6e7a10db..3ffff79a 100644 --- a/docs/reference/api/coderworkspace.md +++ b/docs/reference/api/coderworkspace.md @@ -13,25 +13,25 @@ | Field | Type | Description | | --- | --- | --- | -| `spec.organization` | `string` | Organization is the Coder organization name. | -| `spec.templateName` | `string` | TemplateName resolves via TemplateByName(organization, templateName). | -| `spec.templateVersionID` | `string` | TemplateVersionID optionally pins to a specific template version. | -| `spec.running` | `bool` | Running drives start/stop via CreateWorkspaceBuild. | -| `spec.ttlMillis` | `int64` | | -| `spec.autostartSchedule` | `string` | | +| `organization` | `string` | Organization is the Coder organization name. | +| `templateName` | `string` | TemplateName resolves via TemplateByName(organization, templateName). | +| `templateVersionID` | `string` | TemplateVersionID optionally pins to a specific template version. | +| `running` | `bool` | Running drives start/stop via CreateWorkspaceBuild. | +| `ttlMillis` | `int64` | | +| `autostartSchedule` | `string` | | ## Status | Field | Type | Description | | --- | --- | --- | -| `status.id` | `string` | | -| `status.ownerName` | `string` | | -| `status.organizationName` | `string` | | -| `status.templateName` | `string` | | -| `status.latestBuildID` | `string` | | -| `status.latestBuildStatus` | `string` | | -| `status.autoShutdown` | `metav1.Time` | | -| `status.lastUsedAt` | `metav1.Time` | | +| `id` | `string` | | +| `ownerName` | `string` | | +| `organizationName` | `string` | | +| `templateName` | `string` | | +| `latestBuildID` | `string` | | +| `latestBuildStatus` | `string` | | +| `autoShutdown` | `metav1.Time` | | +| `lastUsedAt` | `metav1.Time` | | ## Source diff --git a/docs/reference/api/workspaceproxy.md b/docs/reference/api/workspaceproxy.md index 866a9744..e56fe52b 100644 --- a/docs/reference/api/workspaceproxy.md +++ b/docs/reference/api/workspaceproxy.md @@ -13,27 +13,43 @@ | Field | Type | Description | | --- | --- | --- | -| `spec.image` | `string` | Image is the container image used for the workspace proxy pod. | -| `spec.replicas` | `int32` | Replicas is the desired number of proxy pods. | -| `spec.service` | `github.com/coder/coder-k8s/api/v1alpha1.ServiceSpec` | Service controls the service created in front of the workspace proxy. | -| `spec.primaryAccessURL` | `string` | PrimaryAccessURL is the coderd URL the proxy should connect to. | -| `spec.proxySessionTokenSecretRef` | `github.com/coder/coder-k8s/api/v1alpha1.SecretKeySelector` | ProxySessionTokenSecretRef points to a Secret key containing the proxy token. | -| `spec.bootstrap` | `github.com/coder/coder-k8s/api/v1alpha1.ProxyBootstrapSpec` | Bootstrap optionally registers the proxy and mints a proxy token. | -| `spec.derpOnly` | `bool` | DerpOnly configures the workspace proxy to only serve DERP traffic. | -| `spec.extraArgs` | `[]string` | ExtraArgs are appended to the default workspace proxy arguments. | -| `spec.extraEnv` | `[]k8s.io/api/core/v1.EnvVar` | ExtraEnv are injected into the workspace proxy container. | -| `spec.imagePullSecrets` | `[]k8s.io/api/core/v1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | +| `image` | `string` | Image is the container image used for the workspace proxy pod. | +| `replicas` | `int32` | Replicas is the desired number of proxy pods. | +| `service` | `ServiceSpec` | Service controls the service created in front of the workspace proxy. | +|   `type` | `corev1.ServiceType` | Type controls the Kubernetes service type. | +|   `port` | `int32` | Port controls the exposed service port. | +|   `annotations` | `map[string]string` | Annotations are applied to the reconciled service object. | +| `primaryAccessURL` | `string` | PrimaryAccessURL is the coderd URL the proxy should connect to. | +| `proxySessionTokenSecretRef` | `SecretKeySelector` | ProxySessionTokenSecretRef points to a Secret key containing the proxy token. | +|   `name` | `string` | Name is the Kubernetes Secret name. | +|   `key` | `string` | Key is the key inside the Secret data map. | +| `bootstrap` | `ProxyBootstrapSpec` | Bootstrap optionally registers the proxy and mints a proxy token. | +|   `coderURL` | `string` | CoderURL is the URL for the primary Coder control plane API. | +|   `credentialsSecretRef` | `SecretKeySelector` | CredentialsSecretRef points to a Secret containing a Coder session token. | +|     `name` | `string` | Name is the Kubernetes Secret name. | +|     `key` | `string` | Key is the key inside the Secret data map. | +|   `proxyName` | `string` | ProxyName is the name used when registering the proxy in Coder. | +|   `displayName` | `string` | DisplayName is the human-readable name for the proxy region. | +|   `icon` | `string` | Icon is the optional icon URL or emoji path for the proxy region. | +|   `generatedTokenSecretName` | `string` | GeneratedTokenSecretName stores the generated proxy token. | +| `derpOnly` | `bool` | DerpOnly configures the workspace proxy to only serve DERP traffic. | +| `extraArgs` | `[]string` | ExtraArgs are appended to the default workspace proxy arguments. | +| `extraEnv` | `[]corev1.EnvVar` | ExtraEnv are injected into the workspace proxy container. | +| `imagePullSecrets` | `[]corev1.LocalObjectReference` | ImagePullSecrets are used by the pod to pull private images. | +|   `name` | `string` | Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: [https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) | ## Status | Field | Type | Description | | --- | --- | --- | -| `status.observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | -| `status.readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | -| `status.registered` | `bool` | Registered reports whether bootstrap registration completed successfully. | -| `status.proxyTokenSecretRef` | `github.com/coder/coder-k8s/api/v1alpha1.SecretKeySelector` | ProxyTokenSecretRef is the Secret used for the proxy session token. | -| `status.phase` | `string` | Phase is a high-level readiness indicator. | -| `status.conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | +| `observedGeneration` | `int64` | ObservedGeneration tracks the spec generation this status reflects. | +| `readyReplicas` | `int32` | ReadyReplicas is the number of ready pods observed in the deployment. | +| `registered` | `bool` | Registered reports whether bootstrap registration completed successfully. | +| `proxyTokenSecretRef` | `SecretKeySelector` | ProxyTokenSecretRef is the Secret used for the proxy session token. | +|   `name` | `string` | Name is the Kubernetes Secret name. | +|   `key` | `string` | Key is the key inside the Secret data map. | +| `phase` | `string` | Phase is a high-level readiness indicator. | +| `conditions` | `[]metav1.Condition` | Conditions are Kubernetes-standard conditions for this resource. | ## Source diff --git a/hack/crd-ref-docs/templates/markdown/gv_list.tpl b/hack/crd-ref-docs/templates/markdown/gv_list.tpl index 1b5031c9..97493d19 100644 --- a/hack/crd-ref-docs/templates/markdown/gv_list.tpl +++ b/hack/crd-ref-docs/templates/markdown/gv_list.tpl @@ -6,10 +6,35 @@ {{- $typeString := $fieldType.String -}} {{- $typeString = trimPrefix "*" $typeString -}} {{- $typeString = $typeString | replace "k8s.io/apimachinery/pkg/apis/meta/v1." "metav1." -}} +{{- $typeString = $typeString | replace "k8s.io/api/core/v1." "corev1." -}} +{{- $typeString = $typeString | replace "github.com/coder/coder-k8s/api/v1alpha1." "" -}} +{{- $typeString = $typeString | replace "github.com/coder/coder-k8s/api/aggregation/v1alpha1." "" -}} {{- $typeString -}} {{- end -}} {{- end -}} +{{- define "renderFields" -}} +{{- $fields := .fields -}} +{{- $depth := int .depth -}} +{{- $maxDepth := int .maxDepth -}} +{{- $indent := repeat $depth "  " -}} +{{- range $field := $fields }} +{{- if not $field.Type }}{{ fail (printf "field %q is missing type information" $field.Name) }}{{- end }} +{{- $memberType := $field.Type -}} +{{- $members := $memberType.Members -}} +{{- $hasMembers := gt (len $members) 0 -}} +{{- $memberTypeString := $memberType.String -}} +{{- $isProjectLocal := contains "github.com/coder/coder-k8s/api/" $memberTypeString -}} +{{- $isLocalObjectRef := contains "k8s.io/api/core/v1.LocalObjectReference" $memberTypeString -}} +{{- $shouldExpand := and $hasMembers (lt $depth $maxDepth) (or $isProjectLocal $isLocalObjectRef) -}} +{{- $fieldDoc := markdownRenderFieldDoc $field.Doc -}} +{{- $fieldDoc = $fieldDoc | replace "
" " " -}} +{{- $fieldDoc = regexReplaceAll "(https?://[^[:space:]<]+)" $fieldDoc "[$1]($1)" -}} +| {{ $indent }}`{{ $field.Name }}` | `{{ template "typeName" $memberType }}` | {{ $fieldDoc }} | +{{ if $shouldExpand }}{{ template "renderFields" (dict "fields" $members "depth" (add $depth 1) "maxDepth" $maxDepth) }}{{ end }} +{{- end -}} +{{- end -}} + {{- define "gvList" -}} {{- $groupVersions := . -}} {{- if ne (len $groupVersions) 1 -}} @@ -61,6 +86,7 @@ {{- if eq (len $statusMembers) 0 -}} {{ fail (printf "expected kind %q to contain at least one status field" $kind) }} {{- end -}} +{{- $maxFieldDepth := 3 -}} @@ -77,18 +103,12 @@ | Field | Type | Description | | --- | --- | --- | -{{- range $member := $specMembers }} -| `spec.{{ $member.Name }}` | `{{ template "typeName" $member.Type }}` | {{ markdownRenderFieldDoc $member.Doc }} | -{{- end }} - +{{ template "renderFields" (dict "fields" $specMembers "depth" 0 "maxDepth" $maxFieldDepth) }} ## Status | Field | Type | Description | | --- | --- | --- | -{{- range $member := $statusMembers }} -| `status.{{ $member.Name }}` | `{{ template "typeName" $member.Type }}` | {{ markdownRenderFieldDoc $member.Doc }} | -{{- end }} - +{{ template "renderFields" (dict "fields" $statusMembers "depth" 0 "maxDepth" $maxFieldDepth) }} ## Source - Go type: `{{ $goType }}`