Documentation ¶
Overview ¶
Package v1alpha1 contains the API Schema definitions for Timoni API. +kubebuilder:object:generate=true
Index ¶
- Constants
- Variables
- func IsRuntimeAttribute(key, body string) bool
- type ArtifactReference
- type Bundle
- type BundleInstance
- type ImageReference
- type Instance
- type ModuleReference
- type ResourceInventory
- type ResourceRef
- type Runtime
- type RuntimeAttribute
- type RuntimeCluster
- type RuntimeResourceRef
- type RuntimeValue
- type Selector
Constants ¶
const ( EnabledValue = "enabled" DisabledValue = "disabled" )
const ( // ArtifactPrefix is the prefix used for OpenContainers artifact address. ArtifactPrefix = "oci://" // LocalPrefix is the prefix used for local file system address. LocalPrefix = "file://" // UserAgent is the agent name used for OpenContainers artifact operations. UserAgent = "timoni/v1" // ConfigMediaType is the OpenContainers artifact media type for the config layer. ConfigMediaType = "application/vnd.timoni.config.v1+json" // ContentMediaType is the OpenContainers artifact media type for the content layer. ContentMediaType = "application/vnd.timoni.content.v1.tar+gzip" // ContentTypeAnnotation is the annotation key used on OpenContainers artifact // layers for specified the type of content included in the tarball. ContentTypeAnnotation = "sh.timoni.content.type" // AnyContentType is the default value of ContentTypeAnnotation. AnyContentType = "" // TimoniModContentType is the value of ContentTypeAnnotation for setting the // layer type to Timoni module content. TimoniModContentType = "module" // TimoniModVendorContentType is the value of ContentTypeAnnotation for setting the // layer type to Timoni module vendored CUE schemas. TimoniModVendorContentType = "module/vendor" // CueModGenContentType is the value of ContentTypeAnnotation for setting the // content to CUE generated schemas. CueModGenContentType = "cue.mod/gen" // CueModPkgContentType is the value of ContentTypeAnnotation for setting the // content to CUE schemas. CueModPkgContentType = "cue.mod/pkg" // SourceAnnotation is the OpenContainers annotation for specifying // the upstream source URL of an artifact. SourceAnnotation = "org.opencontainers.image.source" // RevisionAnnotation is the OpenContainers annotation for specifying // the upstream source revision of an artifact. RevisionAnnotation = "org.opencontainers.image.revision" // VersionAnnotation is the OpenContainers annotation for specifying // the semantic version of an artifact. VersionAnnotation = "org.opencontainers.image.version" // CreatedAnnotation is the OpenContainers annotation for specifying // the build date and time on an artifact (RFC 3339). CreatedAnnotation = "org.opencontainers.image.created" )
const ( IgnoreFile = "timoni.ignore" DefaultIgnorePatterns = `# VCS .git/ .gitignore .gitmodules .gitattributes # Go vendor/ go.mod go.sum # CUE *_tool.cue debug_values.cue ` )
const ( // RuntimeKind is the name of the Timoni runtime CUE attributes. RuntimeKind string = "runtime" // RuntimeDefaultName is the name of the default Timoni runtime. RuntimeDefaultName string = "_default" // RuntimeDelimiter is the delimiter used in Timoni runtime CUE attributes. RuntimeDelimiter string = ":" // RuntimePIVersionSelector is the CUE path for the Timoni's runtime API version. RuntimePIVersionSelector Selector = "runtime.apiVersion" // RuntimeName is the CUE path for the Timoni's bundle name. RuntimeName Selector = "runtime.name" // RuntimeClustersSelector is the CUE path for the Timoni's runtime clusters. RuntimeClustersSelector Selector = "runtime.clusters" // RuntimeValuesSelector is the CUE path for the Timoni's runtime values. RuntimeValuesSelector Selector = "runtime.values" )
const BundleSchema = `` /* 576-byte string literal not displayed */
BundleSchema defines the v1alpha1 CUE schema for Timoni's bundle API. TODO: switch to go:embed when this is available https://github.com/cue-lang/cue/issues/607
const InstanceSchema = `` /* 133-byte string literal not displayed */
InstanceSchema defines the v1alpha1 CUE schema for Timoni's instance API.
const LatestVersion = "latest"
LatestVersion is the tag name that denotes the latest stable version of a module.
const RuntimeSchema = `` /* 569-byte string literal not displayed */
RuntimeSchema defines the v1alpha1 CUE schema for Timoni's runtime API.
Variables ¶
var ( // PruneAction is the annotation that defines if a Kubernetes resource should be garbage collected. PruneAction = fmt.Sprintf("action.%s/prune", GroupVersion.Group) // ForceAction is the annotation that defines if a Kubernetes resource should be recreated. ForceAction = fmt.Sprintf("action.%s/force", GroupVersion.Group) // IfNotPresentAction is the annotation that defines if a Kubernetes resource // should be applied only if it doesn't exist on the cluster. IfNotPresentAction = fmt.Sprintf("action.%s/one-off", GroupVersion.Group) // WaitAction is the annotation that defines if a Kubernetes resource should be included in the readiness check. WaitAction = fmt.Sprintf("action.%s/wait", GroupVersion.Group) )
var ( // GroupVersion is the group version of Timoni's APIs. GroupVersion = schema.GroupVersion{Group: "timoni.sh", Version: "v1alpha1"} // InstanceKind is the kind name of the Instance type. InstanceKind = "Instance" // InstanceStorageType is the name of the Kubernetes // Secret type used to store the instance metadata and inventory. InstanceStorageType = "timoni.sh/instance" // FieldManager is the name of the manager performing Kubernetes patch operations. FieldManager = "timoni" )
Functions ¶
func IsRuntimeAttribute ¶ added in v0.13.0
IsRuntimeAttribute returns true if the given CUE attribute matches the expected format.
Types ¶
type ArtifactReference ¶ added in v0.14.0
type ArtifactReference struct { // Repository is the OpenContainers artifact repo name in the format // 'oci://<reg.host>/<org>/<repo>'. Repository string `json:"repository"` // Tag is the OpenContainers artifact tag name. Tag string `json:"tag"` // Digest of the OpenContainers artifact in the format '<sha-type>:<hex>'. Digest string `json:"digest"` }
ArtifactReference contains the information necessary to locate an artifact in the container registry.
func (*ArtifactReference) DeepCopy ¶ added in v0.14.0
func (in *ArtifactReference) DeepCopy() *ArtifactReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArtifactReference.
func (*ArtifactReference) DeepCopyInto ¶ added in v0.14.0
func (in *ArtifactReference) DeepCopyInto(out *ArtifactReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Bundle ¶ added in v0.23.0
type Bundle struct { // Name is the name of the bundle. Name string `json:"name"` // Instances is a list of instances defined in the bundle. Instances []*BundleInstance `json:"instances"` }
Bundle holds the information about the bundle name and the list of instances. +k8s:deepcopy-gen=false
type BundleInstance ¶ added in v0.23.0
type BundleInstance struct { // Bundle is the name of the bundle this instance belongs to. Bundle string `json:"bundle"` // Cluster is the name of the cluster this instance belongs to. Cluster string `json:"cluster,omitempty"` // Name is the name of the instance. Name string `json:"name"` // Namespace is the namespace where the instance will be installed. Namespace string `json:"namespace"` // Module is a reference to the module's artifact in the registry. Module ModuleReference `json:"module"` // Values hold the user-supplied configuration of this instance. Values cue.Value `json:"values,omitempty"` }
BundleInstance holds the information about the instance name, namespace, module and values. +k8s:deepcopy-gen=false
type ImageReference ¶ added in v0.15.0
type ImageReference struct { Repository string `json:"repository"` Tag string `json:"tag"` Digest string `json:"digest"` Reference string `json:"reference"` }
ImageReference contains the information necessary to locate a container's OCI artifact in the registry.
func (*ImageReference) DeepCopy ¶ added in v0.15.0
func (in *ImageReference) DeepCopy() *ImageReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageReference.
func (*ImageReference) DeepCopyInto ¶ added in v0.15.0
func (in *ImageReference) DeepCopyInto(out *ImageReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Instance ¶
type Instance struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Module is a reference to the module's artifact in the registry. Module ModuleReference `json:"module"` // Values hold the user-supplied configuration of this instance. Values string `json:"values"` // LastTransitionTime is the timestamp (UTC RFC3339) of the last inventory change. // +optional LastTransitionTime string `json:"lastTransitionTime,omitempty"` // Inventory contains the list of Kubernetes resource object references. // +optional Inventory *ResourceInventory `json:"inventory,omitempty"` // Images contains the list of container image references. // +optional Images []string `json:"images,omitempty"` }
Instance holds the information about the module, values and the list of the managed Kubernetes resources.
func (*Instance) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance.
func (*Instance) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ModuleReference ¶
type ModuleReference struct { // Name of the module. Name string `json:"name"` // Repository is the OCI artifact or local repo name in the format // 'oci://<reg.host>/<org>/<repo>' or 'file://<path>'. Repository string `json:"repository"` // Version is the OCI artifact tag in strict semver format. Version string `json:"version"` // Digest of the OCI artifact in the format '<sha-type>:<hex>'. Digest string `json:"digest"` // Annotations of the OCI artifact. Annotations map[string]string `json:"annotations,omitempty"` }
ModuleReference contains the information necessary to locate a module's OCI artifact in the registry.
func (*ModuleReference) DeepCopy ¶
func (in *ModuleReference) DeepCopy() *ModuleReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleReference.
func (*ModuleReference) DeepCopyInto ¶
func (in *ModuleReference) DeepCopyInto(out *ModuleReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceInventory ¶
type ResourceInventory struct { // Entries of Kubernetes resource object references. Entries []ResourceRef `json:"entries"` }
ResourceInventory contains a list of Kubernetes resource object references managed by an Instance.
func (*ResourceInventory) DeepCopy ¶
func (in *ResourceInventory) DeepCopy() *ResourceInventory
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceInventory.
func (*ResourceInventory) DeepCopyInto ¶
func (in *ResourceInventory) DeepCopyInto(out *ResourceInventory)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceRef ¶
type ResourceRef struct { // ID is the string representation of the Kubernetes resource object's metadata, // in the format '<namespace>_<name>_<group>_<kind>'. ID string `json:"id"` // Version is the API version of the Kubernetes resource object's kind. Version string `json:"v"` }
ResourceRef contains the information necessary to locate a Kubernetes resource object within a cluster.
func (*ResourceRef) DeepCopy ¶
func (in *ResourceRef) DeepCopy() *ResourceRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef.
func (*ResourceRef) DeepCopyInto ¶
func (in *ResourceRef) DeepCopyInto(out *ResourceRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Runtime ¶ added in v0.13.0
type Runtime struct { // Name of the runtime. Name string `json:"name"` // Clusters is the list of Kubernetes // clusters belonging to this runtime. Clusters []RuntimeCluster `json:"clusters"` // Refs is the list of in-cluster resource references. Refs []RuntimeResourceRef `json:"refs"` }
Runtime holds the list of in-cluster resources and the CUE expressions for extracting specific fields values.
func DefaultRuntime ¶ added in v0.17.0
DefaultRuntime returns an empty Runtime with an unnamed cluster set to the specified context.
func (*Runtime) DeepCopy ¶ added in v0.13.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Runtime.
func (*Runtime) DeepCopyInto ¶ added in v0.13.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Runtime) SelectClusters ¶ added in v0.17.0
func (r *Runtime) SelectClusters(name, group string) []RuntimeCluster
SelectClusters returns the clusters matching the specified name and group. Both the name and group support the '*' wildcard.
type RuntimeAttribute ¶ added in v0.13.0
RuntimeAttribute holds the runtime var name and type.
func NewRuntimeAttribute ¶ added in v0.13.0
func NewRuntimeAttribute(key, body string) (*RuntimeAttribute, error)
NewRuntimeAttribute returns a RuntimeAttribute from the given CUE attribute. If the CUE attribute doesn't match the expected format '@timoni(runtime:[TYPE]:[NAME])', an error is returned.
func (*RuntimeAttribute) DeepCopy ¶ added in v0.13.0
func (in *RuntimeAttribute) DeepCopy() *RuntimeAttribute
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeAttribute.
func (*RuntimeAttribute) DeepCopyInto ¶ added in v0.13.0
func (in *RuntimeAttribute) DeepCopyInto(out *RuntimeAttribute)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RuntimeCluster ¶ added in v0.17.0
type RuntimeCluster struct { // Name of the cluster. Name string `json:"name"` // Group name of the cluster. Group string `json:"group"` // KubeContext is the name of kubeconfig context for this cluster. KubeContext string `json:"kubeContext"` }
RuntimeCluster holds the reference to a Kubernetes cluster.
func (*RuntimeCluster) DeepCopy ¶ added in v0.17.0
func (in *RuntimeCluster) DeepCopy() *RuntimeCluster
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeCluster.
func (*RuntimeCluster) DeepCopyInto ¶ added in v0.17.0
func (in *RuntimeCluster) DeepCopyInto(out *RuntimeCluster)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*RuntimeCluster) IsDefault ¶ added in v0.17.0
func (rt *RuntimeCluster) IsDefault() bool
IsDefault returns true if the given cluster was initialised by a Runtime with no target clusters.
func (*RuntimeCluster) NameGroupValues ¶ added in v0.17.0
func (rt *RuntimeCluster) NameGroupValues() map[string]string
NameGroupValues returns the cluster name and group variables as specified in the Runtime definition. If the given cluster was initialised by an empty Runtime, the returned map is empty.
type RuntimeResourceRef ¶ added in v0.13.0
type RuntimeResourceRef struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` Expressions map[string]string `json:"selector"` Optional bool `json:"optional"` }
RuntimeResourceRef holds the data needed to query the fields of a Kubernetes resource using CUE expressions.
func (*RuntimeResourceRef) DeepCopy ¶ added in v0.13.0
func (in *RuntimeResourceRef) DeepCopy() *RuntimeResourceRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeResourceRef.
func (*RuntimeResourceRef) DeepCopyInto ¶ added in v0.13.0
func (in *RuntimeResourceRef) DeepCopyInto(out *RuntimeResourceRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RuntimeValue ¶ added in v0.13.0
type RuntimeValue struct { // Query in the format 'k8s:<apiVersion>:<kind>:<namespace>:<name>'. Query string `json:"query"` // For is a map with key values in the format '<name>: <CUE expression>'. For map[string]string `json:"for"` // Optional is a flag for ignoring not found resources. Optional bool `json:"optional"` }
RuntimeValue holds the query information for in-cluster values.
func (*RuntimeValue) DeepCopy ¶ added in v0.13.0
func (in *RuntimeValue) DeepCopy() *RuntimeValue
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeValue.
func (*RuntimeValue) DeepCopyInto ¶ added in v0.13.0
func (in *RuntimeValue) DeepCopyInto(out *RuntimeValue)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*RuntimeValue) ToResourceRef ¶ added in v0.13.0
func (rv *RuntimeValue) ToResourceRef() (*RuntimeResourceRef, error)
ToResourceRef converts the RuntimeValue to a RuntimeResourceRef by parsing the query data.
type Selector ¶ added in v0.0.6
type Selector string
Selector is an enumeration of the supported CUE paths known to Timoni.
const ( // BundleAPIVersionSelector is the CUE path for the Timoni's bundle API version. BundleAPIVersionSelector Selector = "bundle.apiVersion" // BundleName is the CUE path for the Timoni's bundle name. BundleName Selector = "bundle.name" // BundleInstancesSelector is the CUE path for the Timoni's bundle instances. BundleInstancesSelector Selector = "bundle.instances" // BundleModuleURLSelector is the CUE path for the Timoni's bundle module url. BundleModuleURLSelector Selector = "module.url" // BundleModuleVersionSelector is the CUE path for the Timoni's bundle module version. BundleModuleVersionSelector Selector = "module.version" // BundleModuleDigestSelector is the CUE path for the Timoni's bundle module digest. BundleModuleDigestSelector Selector = "module.digest" // BundleNamespaceSelector is the CUE path for the Timoni's bundle instance namespace. BundleNamespaceSelector Selector = "namespace" // BundleValuesSelector is the CUE path for the Timoni's bundle instance values. BundleValuesSelector Selector = "values" // BundleNameLabelKey is the Kubernetes label key for tracking Timoni's bundle by name. BundleNameLabelKey = "bundle.timoni.sh/name" )
const ( // APIVersionSelector is the CUE path for the Timoni's API version. APIVersionSelector Selector = "timoni.apiVersion" // InstanceSelector is the CUE path for the Timoni's instance. InstanceSelector Selector = "timoni.instance" // ConfigValuesSelector is the CUE path for the Timoni's instance config. ConfigValuesSelector Selector = "timoni.instance.config" // ApplySelector is the CUE path for the Timoni's apply resource sets. ApplySelector Selector = "timoni.apply" // ValuesSelector is the CUE path for the Timoni's module values. ValuesSelector Selector = "values" )