kinds

package
v0.0.0-...-88a9ed4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package kinds is the internal version of the API.

Index

Constants

View Source
const GrafanaResourceCleanupFinalizer = "cleanup.kinds.grafana.com"

GrafanaResourceCleanupFinalizer is the name of the finalizer which will delete instances of a GrafanaResourceDefinition

View Source
const GroupName = "kinds.grafana.com"
View Source
const (
	// KubeAPIApprovedAnnotation is an annotation that must be set to create a GRD for the k8s.io, *.k8s.io, kubernetes.io, or *.kubernetes.io namespaces.
	// The value should be a link to a URL where the current spec was approved, so updates to the spec should also update the URL.
	// If the API is unapproved, you may set the annotation to a string starting with `"unapproved"`.  For instance, `"unapproved, temporarily squatting"` or `"unapproved, experimental-only"`.  This is discouraged.
	KubeAPIApprovedAnnotation = "api-approved.kubernetes.io"
)

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}

SchemeGroupVersion is group version used to register these objects

Functions

func GRDHasFinalizer

func GRDHasFinalizer(grd *GrafanaResourceDefinition, needle string) bool

GRDHasFinalizer returns true if the finalizer is in the list.

func GRDRemoveFinalizer

func GRDRemoveFinalizer(grd *GrafanaResourceDefinition, needle string)

GRDRemoveFinalizer removes the finalizer if present.

func GetGRDStorageVersion

func GetGRDStorageVersion(grd *GrafanaResourceDefinition) (string, error)

GetGRDStorageVersion returns the storage version for given GRD.

func HasPerVersionColumns

func HasPerVersionColumns(versions []GrafanaResourceDefinitionVersion) bool

HasPerVersionColumns returns true if a GRD uses per-version columns.

func HasPerVersionSchema

func HasPerVersionSchema(versions []GrafanaResourceDefinitionVersion) bool

HasPerVersionSchema returns true if a GRD uses per-version schema.

func HasPerVersionSubresources

func HasPerVersionSubresources(versions []GrafanaResourceDefinitionVersion) bool

HasPerVersionSubresources returns true if a GRD uses per-version subresources.

func HasServedGRDVersion

func HasServedGRDVersion(grd *GrafanaResourceDefinition, version string) bool

HasServedGRDVersion returns true if the given version is in the list of GRD's versions and the Served flag is set.

func HasVersionServed

func HasVersionServed(grd *GrafanaResourceDefinition, version string) bool

HasVersionServed returns true if given GRD has given version served.

func IsGRDConditionEquivalent

func IsGRDConditionEquivalent(lhs, rhs *GrafanaResourceDefinitionCondition) bool

IsGRDConditionEquivalent returns true if the lhs and rhs are equivalent except for times.

func IsGRDConditionFalse

func IsGRDConditionFalse(grd *GrafanaResourceDefinition, conditionType GrafanaResourceDefinitionConditionType) bool

IsGRDConditionFalse indicates if the condition is present and false.

func IsGRDConditionPresentAndEqual

func IsGRDConditionPresentAndEqual(grd *GrafanaResourceDefinition, conditionType GrafanaResourceDefinitionConditionType, status ConditionStatus) bool

IsGRDConditionPresentAndEqual indicates if the condition is present and equal to the given status.

func IsGRDConditionTrue

func IsGRDConditionTrue(grd *GrafanaResourceDefinition, conditionType GrafanaResourceDefinitionConditionType) bool

IsGRDConditionTrue indicates if the condition is present and strictly true.

func IsStoredVersion

func IsStoredVersion(grd *GrafanaResourceDefinition, version string) bool

IsStoredVersion returns whether the given version is the storage version of the GRD.

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func RemoveGRDCondition

func RemoveGRDCondition(grd *GrafanaResourceDefinition, conditionType GrafanaResourceDefinitionConditionType)

RemoveGRDCondition removes the status condition.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns back a Group qualified GroupResource

func SetGRDCondition

func SetGRDCondition(grd *GrafanaResourceDefinition, newCondition GrafanaResourceDefinitionCondition)

SetGRDCondition sets the status condition. It either overwrites the existing one or creates a new one.

Types

type ConditionStatus

type ConditionStatus string
const (
	ConditionTrue    ConditionStatus = "True"
	ConditionFalse   ConditionStatus = "False"
	ConditionUnknown ConditionStatus = "Unknown"
)

These are valid condition statuses. "ConditionTrue" means a resource is in the condition. "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes can't decide if a resource is in the condition or not. In the future, we could add other intermediate conditions, e.g. ConditionDegraded.

type GrafanaResourceDefinition

type GrafanaResourceDefinition struct {
	metav1.TypeMeta
	metav1.ObjectMeta

	// Spec describes how the user wants the resources to appear
	Spec GrafanaResourceDefinitionSpec
	// Status indicates the actual state of the GrafanaResourceDefinition
	Status GrafanaResourceDefinitionStatus
}

GrafanaResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format <.spec.name>.<.spec.group>.

func (*GrafanaResourceDefinition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinition.

func (*GrafanaResourceDefinition) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GrafanaResourceDefinition) DeepCopyObject

func (in *GrafanaResourceDefinition) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GrafanaResourceDefinitionCondition

type GrafanaResourceDefinitionCondition struct {
	// Type is the type of the condition. Types include Established, NamesAccepted and Terminating.
	Type GrafanaResourceDefinitionConditionType
	// Status is the status of the condition.
	// Can be True, False, Unknown.
	Status ConditionStatus
	// Last time the condition transitioned from one status to another.
	// +optional
	LastTransitionTime metav1.Time
	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string
	// Human-readable message indicating details about last transition.
	// +optional
	Message string
}

GrafanaResourceDefinitionCondition contains details for the current condition of this pod.

func FindGRDCondition

FindGRDCondition returns the condition you're looking for or nil.

func (*GrafanaResourceDefinitionCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionCondition.

func (*GrafanaResourceDefinitionCondition) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceDefinitionConditionType

type GrafanaResourceDefinitionConditionType string

GrafanaResourceDefinitionConditionType is a valid value for GrafanaResourceDefinitionCondition.Type

const (
	// Established means that the resource has become active. A resource is established when all names are
	// accepted without a conflict for the first time. A resource stays established until deleted, even during
	// a later NamesAccepted due to changed names. Note that not all names can be changed.
	Established GrafanaResourceDefinitionConditionType = "Established"
	// NamesAccepted means the names chosen for this GrafanaResourceDefinition do not conflict with others in
	// the group and are therefore accepted.
	NamesAccepted GrafanaResourceDefinitionConditionType = "NamesAccepted"
	// NonStructuralSchema means that one or more OpenAPI schema is not structural.
	//
	// A schema is structural if it specifies types for all values, with the only exceptions of those with
	// - x-kubernetes-int-or-string: true — for fields which can be integer or string
	// - x-kubernetes-preserve-unknown-fields: true — for raw, unspecified JSON values
	// and there is no type, additionalProperties, default, nullable or x-kubernetes-* vendor extenions
	// specified under allOf, anyOf, oneOf or not.
	//
	// Non-structural schemas will not be allowed anymore in v1 API groups. Moreover, new features will not be
	// available for non-structural GRDs:
	// - pruning
	// - defaulting
	// - read-only
	// - OpenAPI publishing
	// - webhook conversion
	NonStructuralSchema GrafanaResourceDefinitionConditionType = "NonStructuralSchema"
	// Terminating means that the GrafanaResourceDefinition has been deleted and is cleaning up.
	Terminating GrafanaResourceDefinitionConditionType = "Terminating"
	// KubernetesAPIApprovalPolicyConformant indicates that an API in *.k8s.io or *.kubernetes.io is or is not approved.  For GRDs
	// outside those groups, this condition will not be set.  For GRDs inside those groups, the condition will
	// be true if .metadata.annotations["api-approved.kubernetes.io"] is set to a URL, otherwise it will be false.
	// See https://github.com/kubernetes/enhancements/pull/1111 for more details.
	KubernetesAPIApprovalPolicyConformant GrafanaResourceDefinitionConditionType = "KubernetesAPIApprovalPolicyConformant"
)

type GrafanaResourceDefinitionList

type GrafanaResourceDefinitionList struct {
	metav1.TypeMeta
	metav1.ListMeta

	// Items individual GrafanaResourceDefinitions
	Items []GrafanaResourceDefinition
}

GrafanaResourceDefinitionList is a list of GrafanaResourceDefinition objects.

func (*GrafanaResourceDefinitionList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionList.

func (*GrafanaResourceDefinitionList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GrafanaResourceDefinitionList) DeepCopyObject

func (in *GrafanaResourceDefinitionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GrafanaResourceDefinitionNames

type GrafanaResourceDefinitionNames struct {
	// Plural is the plural name of the resource to serve.  It must match the name of the GrafanaResourceDefinition-registration
	// too: plural.group and it must be all lowercase.
	Plural string
	// Singular is the singular name of the resource.  It must be all lowercase  Defaults to lowercased <kind>
	Singular string
	// ShortNames are short names for the resource.  It must be all lowercase.
	ShortNames []string
	// Kind is the serialized kind of the resource.  It is normally CamelCase and singular.
	Kind string
	// ListKind is the serialized kind of the list for this resource.  Defaults to <kind>List.
	ListKind string
	// Categories is a list of grouped resources custom resources belong to (e.g. 'all')
	// +optional
	Categories []string
}

GrafanaResourceDefinitionNames indicates the names to serve this GrafanaResourceDefinition

func (*GrafanaResourceDefinitionNames) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionNames.

func (*GrafanaResourceDefinitionNames) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceDefinitionSpec

type GrafanaResourceDefinitionSpec struct {
	// Group is the group this resource belongs in
	Group string
	// Version is the version this resource belongs in
	// Should be always first item in Versions field if provided.
	// Optional, but at least one of Version or Versions must be set.
	// Deprecated: Please use `Versions`.
	Version string
	// Names are the names used to describe this custom resource
	Names GrafanaResourceDefinitionNames
	// Scope indicates whether this resource is cluster or namespace scoped.  Default is namespaced
	Scope ResourceScope
	// Subresources describes the subresources for GrafanaResource
	// Optional, the global subresources for all versions.
	// Top-level and per-version subresources are mutually exclusive.
	// +optional
	Subresources *GrafanaResourceSubresources
	// Versions is the list of all supported versions for this resource.
	// If Version field is provided, this field is optional.
	// Validation: All versions must use the same validation schema for now. i.e., top
	// level Validation field is applied to all of these versions.
	// Order: The version name will be used to compute the order.
	// If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered
	// lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version),
	// then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first
	// by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing
	// major version, then minor version. An example sorted list of versions:
	// v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.
	Versions []GrafanaResourceDefinitionVersion

	// preserveUnknownFields disables pruning of object fields which are not
	// specified in the OpenAPI schema. apiVersion, kind, metadata and known
	// fields inside metadata are always preserved.
	// Defaults to true in v1beta and will default to false in v1.
	PreserveUnknownFields *bool
}

GrafanaResourceDefinitionSpec describes how a user wants their resource to appear

func (*GrafanaResourceDefinitionSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionSpec.

func (*GrafanaResourceDefinitionSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceDefinitionStatus

type GrafanaResourceDefinitionStatus struct {
	// Conditions indicate state for particular aspects of a GrafanaResourceDefinition
	// +listType=map
	// +listMapKey=type
	Conditions []GrafanaResourceDefinitionCondition

	// AcceptedNames are the names that are actually being used to serve discovery
	// They may be different than the names in spec.
	AcceptedNames GrafanaResourceDefinitionNames

	// StoredVersions are all versions of GrafanaResources that were ever persisted. Tracking these
	// versions allows a migration path for stored versions in etcd. The field is mutable
	// so the migration controller can first finish a migration to another version (i.e.
	// that no old objects are left in the storage), and then remove the rest of the
	// versions from this list.
	// None of the versions in this list can be removed from the spec.Versions field.
	StoredVersions []string
}

GrafanaResourceDefinitionStatus indicates the state of the GrafanaResourceDefinition

func (*GrafanaResourceDefinitionStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionStatus.

func (*GrafanaResourceDefinitionStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceDefinitionVersion

type GrafanaResourceDefinitionVersion struct {
	// Name is the version name, e.g. “v1”, “v2beta1”, etc.
	Name string
	// Served is a flag enabling/disabling this version from being served via REST APIs
	Served bool
	// Storage flags the version as storage version. There must be exactly one flagged
	// as storage version.
	Storage bool
	// deprecated indicates this version of the custom resource API is deprecated.
	// When set to true, API requests to this version receive a warning header in the server response.
	// Defaults to false.
	Deprecated bool
	// deprecationWarning overrides the default warning returned to API clients.
	// May only be set when `deprecated` is true.
	// The default warning indicates this version is deprecated and recommends use
	// of the newest served version of equal or greater stability, if one exists.
	DeprecationWarning *string
	// Subresources describes the subresources for GrafanaResource
	// Top-level and per-version subresources are mutually exclusive.
	// Per-version subresources must not all be set to identical values (top-level subresources should be used instead)
	// This field is alpha-level and is only honored by servers that enable the GrafanaResourceWebhookConversion feature.
	// +optional
	Subresources *GrafanaResourceSubresources
}

GrafanaResourceDefinitionVersion describes a version for GRD.

func (*GrafanaResourceDefinitionVersion) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceDefinitionVersion.

func (*GrafanaResourceDefinitionVersion) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceSubresourceHistory

type GrafanaResourceSubresourceHistory struct{}

func (*GrafanaResourceSubresourceHistory) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceSubresourceHistory.

func (*GrafanaResourceSubresourceHistory) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceSubresourceRef

type GrafanaResourceSubresourceRef struct{}

func (*GrafanaResourceSubresourceRef) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceSubresourceRef.

func (*GrafanaResourceSubresourceRef) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceSubresourceScale

type GrafanaResourceSubresourceScale struct {
	// SpecReplicasPath defines the JSON path inside of a GrafanaResource that corresponds to Scale.Spec.Replicas.
	// Only JSON paths without the array notation are allowed.
	// Must be a JSON Path under .spec.
	// If there is no value under the given path in the GrafanaResource, the /scale subresource will return an error on GET.
	SpecReplicasPath string
	// StatusReplicasPath defines the JSON path inside of a GrafanaResource that corresponds to Scale.Status.Replicas.
	// Only JSON paths without the array notation are allowed.
	// Must be a JSON Path under .status.
	// If there is no value under the given path in the GrafanaResource, the status replica value in the /scale subresource
	// will default to 0.
	StatusReplicasPath string
	// LabelSelectorPath defines the JSON path inside of a GrafanaResource that corresponds to Scale.Status.Selector.
	// Only JSON paths without the array notation are allowed.
	// Must be a JSON Path under .status or .spec.
	// Must be set to work with HPA.
	// The field pointed by this JSON path must be a string field (not a complex selector struct)
	// which contains a serialized label selector in string form.
	// More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource
	// If there is no value under the given path in the GrafanaResource, the status label selector value in the /scale
	// subresource will default to the empty string.
	// +optional
	LabelSelectorPath *string
}

GrafanaResourceSubresourceScale defines how to serve the scale subresource for GrafanaResources.

func (*GrafanaResourceSubresourceScale) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceSubresourceScale.

func (*GrafanaResourceSubresourceScale) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceSubresourceStatus

type GrafanaResourceSubresourceStatus struct{}

GrafanaResourceSubresourceStatus defines how to serve the status subresource for GrafanaResources. Status is represented by the `.status` JSON path inside of a GrafanaResource. When set, * exposes a /status subresource for the custom resource * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza

func (*GrafanaResourceSubresourceStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceSubresourceStatus.

func (*GrafanaResourceSubresourceStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GrafanaResourceSubresources

type GrafanaResourceSubresources struct {
	// Status denotes the status subresource for GrafanaResources
	Status *GrafanaResourceSubresourceStatus
	// Scale denotes the scale subresource for GrafanaResources
	Scale *GrafanaResourceSubresourceScale

	History *GrafanaResourceSubresourceHistory
	Ref     *GrafanaResourceSubresourceRef
}

GrafanaResourceSubresources defines the status and scale subresources for GrafanaResources.

func GetSubresourcesForVersion

func GetSubresourcesForVersion(grd *GrafanaResourceDefinition, version string) (*GrafanaResourceSubresources, error)

GetSubresourcesForVersion returns the subresources for given version or nil.

func (*GrafanaResourceSubresources) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaResourceSubresources.

func (*GrafanaResourceSubresources) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceScope

type ResourceScope string

ResourceScope is an enum defining the different scopes available to a custom resource

const (
	ClusterScoped   ResourceScope = "Cluster"
	NamespaceScoped ResourceScope = "Namespaced"
)

Directories

Path Synopsis
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.

Jump to

Keyboard shortcuts

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