API Documentation

According to actual business needs, we generally divide APIs into three types: standard K8S API, advanced API, and CRD (Custom Resource Definition). Therefore, the directory structure is usually organized as follows:

├── apis
   ├── advanced_apis # Advanced APIs
   ├── crds # CRDs
   ├── kubernetes_apis # K8S APIs
   └── references # Common references

TOC

K8S API

kubernetes_apis/workload/daemonset.mdx
# DaemonSet [apps/v1]

<K8sAPI
  name="io.k8s.api.apps.v1.DaemonSet"
  pathPrefix="/kubernetes/{cluster}"
/>

Refer to DaemonSet.

crds/ArtifactCleanupRun.mdx
# ArtifactCleanupRun

<K8sAPI name="artifactcleanupruns.artifacts.katanomi.dev" />

Refer to ArtifactCleanupRun.

props

  • name: Reference name under OpenAPI schema definitions (v2) or components/schemas (v3), or CRD metadata.name
  • namespaced: Indicates whether the resource is namespace-scoped; defaults to true, meaning the API Endpoints include the namespace path parameter namespaces/{namespace}
  • pathPrefix: Can be used to override the global configuration api.pathPrefix
  • filepath: Similar to specifying openapi path, used to specify a particular openapi or CRD file
  • apiGroup: Optional, specifies the API group; openapi will try to read the referenced x-kubernetes-group-version-kind, same below
  • apiVersion: Optional, specifies the API version; CRD will default to the first version in spec.versions
  • apiKind: Optional, specifies the API resource kind

Advanced API

advanced_apis/codeQualityTaskSummary.mdx
# CodeQualityTaskSummary

<OpenAPIPath path="/plugins/v1alpha1/template/codeQuality/task/{task-id}/summary" />

Refer to CodeQualityTaskSummary.

props

  • path: Path under OpenAPI schema paths
  • pathPrefix: Can be used to override the global configuration api.pathPrefix
  • openapiPath: See specifying openapi path

CRD (deprecated)

WARNING

Please use the K8sAPI component instead of the K8sCrd component. The K8sCrd component will be removed in future versions.

crds/ArtifactCleanupRun-K8sCrd.mdx
# ArtifactCleanupRun - K8sCrd

<K8sCrd name="artifactcleanupruns.artifacts.katanomi.dev" />

Refer to ArtifactCleanupRun-K8sCrd.

props

Common References

references/CodeQuality.mdx
# CodeQuality

<OpenAPIRef schema="v1alpha1.CodeQuality" />

Refer to CodeQuality.

props

  • schema: Reference name under OpenAPI schema definitions (v2) or components/schemas (v3)
  • openapiPath: See specifying openapi path

Specifying openapi Path

For the OpenAPIPath and OpenAPIRef components, by default, all openapi definition files are searched until a match is found. If you need to specify a particular openapi file, you can use the openapiPath attribute:

<OpenAPIPath
  path="/plugins/v1alpha1/template/codeQuality/task/{task-id}/summary"
  openapiPath="shared/openapis/katanomi.json"
/>