Skip to content

Commit 0b4914a

Browse files
authored
Merge pull request #58 from fluxcd/generate-api-docs
Generate API docs
2 parents fdafff5 + 0cf879a commit 0b4914a

File tree

7 files changed

+677
-0
lines changed

7 files changed

+677
-0
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ dev-deploy: manifests
7070
manifests: controller-gen
7171
cd api; $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config="../config/crd/bases"
7272

73+
# Generate API reference documentation
74+
api-docs: gen-crd-api-reference-docs
75+
$(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/image-automation.md
76+
7377
# Run go fmt against code
7478
fmt:
7579
go fmt ./...
@@ -108,3 +112,19 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen
108112
else
109113
CONTROLLER_GEN=$(shell which controller-gen)
110114
endif
115+
116+
# Find or download gen-crd-api-reference-docs
117+
gen-crd-api-reference-docs:
118+
ifeq (, $(shell which gen-crd-api-reference-docs))
119+
@{ \
120+
set -e ;\
121+
API_REF_GEN_TMP_DIR=$$(mktemp -d) ;\
122+
cd $$API_REF_GEN_TMP_DIR ;\
123+
go mod init tmp ;\
124+
go get github.com/ahmetb/[email protected] ;\
125+
rm -rf $$API_REF_GEN_TMP_DIR ;\
126+
}
127+
API_REF_GEN=$(GOBIN)/gen-crd-api-reference-docs
128+
else
129+
API_REF_GEN=$(shell which gen-crd-api-reference-docs)
130+
endif

api/v1alpha1/doc.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2020 The Flux authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API types for the image v1alpha1 API
18+
// group. The types here are concerned with automated updates to git,
19+
// based on metadata from OCI image registries gathered by the
20+
// image-reflector-controller.
21+
//
22+
// +kubebuilder:object:generate=true
23+
// +groupName=image.toolkit.fluxcd.io
24+
package v1alpha1

0 commit comments

Comments
 (0)