Skip to content

Commit

Permalink
docs: add CRD docs (#167)
Browse files Browse the repository at this point in the history
* add CRD docs

* change doc name
  • Loading branch information
zreigz authored Apr 17, 2024
1 parent 14e2cf0 commit e182ef5
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 45 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ IMAGE_REPOSITORY := plural
IMG ?= deployment-agent:latest

ENVTEST ?= $(shell which setup-envtest)
CRDDOCS ?= $(shell which crd-ref-docs)

VELERO_CHART_VERSION := 5.2.2 # It should be kept in sync with Velero chart version from console/charts/velero
VELERO_CHART_URL := https://github.com/vmware-tanzu/helm-charts/releases/download/velero-$(VELERO_CHART_VERSION)/velero-$(VELERO_CHART_VERSION).tgz
Expand Down Expand Up @@ -37,6 +38,10 @@ help: ## Display this help.
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])

.PHONY: crd-docs
crd-docs: ##generate docs from the CRDs
$(CRDDOCS) --source-path=./api --renderer=markdown --output-path=./docs/api.md --config=config.yaml

##@ Development

.PHONY: manifests
Expand Down Expand Up @@ -119,6 +124,10 @@ envtest: --tool ## Download and install setup-envtest in the $GOPATH/bin
mockery: TOOL = mockery
mockery: --tool

.PHONY: crd-ref-docs
crd-ref-docs: TOOL = crd-ref-docs
crd-ref-docs: --tool

# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
Expand Down
22 changes: 22 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
processor:
ignoreTypes:
- ".*List$"
ignoreFields:
- "status$"
- "TypeMeta$"

render:
kubernetesVersion: 1.29
knownTypes:
- name: SecretObjectReference
package: sigs.k8s.io/gateway-api/apis/v1beta1
link: https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.SecretObjectReference
- name: ObjectReference
package: k8s.io/api/core/v1
link: https://pkg.go.dev/k8s.io/api/core/v1#ObjectReference
- name: ObjectMeta
package: k8s.io/apimachinery/pkg/apis/meta/v1
link: https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#ObjectMeta
- name: RawExtension
package: k8s.io/apimachinery/pkg/runtime
link: https://pkg.go.dev/k8s.io/apimachinery/pkg/runtime#RawExtension
141 changes: 141 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# API Reference

## Packages
- [deployments.plural.sh/v1alpha1](#deploymentspluralshv1alpha1)


## deployments.plural.sh/v1alpha1

Package v1alpha1 contains API Schema definitions for the deployments v1alpha1 API group

### Resource Types
- [CustomHealth](#customhealth)
- [PipelineGate](#pipelinegate)









#### CustomHealth



CustomHealth is the Schema for the HealthConverts API





| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `apiVersion` _string_ | `deployments.plural.sh/v1alpha1` | | |
| `kind` _string_ | `CustomHealth` | | |
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `spec` _[CustomHealthSpec](#customhealthspec)_ | | | |


#### CustomHealthSpec



CustomHealthSpec defines the desired state of CustomHealth



_Appears in:_
- [CustomHealth](#customhealth)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `script` _string_ | | | |




#### GateSpec



GateSpec defines the detailed gate specifications



_Appears in:_
- [PipelineGateSpec](#pipelinegatespec)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `job` _[JobSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#jobspec-v1-batch)_ | resuse JobSpec type from the kubernetes api | | |


#### GateState

_Underlying type:_ _GateState_

GateState represents the state of a gate, reused from console client

_Validation:_
- Enum: [PENDING OPEN CLOSED RUNNING]

_Appears in:_
- [PipelineGateStatus](#pipelinegatestatus)



#### GateType

_Underlying type:_ _GateType_

GateType represents the type of a gate, reused from console client

_Validation:_
- Enum: [APPROVAL WINDOW JOB]

_Appears in:_
- [PipelineGateSpec](#pipelinegatespec)



#### PipelineGate



PipelineGate represents a gate blocking promotion along a release pipeline





| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `apiVersion` _string_ | `deployments.plural.sh/v1alpha1` | | |
| `kind` _string_ | `PipelineGate` | | |
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `spec` _[PipelineGateSpec](#pipelinegatespec)_ | | | |


#### PipelineGateSpec



PipelineGateSpec defines the detailed gate specifications



_Appears in:_
- [PipelineGate](#pipelinegate)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `id` _string_ | | | |
| `name` _string_ | | | |
| `type` _[GateType](#gatetype)_ | | | Enum: [APPROVAL WINDOW JOB] <br /> |
| `gateSpec` _[GateSpec](#gatespec)_ | | | |




35 changes: 21 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/Yamashou/gqlgenc v0.18.1
github.com/elastic/crd-ref-docs v0.0.12
github.com/evanphx/json-patch v5.7.0+incompatible
github.com/fluxcd/flagger v1.35.0
github.com/gin-gonic/gin v1.7.7
Expand All @@ -25,16 +26,16 @@ require (
github.com/pluralsh/polly v0.1.7
github.com/samber/lo v1.39.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/vektra/mockery/v2 v2.39.0
github.com/vmware-tanzu/velero v1.13.0
github.com/yuin/gopher-lua v1.1.1
go.uber.org/zap v1.26.0
golang.org/x/net v0.19.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.22.0
helm.sh/helm/v3 v3.14.3
k8s.io/api v0.29.2
k8s.io/apiextensions-apiserver v0.29.0
k8s.io/apimachinery v0.29.2
k8s.io/apimachinery v0.29.3
k8s.io/cli-runtime v0.29.2
k8s.io/client-go v0.29.2
k8s.io/klog/v2 v2.110.1
Expand All @@ -60,6 +61,8 @@ require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
Expand All @@ -85,7 +88,7 @@ require (
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
Expand All @@ -101,10 +104,12 @@ require (
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-yaml v1.11.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
Expand Down Expand Up @@ -183,7 +188,7 @@ require (
github.com/spf13/viper v1.15.0 // indirect
github.com/spyzhov/ajson v0.9.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/vektah/gqlparser/v2 v2.5.11 // indirect
Expand All @@ -197,22 +202,23 @@ require (
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/evanphx/json-patch.v5 v5.6.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand All @@ -223,6 +229,7 @@ require (
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
oras.land/oras-go v1.2.4 // indirect
sigs.k8s.io/controller-tools v0.14.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.16.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading

0 comments on commit e182ef5

Please sign in to comment.