apis

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

The apis package describes the comment directives that may be applied to apis / resources

Example
package main

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func main() {
	// FooSpec defines the desired state of Foo
	type FooSpec struct {
		// +kubebuilder:validation:Maximum=10
		// +kubebuilder:validation:ExclusiveMinimum=3
		Count int `json:"count"`
	}

	// FooStatus defines the observed state of Foo
	type FooStatus struct{}

	// +genclient
	// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

	// Foo
	// +k8s:openapi-gen=true
	// +kubebuilder:resource:path=foos
	// +kubebuilder:categories=foo,bar,baz
	type Foo struct {
		metav1.TypeMeta   `json:",inline"`
		metav1.ObjectMeta `json:"metadata,omitempty"`

		Spec   FooSpec   `json:"spec,omitempty"`
		Status FooStatus `json:"status,omitempty"`
	}
}
Output:

Index

Examples

Constants

View Source
const (
	// Resource annotates a type as a resource
	Resource = "// +kubebuilder:resource:path="

	// StatusSubresource annotates a type as having a status subresource
	StatusSubresource = "// +kubebuilder:subresource:status"

	// Categories annotates a type as belonging to a comma-delimited list of
	// categories
	Categories = "// +kubebuilder:categories="

	// Maximum annotates a numeric go struct field for CRD validation
	Maximum = "// +kubebuilder:validation:Maximum="

	// ExclusiveMaximum annotates a numeric go struct field for CRD validation
	ExclusiveMaximum = "// +kubebuilder:validation:ExclusiveMaximum="

	// Minimum annotates a numeric go struct field for CRD validation
	Minimum = "// +kubebuilder:validation:Minimum="

	// ExclusiveMinimum annotates a numeric go struct field for CRD validation
	ExclusiveMinimum = "// +kubebuilder:validation:ExclusiveMinimum="

	// Pattern annotates a string go struct field for CRD validation with a regular expression it must match
	Pattern = "// +kubebuilder:validation:Pattern="

	// Enum specifies the valid values for a field
	Enum = "// +kubebuilder:validation:Enum="

	// MaxLength specifies the maximum length of a string field
	MaxLength = "// +kubebuilder:validation:MaxLength="

	// MinLength specifies the minimum length of a string field
	MinLength = "// +kubebuilder:validation:MinLength="

	// MaxItems specifies the maximum number of items an array or slice field may contain
	MaxItems = "// +kubebuilder:validation:MaxItems="

	// MinItems specifies the minimum number of items an array or slice field may contain
	MinItems = "// +kubebuilder:validation:MinItems="

	// UniqueItems specifies that all values in an array or slice must be unique
	UniqueItems = "// +kubebuilder:validation:UniqueItems="

	// Format annotates a string go struct field for CRD validation with a specific format
	Format = "// +kubebuilder:validation:Format="
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL