Skip to content

Commit

Permalink
Generate API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Jul 2, 2020
1 parent 17ab047 commit 5c1768c
Show file tree
Hide file tree
Showing 10 changed files with 858 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,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
Expand Down Expand Up @@ -57,7 +57,7 @@ manifests: controller-gen

# 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/kustomize.md
$(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/notification.md

# Run go fmt against code
fmt:
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/alert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
type AlertSpec struct {
// Send events using this provider
// +required
ProviderRef corev1.ObjectReference `json:"providerRef"`
ProviderRef corev1.LocalObjectReference `json:"providerRef"`

// Filter events based on severity, defaults to ('info').
// +kubebuilder:validation:Enum=info;error
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -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 notification v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=notification.fluxcd.io
package v1alpha1
3 changes: 0 additions & 3 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 notification v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=notification.fluxcd.io
package v1alpha1

import (
Expand Down
32 changes: 2 additions & 30 deletions config/crd/bases/notification.fluxcd.io_alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,9 @@ spec:
providerRef:
description: Send events using this provider
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an
entire object, this string should contain a valid JSON/Go field
access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen only
to have some well-defined way of referencing a part of an object.
TODO: this design is not final and this field is subject to change
in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
suspend:
Expand Down
Loading

0 comments on commit 5c1768c

Please sign in to comment.