diff --git a/Makefile b/Makefile index 770fe2592..d1004c14e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ - # Image URL to use all building/pushing image targets IMG ?= fluxcd/source-controller:latest # Produce CRDs that work back to Kubernetes 1.13 @@ -14,7 +13,7 @@ endif all: manager # Run tests -test: generate fmt vet manifests +test: generate fmt vet manifests api-docs go test ./... -coverprofile cover.out # Build manager binary @@ -49,6 +48,10 @@ dev-deploy: manifests manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crd/bases +# Generate API reference documentation +api-docs: gen-crd-api-reference-docs + $(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/source.md + # Run go fmt against code fmt: go fmt ./... @@ -84,3 +87,19 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen else CONTROLLER_GEN=$(shell which controller-gen) endif + +# Find or download gen-crd-api-reference-docs +gen-crd-api-reference-docs: +ifeq (, $(shell which gen-crd-api-reference-docs)) + @{ \ + set -e ;\ + API_REF_GEN_TMP_DIR=$$(mktemp -d) ;\ + cd $$API_REF_GEN_TMP_DIR ;\ + go mod init tmp ;\ + go get github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0 ;\ + rm -rf $$API_REF_GEN_TMP_DIR ;\ + } +API_REF_GEN=$(GOBIN)/gen-crd-api-reference-docs +else +API_REF_GEN=$(shell which gen-crd-api-reference-docs) +endif diff --git a/api/v1alpha1/doc.go b/api/v1alpha1/doc.go new file mode 100644 index 000000000..f043e59d9 --- /dev/null +++ b/api/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Flux CD contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the source v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=source.fluxcd.io +package v1alpha1 diff --git a/api/v1alpha1/gitrepository_types.go b/api/v1alpha1/gitrepository_types.go index a6c82a26d..aa15bd9dc 100644 --- a/api/v1alpha1/gitrepository_types.go +++ b/api/v1alpha1/gitrepository_types.go @@ -199,6 +199,8 @@ func (in *GitRepository) GetInterval() metav1.Duration { return in.Spec.Interval } +// +genclient +// +genclient:Namespaced // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.spec.url` diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 6025b6614..e11f8ed10 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha1 contains API Schema definitions for the source v1alpha1 API group -// +kubebuilder:object:generate=true -// +groupName=source.fluxcd.io package v1alpha1 import ( diff --git a/api/v1alpha1/helmchart_types.go b/api/v1alpha1/helmchart_types.go index 521793d0c..558517879 100644 --- a/api/v1alpha1/helmchart_types.go +++ b/api/v1alpha1/helmchart_types.go @@ -147,6 +147,8 @@ func (in *HelmChart) GetInterval() metav1.Duration { return in.Spec.Interval } +// +genclient +// +genclient:Namespaced // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Name",type=string,JSONPath=`.spec.name` diff --git a/api/v1alpha1/helmrepository_types.go b/api/v1alpha1/helmrepository_types.go index 1b24fb95a..d724d932e 100644 --- a/api/v1alpha1/helmrepository_types.go +++ b/api/v1alpha1/helmrepository_types.go @@ -146,6 +146,8 @@ func (in *HelmRepository) GetInterval() metav1.Duration { return in.Spec.Interval } +// +genclient +// +genclient:Namespaced // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.spec.url` diff --git a/docs/api/source.md b/docs/api/source.md new file mode 100644 index 000000000..b80a9591a --- /dev/null +++ b/docs/api/source.md @@ -0,0 +1,1126 @@ +
Packages:
+Package v1alpha1 contains API Schema definitions for the source v1alpha1 API group
+Resource Types: +GitRepository is the Schema for the gitrepositories API
+| Field | +Description | +||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+apiVersion+string |
+
+source.fluxcd.io/v1alpha1
+ |
+||||||||||||
+kind+string + |
+
+GitRepository
+ |
+||||||||||||
+metadata+ + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||||||||
+spec+ + +GitRepositorySpec + + + |
+
+ + +
|
+||||||||||||
+status+ + +GitRepositoryStatus + + + |
++ | +
HelmChart is the Schema for the helmcharts API
+| Field | +Description | +||||||||
|---|---|---|---|---|---|---|---|---|---|
+apiVersion+string |
+
+source.fluxcd.io/v1alpha1
+ |
+||||||||
+kind+string + |
+
+HelmChart
+ |
+||||||||
+metadata+ + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||||
+spec+ + +HelmChartSpec + + + |
+
+ + +
|
+||||||||
+status+ + +HelmChartStatus + + + |
++ | +
HelmRepository is the Schema for the helmrepositories API
+| Field | +Description | +||||||
|---|---|---|---|---|---|---|---|
+apiVersion+string |
+
+source.fluxcd.io/v1alpha1
+ |
+||||||
+kind+string + |
+
+HelmRepository
+ |
+||||||
+metadata+ + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||
+spec+ + +HelmRepositorySpec + + + |
+
+ + +
|
+||||||
+status+ + +HelmRepositoryStatus + + + |
++ | +
+(Appears on: +GitRepositoryStatus, +HelmChartStatus, +HelmRepositoryStatus) +
+Artifact represents the output of a source synchronisation
+| Field | +Description | +
|---|---|
+path+ +string + + |
+
+ Path is the local file path of this artifact. + |
+
+url+ +string + + |
+
+ URL is the HTTP address of this artifact. + |
+
+revision+ +string + + |
+
+(Optional)
+ Revision is a human readable identifier traceable in the origin source system. +It can be a commit sha, git tag, a helm index timestamp, +a helm chart version, a checksum, etc. + |
+
+lastUpdateTime+ + +Kubernetes meta/v1.Time + + + |
+
+ LastUpdateTime is the timestamp corresponding to the last +update of this artifact. + |
+
+(Appears on: +GitRepositorySpec) +
+GitRepositoryRef defines the git ref used for pull and checkout operations.
+| Field | +Description | +
|---|---|
+branch+ +string + + |
+
+(Optional)
+ The git branch to checkout, defaults to master. + |
+
+tag+ +string + + |
+
+(Optional)
+ The git tag to checkout, takes precedence over branch. + |
+
+semver+ +string + + |
+
+(Optional)
+ The git tag semver expression, takes precedence over tag. + |
+
+commit+ +string + + |
+
+(Optional)
+ The git commit sha to checkout, if specified tag filters will be ignored. + |
+
+(Appears on: +GitRepository) +
+GitRepositorySpec defines the desired state of a Git repository.
+| Field | +Description | +
|---|---|
+url+ +string + + |
+
+ The repository URL, can be a HTTP or SSH address. + |
+
+secretRef+ + +Kubernetes core/v1.LocalObjectReference + + + |
+
+(Optional)
+ The secret name containing the Git credentials. +For HTTPS repositories the secret must contain username and password +fields. +For SSH repositories the secret must contain identity, identity.pub and +known_hosts fields. + |
+
+interval+ + +Kubernetes meta/v1.Duration + + + |
+
+ The interval at which to check for repository updates. + |
+
+timeout+ + +Kubernetes meta/v1.Duration + + + |
+
+(Optional)
+ The timeout for remote git operations like cloning, default to 20s. + |
+
+ref+ + +GitRepositoryRef + + + |
+
+(Optional)
+ The git reference to checkout and monitor for changes, defaults to +master branch. + |
+
+verify+ + +GitRepositoryVerification + + + |
+
+(Optional)
+ Verify OpenPGP signature for the commit that HEAD points to. + |
+
+(Appears on: +GitRepository) +
+GitRepositoryStatus defines the observed state of a Git repository.
+| Field | +Description | +
|---|---|
+conditions+ + +[]SourceCondition + + + |
++(Optional) + | +
+url+ +string + + |
+
+(Optional)
+ URL is the download link for the artifact output of the last repository +sync. + |
+
+artifact+ + +Artifact + + + |
+
+(Optional)
+ Artifact represents the output of the last successful repository sync. + |
+
+(Appears on: +GitRepositorySpec) +
+GitRepositoryVerification defines the OpenPGP signature verification process.
+| Field | +Description | +
|---|---|
+mode+ +string + + |
+
+ Mode describes what git object should be verified, currently (‘head’). + |
+
+secretRef+ + +Kubernetes core/v1.LocalObjectReference + + + |
+
+ The secret name containing the public keys of all trusted git authors. + |
+
+(Appears on: +HelmChart) +
+HelmChartSpec defines the desired state of a Helm chart.
+| Field | +Description | +
|---|---|
+name+ +string + + |
+
+ The name of the Helm chart, as made available by the referenced +Helm repository. + |
+
+version+ +string + + |
+
+(Optional)
+ The chart version semver expression, defaults to latest when +omitted. + |
+
+helmRepositoryRef+ + +Kubernetes core/v1.LocalObjectReference + + + |
+
+ The name of the HelmRepository the chart is available at. + |
+
+interval+ + +Kubernetes meta/v1.Duration + + + |
+
+ The interval at which to check the Helm repository for updates. + |
+
+(Appears on: +HelmChart) +
+HelmChartStatus defines the observed state of the HelmChart.
+| Field | +Description | +
|---|---|
+conditions+ + +[]SourceCondition + + + |
++(Optional) + | +
+url+ +string + + |
+
+(Optional)
+ URL is the download link for the last chart pulled. + |
+
+artifact+ + +Artifact + + + |
+
+(Optional)
+ Artifact represents the output of the last successful chart sync. + |
+
+(Appears on: +HelmRepository) +
+HelmRepositorySpec defines the reference to a Helm repository.
+| Field | +Description | +
|---|---|
+url+ +string + + |
+
+ The Helm repository URL, a valid URL contains at least a +protocol and host. + |
+
+secretRef+ + +Kubernetes core/v1.LocalObjectReference + + + |
+
+(Optional)
+ The name of the secret containing authentication credentials +for the Helm repository. +For HTTP/S basic auth the secret must contain username and password +fields. +For TLS the secret must contain caFile, keyFile and caCert fields. + |
+
+interval+ + +Kubernetes meta/v1.Duration + + + |
+
+ The interval at which to check the upstream for updates. + |
+
+(Appears on: +HelmRepository) +
+HelmRepositoryStatus defines the observed state of the HelmRepository.
+| Field | +Description | +
|---|---|
+conditions+ + +[]SourceCondition + + + |
++(Optional) + | +
+url+ +string + + |
+
+(Optional)
+ URL is the download link for the last index fetched. + |
+
+artifact+ + +Artifact + + + |
+
+(Optional)
+ Artifact represents the output of the last successful repository sync. + |
+
Source interface must be supported by all API types.
++(Appears on: +GitRepositoryStatus, +HelmChartStatus, +HelmRepositoryStatus) +
+SourceCondition contains condition information for a source.
+| Field | +Description | +
|---|---|
+type+ +string + + |
+
+ Type of the condition, currently (‘Ready’). + |
+
+status+ + +Kubernetes core/v1.ConditionStatus + + + |
+
+ Status of the condition, one of (‘True’, ‘False’, ‘Unknown’). + |
+
+lastTransitionTime+ + +Kubernetes meta/v1.Time + + + |
+
+ LastTransitionTime is the timestamp corresponding to the last status +change of this condition. + |
+
+reason+ +string + + |
+
+ Reason is a brief machine readable explanation for the condition’s last +transition. + |
+
+message+ +string + + |
+
+(Optional)
+ Message is a human readable description of the details of the last +transition, complementing reason. + |
+
This page was automatically generated with gen-crd-api-reference-docs
{{ fieldName . }}
+ (Members of {{ fieldName . }} are embedded into this type.)
+
metadata field.
+ {{ end }}
+
+ {{ if or (eq (fieldName .) "spec") }}
+ Packages:
+This page was automatically generated with gen-crd-api-reference-docs
{{.Underlying}} alias){{ end -}}
+ + (Appears on: + {{- $prev := "" -}} + {{- range . -}} + {{- if $prev -}}, {{ end -}} + {{ $prev = . }} + {{ typeDisplayName . }} + {{- end -}} + ) +
+ {{ end }} + + {{ with .CommentLines }} + {{ safe (renderComments .) }} + {{ end }} + + {{ if .Members }} +| Field | +Description | +
|---|---|
+ apiVersion+ string |
+
+ {{ apiGroup . }}
+ |
+
+ kind+ string + |
+
+ {{ .Name.Name }}
+ |
+