Documentation ¶
Overview ¶
+k8s:deepcopy-gen=package,register +groupName=unikorn-cloud.org
Index ¶
- Constants
- Variables
- func CompareHelmApplication(a, b HelmApplication) int
- func Resource(resource string) schema.GroupResource
- func UpdateCondition(conditions *[]Condition, t ConditionType, status corev1.ConditionStatus, ...)
- type ApplicationNamedReference
- type ApplicationReference
- type ApplicationReferenceKind
- type Condition
- type ConditionReason
- type ConditionType
- type HelmApplication
- type HelmApplicationDependency
- type HelmApplicationList
- type HelmApplicationParameter
- type HelmApplicationSpec
- type HelmApplicationStatus
- type HelmApplicationVersion
- type IPv4Address
- func (in *IPv4Address) DeepCopy() *IPv4Address
- func (in *IPv4Address) DeepCopyInto(out *IPv4Address)
- func (a IPv4Address) MarshalJSON() ([]byte, error)
- func (IPv4Address) OpenAPISchemaFormat() string
- func (IPv4Address) OpenAPISchemaType() []string
- func (a IPv4Address) ToUnstructured() interface{}
- func (a *IPv4Address) UnmarshalJSON(b []byte) error
- type IPv4Prefix
- func (in *IPv4Prefix) DeepCopy() *IPv4Prefix
- func (p *IPv4Prefix) DeepCopyInto(out *IPv4Prefix)
- func (p IPv4Prefix) MarshalJSON() ([]byte, error)
- func (IPv4Prefix) OpenAPISchemaFormat() string
- func (IPv4Prefix) OpenAPISchemaType() []string
- func (p IPv4Prefix) ToUnstructured() interface{}
- func (p *IPv4Prefix) UnmarshalJSON(b []byte) error
- type ManagableResourceInterface
- type ReconcilePauser
- type ResourceLabeller
- type SemanticVersion
- type StatusConditionReader
- type StatusConditionWriter
Constants ¶
const ( // GroupName is the Kubernetes API group our resources belong to. GroupName = "unikorn-cloud.org" // GroupVersion is the version of our custom resources. GroupVersion = "v1alpha1" // Group is group/version of our resources. Group = GroupName + "/" + GroupVersion // HelmApplicationKind is the API kind for helm application descriptors. HelmApplicationKind = "HelmApplication" // HelmApplicationResource is the API endpoint for helm application descriptors. HelmApplicationResource = "helmapplications" )
Variables ¶
var ( // ErrStatusConditionLookup is raised when a condition is not found in // the resource status. ErrStatusConditionLookup = errors.New("status condition not found") // ErrMissingLabel is raised when an expected label is not present on // a resource. ErrMissingLabel = errors.New("expected label is missing") // ErrApplicationLookup is raised when the named application is not // present in an application bundle bundle. ErrApplicationLookup = errors.New("failed to lookup an application") )
var ( // SchemeGroupVersion defines the GV of our resources. //nolint:gochecknoglobals SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} // SchemeBuilder creates a mapping between GVK and type. //nolint:gochecknoglobals SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} // AddToScheme adds our GVK to resource mappings to an existing scheme. //nolint:gochecknoglobals AddToScheme = SchemeBuilder.AddToScheme )
var (
ErrJSONUnmarshal = errors.New("failed to unmarshal JSON")
)
var ( // ErrVersionNotFound is raised when the requested version is // undefined in an application. ErrVersionNotFound = errors.New("version not found") )
Functions ¶
func CompareHelmApplication ¶
func CompareHelmApplication(a, b HelmApplication) int
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource maps a resource type to a group resource.
func UpdateCondition ¶
func UpdateCondition(conditions *[]Condition, t ConditionType, status corev1.ConditionStatus, reason ConditionReason, message string)
UpdateCondition either adds or updates a condition in the resource status. If the condition, status and message match an existing condition the update is ignored.
Types ¶
type ApplicationNamedReference ¶
type ApplicationNamedReference struct { // Name is the name of the application. This must match what is encoded into // Unikorn's application management engine. Name *string `json:"name"` // Reference is a reference to the application definition. Reference *ApplicationReference `json:"reference"` }
func (*ApplicationNamedReference) DeepCopy ¶
func (in *ApplicationNamedReference) DeepCopy() *ApplicationNamedReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationNamedReference.
func (*ApplicationNamedReference) DeepCopyInto ¶
func (in *ApplicationNamedReference) DeepCopyInto(out *ApplicationNamedReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ApplicationReference ¶
type ApplicationReference struct { // Kind is the kind of resource we are referencing. // +kubebuilder:validation:Enum=HelmApplication Kind *ApplicationReferenceKind `json:"kind"` // Name is the name of the resource we are referencing. Name *string `json:"name"` // Version is the version of the application within the application type. // TODO: make mandatory. Version *string `json:"version,omitempty"` }
func (*ApplicationReference) DeepCopy ¶
func (in *ApplicationReference) DeepCopy() *ApplicationReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationReference.
func (*ApplicationReference) DeepCopyInto ¶
func (in *ApplicationReference) DeepCopyInto(out *ApplicationReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ApplicationReferenceKind ¶
type ApplicationReferenceKind string
ApplicationReferenceKind defines the application kind we wish to reference.
const ( // ApplicationReferenceKindHelm references a helm application. ApplicationReferenceKindHelm ApplicationReferenceKind = "HelmApplication" )
type Condition ¶
type Condition struct { // Type is the type of the condition. Type ConditionType `json:"type"` // Status is the status of the condition. // Can be True, False, Unknown. Status corev1.ConditionStatus `json:"status"` // Last time the condition transitioned from one status to another. LastTransitionTime metav1.Time `json:"lastTransitionTime"` // Unique, one-word, CamelCase reason for the condition's last transition. Reason ConditionReason `json:"reason"` // Human-readable message indicating details about last transition. Message string `json:"message"` }
Condition is a generic condition type for use across all resource types. It's generic so that the underlying controller-manager functionality can be shared across all resources.
func GetCondition ¶
func GetCondition(conditions []Condition, t ConditionType) (*Condition, error)
GetCondition is a generic condition lookup function.
func (*Condition) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
func (*Condition) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ConditionReason ¶
type ConditionReason string
ConditionReason defines the possible reasons of a resource condition. These are generic and may be used by any condition. +kubebuilder:validation:Enum=Provisioning;Provisioned;Cancelled;Errored;Deprovisioning;Deprovisioned
const ( // ConditionReasonProvisioning is used for the Available condition // to indicate that a resource has been seen, it has no pre-existing condition // and we assume it's being provisioned for the first time. ConditionReasonProvisioning ConditionReason = "Provisioning" // ConditionReasonProvisioned is used for the Available condition // to mean that the resource is ready to be used. ConditionReasonProvisioned ConditionReason = "Provisioned" // ConditionReasonCancelled is used by a condition to // indicate the controller was cancelled e.g. via a container shutdown. ConditionReasonCancelled ConditionReason = "Cancelled" // ConditionReasonErrored is used by a condition to // indicate an unexpected error occurred e.g. Kubernetes API transient error. // If we see these, consider formulating a fix, for example a retry loop. ConditionReasonErrored ConditionReason = "Errored" // ConditionReasonDeprovisioning is used by a condition to // indicate the controller has picked up a deprovision event. ConditionReasonDeprovisioning ConditionReason = "Deprovisioning" // ConditionReasonDeprovisioned is used by a condition to // indicate we have finished deprovisioning and the Kubernetes // garbage collector can remove the resource. ConditionReasonDeprovisioned ConditionReason = "Deprovisioned" )
type ConditionType ¶
type ConditionType string
+kubebuilder:validation:Enum=Available
const ( // ConditionAvailable if not defined or false means that the // resource is not ready, or is known to be in a bad state and should // not be used. When true, while not guaranteed to be fully functional. ConditionAvailable ConditionType = "Available" )
type HelmApplication ¶
type HelmApplication struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec HelmApplicationSpec `json:"spec"` Status HelmApplicationStatus `json:"status,omitempty"` }
HelmApplication defines a Helm application. +genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:scope=Cluster,categories=unikorn +kubebuilder:printcolumn:name="display name",type="string",JSONPath=".metadata.labels['unikorn-cloud\\.org/name']" +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
func (*HelmApplication) DeepCopy ¶
func (in *HelmApplication) DeepCopy() *HelmApplication
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplication.
func (*HelmApplication) DeepCopyInto ¶
func (in *HelmApplication) DeepCopyInto(out *HelmApplication)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*HelmApplication) DeepCopyObject ¶
func (in *HelmApplication) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*HelmApplication) GetVersion ¶
func (a *HelmApplication) GetVersion(version string) (*HelmApplicationVersion, error)
type HelmApplicationDependency ¶
type HelmApplicationDependency struct { // Name the name of the application to depend on. Name *string `json:"name"` }
func (*HelmApplicationDependency) DeepCopy ¶
func (in *HelmApplicationDependency) DeepCopy() *HelmApplicationDependency
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationDependency.
func (*HelmApplicationDependency) DeepCopyInto ¶
func (in *HelmApplicationDependency) DeepCopyInto(out *HelmApplicationDependency)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HelmApplicationList ¶
type HelmApplicationList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []HelmApplication `json:"items"` }
HelmApplicationList defines a list of Helm applications. +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
func (*HelmApplicationList) DeepCopy ¶
func (in *HelmApplicationList) DeepCopy() *HelmApplicationList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationList.
func (*HelmApplicationList) DeepCopyInto ¶
func (in *HelmApplicationList) DeepCopyInto(out *HelmApplicationList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*HelmApplicationList) DeepCopyObject ¶
func (in *HelmApplicationList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (HelmApplicationList) Exported ¶
func (l HelmApplicationList) Exported() HelmApplicationList
Exported returns all applications that are exported, and thus end-user installable.
type HelmApplicationParameter ¶
type HelmApplicationParameter struct { // Name is the name of the parameter. Name *string `json:"name"` // Value is the value of the parameter. Value *string `json:"value"` }
func (*HelmApplicationParameter) DeepCopy ¶
func (in *HelmApplicationParameter) DeepCopy() *HelmApplicationParameter
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationParameter.
func (*HelmApplicationParameter) DeepCopyInto ¶
func (in *HelmApplicationParameter) DeepCopyInto(out *HelmApplicationParameter)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HelmApplicationSpec ¶
type HelmApplicationSpec struct { // Documentation defines a URL to 3rd party documentation. Documentation *string `json:"documentation"` // License describes the licence the application is released under. License *string `json:"license"` // Icon is a base64 encoded icon for the application. Icon []byte `json:"icon"` // Tags allows an application to be given a free-form set of labels // that can provide grouping, filtering or other contexts. For // example "networking", "monitoring", "database" etc. Tags []string `json:"tags"` // Exported defines whether the application should be exported to // the user visiable application manager. Exported *bool `json:"exported,omitempty"` // Versions are the application versions that are supported. Versions []HelmApplicationVersion `json:"versions,omitempty"` }
func (*HelmApplicationSpec) DeepCopy ¶
func (in *HelmApplicationSpec) DeepCopy() *HelmApplicationSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationSpec.
func (*HelmApplicationSpec) DeepCopyInto ¶
func (in *HelmApplicationSpec) DeepCopyInto(out *HelmApplicationSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HelmApplicationStatus ¶
type HelmApplicationStatus struct{}
func (*HelmApplicationStatus) DeepCopy ¶
func (in *HelmApplicationStatus) DeepCopy() *HelmApplicationStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationStatus.
func (*HelmApplicationStatus) DeepCopyInto ¶
func (in *HelmApplicationStatus) DeepCopyInto(out *HelmApplicationStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HelmApplicationVersion ¶
type HelmApplicationVersion struct { // Repo is either a Helm chart repository, or git repository. // If not set, uses the application default. Repo *string `json:"repo"` // Chart is the chart name in the repository. // If not set, uses the application default. Chart *string `json:"chart,omitempty"` // Path is the path if the repo is a git repo. // If not set, uses the application default. Path *string `json:"path,omitempty"` // Version is the chart version, or a branch when a path is provided. Version *string `json:"version"` // Release is the explicit release name for when chart resource names are dynamic. // Typically we need predicatable names for things that are going to be remote // clusters to derive endpoints or Kubernetes configurations. // If not set, uses the application default. Release *string `json:"release,omitempty"` // Parameters is a set of static --set parameters to pass to the chart. // If not set, uses the application default. Parameters []HelmApplicationParameter `json:"parameters,omitempty"` // CreateNamespace indicates whether the chart requires a namespace to be // created by the tooling, rather than the chart itself. // If not set, uses the application default. CreateNamespace *bool `json:"createNamespace,omitempty"` // ServerSideApply allows you to bypass using kubectl apply. This is useful // in situations where CRDs are too big and blow the annotation size limit. // We'd like to have this on by default, but mutating admission webhooks and // controllers modifying the spec mess this up. // If not set, uses the application default. ServerSideApply *bool `json:"serverSideApply,omitempty"` // Interface is the name of a Unikorn function that configures the application. // In particular it's used when reading values from a custom resource and mapping // them to Helm values. This allows us to version Helm interfaces in the context // of "do we need to do something differently", without having to come up with a // generalized solution that purely exists as Kubernetes resource specifications. // For example, building a Openstack Cloud Provider configuration from a clouds.yaml // is going to be bloody tricky without some proper code to handle it. // If not set, uses the application default. Interface *string `json:"interface,omitempty"` // Dependencies capture hard dependencies on other applications that must // be installed before this one. Dependencies []HelmApplicationDependency `json:"dependencies,omitempty"` // Recommends capture soft dependencies on other applications that may be // installed after this one. Typically ths could be storage classes for a // storage provider etc. Recommends []HelmApplicationDependency `json:"recommends,omitempty"` }
+kubebuilder:validation:XValidation:rule="has(self.chart) || has(self.path)",message="either chart or path must be specified" +kubebuilder:validation:XValidation:rule="!(has(self.chart) && has(self.path))",message="only one of chart or path may be specified"
func (*HelmApplicationVersion) DeepCopy ¶
func (in *HelmApplicationVersion) DeepCopy() *HelmApplicationVersion
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmApplicationVersion.
func (*HelmApplicationVersion) DeepCopyInto ¶
func (in *HelmApplicationVersion) DeepCopyInto(out *HelmApplicationVersion)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type IPv4Address ¶
+kubebuilder:validation:Type=string +kubebuilder:validation:Pattern="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$"
func IPv4AddressSliceFromIPSlice ¶
func IPv4AddressSliceFromIPSlice(in []net.IP) []IPv4Address
IPv4AddressSliceFromIPSlice is a simple converter from Go types to API types.
func (*IPv4Address) DeepCopy ¶
func (in *IPv4Address) DeepCopy() *IPv4Address
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPv4Address.
func (*IPv4Address) DeepCopyInto ¶
func (in *IPv4Address) DeepCopyInto(out *IPv4Address)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (IPv4Address) MarshalJSON ¶
func (a IPv4Address) MarshalJSON() ([]byte, error)
func (IPv4Address) OpenAPISchemaFormat ¶
func (IPv4Address) OpenAPISchemaFormat() string
func (IPv4Address) OpenAPISchemaType ¶
func (IPv4Address) OpenAPISchemaType() []string
There is no interface defined for these. See https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators for reference.
func (IPv4Address) ToUnstructured ¶
func (a IPv4Address) ToUnstructured() interface{}
func (*IPv4Address) UnmarshalJSON ¶
func (a *IPv4Address) UnmarshalJSON(b []byte) error
type IPv4Prefix ¶
See https://regex101.com/r/QUfWrF/1 +kubebuilder:validation:Type=string +kubebuilder:validation:Pattern="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\/(?:3[0-2]|[1-2]?[0-9])$"
func (*IPv4Prefix) DeepCopy ¶
func (in *IPv4Prefix) DeepCopy() *IPv4Prefix
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPv4Prefix.
func (*IPv4Prefix) DeepCopyInto ¶
func (p *IPv4Prefix) DeepCopyInto(out *IPv4Prefix)
DeepCopyInto implements the interface deepcopy-gen is totally unable to do by itself.
func (IPv4Prefix) MarshalJSON ¶
func (p IPv4Prefix) MarshalJSON() ([]byte, error)
func (IPv4Prefix) OpenAPISchemaFormat ¶
func (IPv4Prefix) OpenAPISchemaFormat() string
func (IPv4Prefix) OpenAPISchemaType ¶
func (IPv4Prefix) OpenAPISchemaType() []string
There is no interface defined for these. See https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators for reference.
func (IPv4Prefix) ToUnstructured ¶
func (p IPv4Prefix) ToUnstructured() interface{}
func (*IPv4Prefix) UnmarshalJSON ¶
func (p *IPv4Prefix) UnmarshalJSON(b []byte) error
type ManagableResourceInterface ¶
type ManagableResourceInterface interface { client.Object ResourceLabeller ReconcilePauser StatusConditionReader StatusConditionWriter }
ManagableResourceInterface is a resource type that can be manged e.g. has a controller associateds with it.
type ReconcilePauser ¶
type ReconcilePauser interface { // Paused indicates a resource is paused and will not do anything. Paused() bool }
ReconcilePauser indicates a resource can have its reconciliation paused.
type ResourceLabeller ¶
type ResourceLabeller interface { // ResourceLabels returns a set of labels from the resource that uniquely // identify it, if they all were to reside in the same namespace. // In database terms this would be a composite key. ResourceLabels() (labels.Set, error) }
ResourceLabeller is a generic interface over all resource types, where the resource can be uniquely identified. As these typically map to custom resource types, be extra careful you don't overload anything in metav1.Object or runtime.Object.
type SemanticVersion ¶
type SemanticVersion string
+kubebuilder:validation:Pattern="^v(?:[0-9]+\\.){2}(?:[0-9]+)$"
type StatusConditionReader ¶
type StatusConditionReader interface { // StatusConditionRead scans the status conditions for an existing condition // whose type matches. StatusConditionRead(t ConditionType) (*Condition, error) }
StatusConditionReader allows generic status conditions to be read.
type StatusConditionWriter ¶
type StatusConditionWriter interface { // StatusConditionWrite either adds or updates a condition in the resource // status. If the condition, status and message match an existing condition // the update is ignored. StatusConditionWrite(t ConditionType, status corev1.ConditionStatus, reason ConditionReason, message string) }
StatusConditionWriter allows generic status conditions to be updated.