Documentation ¶
Index ¶
- Constants
- func CheckPermission(ctx context.Context, client kubernetes.Interface, ...) (bool, error)
- func ConfigureResource(resourceQty string, list corev1.ResourceList, name corev1.ResourceName) (corev1.ResourceList, error)
- func DefaultOperatorSecurityContext() *corev1.SecurityContext
- func FilterCamelCreatorLabels(source map[string]string) map[string]string
- func GetBuild(context context.Context, client client.Client, name string, namespace string) (*v1.Build, error)
- func GetCamelCatalog(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.CamelCatalog, error)
- func GetCamelCreator(obj runtime.Object) *corev1.ObjectReference
- func GetConfigMap(context context.Context, client ctrl.Reader, name string, namespace string) (*corev1.ConfigMap, error)
- func GetConfigMapRefValue(ctx context.Context, client ctrl.Reader, namespace string, ...) (string, error)
- func GetDeploymentCondition(deployment appsv1.Deployment, conditionType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition
- func GetIntegrationKit(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.IntegrationKit, error)
- func GetIntegrationPlatform(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.IntegrationPlatform, error)
- func GetIntegrationProfile(context context.Context, client ctrl.Reader, name string, namespace string) (*v1.IntegrationProfile, error)
- func GetJobCondition(job batchv1.Job, conditionType batchv1.JobConditionType) *batchv1.JobCondition
- func GetKnativeServiceCondition(service servingv1.Service, conditionType knative.ConditionType) *knative.Condition
- func GetPodCondition(pod corev1.Pod, conditionType corev1.PodConditionType) *corev1.PodCondition
- func GetSecret(context context.Context, client ctrl.Reader, name string, namespace string) (*corev1.Secret, error)
- func GetSecretRefData(ctx context.Context, client ctrl.Reader, namespace string, ...) ([]byte, error)
- func GetSecretRefValue(ctx context.Context, client ctrl.Reader, namespace string, ...) (string, error)
- func GetSecretsRefData(ctx context.Context, client ctrl.Reader, namespace string, ...) ([][]byte, error)
- func GetUnstructured(context context.Context, client ctrl.Reader, gvk schema.GroupVersionKind, ...) (*unstructured.Unstructured, error)
- func IsAPIResourceInstalled(c kubernetes.Interface, groupVersion string, kind string) (bool, error)
- func IsUnknownAPIError(err error) bool
- func LoadResourceFromYaml(scheme *runtime.Scheme, data string) (ctrl.Object, error)
- func LoadUnstructuredFromYaml(data string) (ctrl.Object, error)
- func LookupConfigmap(ctx context.Context, c client.Client, ns string, name string) *corev1.ConfigMap
- func LookupDefaultStorageClass(ctx context.Context, c client.Client) (*storagev1.StorageClass, error)
- func LookupPersistentVolumeClaim(ctx context.Context, c client.Client, ns string, name string) (*corev1.PersistentVolumeClaim, error)
- func LookupResourceVersion(ctx context.Context, c client.Client, object ctrl.Object) string
- func LookupSecret(ctx context.Context, c client.Client, ns string, name string) *corev1.Secret
- func LookupStorageClass(ctx context.Context, c client.Client, ns string, name string) (*storagev1.StorageClass, error)
- func MergeCamelCreatorLabels(source map[string]string, target map[string]string) map[string]string
- func NewConfigMap(namespace, cmName, originalFilename string, generatedKey string, ...) *corev1.ConfigMap
- func NewNodeSelectors(nsArray []string) (map[string]string, error)
- func NewPersistentVolumeClaim(ns, name, storageClassName string, capacityStorage resource.Quantity, ...) *corev1.PersistentVolumeClaim
- func NewResourceRequirements(reqs []string) (corev1.ResourceRequirements, error)
- func NewTolerations(taints []string) ([]corev1.Toleration, error)
- func PortForward(ctx context.Context, c client.Client, ns, labelSelector string, ...) error
- func ReplaceResource(ctx context.Context, c client.Client, res ctrl.Object) (bool, error)
- func ResolveValueSource(ctx context.Context, client ctrl.Reader, namespace string, ...) (string, error)
- func SanitizeLabel(name string) string
- func SanitizeName(name string) string
- func ToJSON(value runtime.Object) ([]byte, error)
- func ToYAML(value runtime.Object) ([]byte, error)
- func ToYAMLNoManagedFields(value runtime.Object) ([]byte, error)
- type CLIPrinter
- type Collection
- func (c *Collection) Add(resource ctrl.Object)
- func (c *Collection) AddAll(resource []ctrl.Object)
- func (c *Collection) AddFirst(resource ctrl.Object)
- func (c *Collection) AsKubernetesList() *corev1.List
- func (c *Collection) GetConfigMap(filter func(*corev1.ConfigMap) bool) *corev1.ConfigMap
- func (c *Collection) GetContainer(filter func(container *corev1.Container) bool) *corev1.Container
- func (c *Collection) GetContainerByName(name string) *corev1.Container
- func (c *Collection) GetController(filter func(object ctrl.Object) bool) ctrl.Object
- func (c *Collection) GetCronJob(filter func(job *batchv1.CronJob) bool) *batchv1.CronJob
- func (c *Collection) GetDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment
- func (c *Collection) GetDeploymentForIntegration(integration *v1.Integration) *appsv1.Deployment
- func (c *Collection) GetKnativeService(filter func(*serving.Service) bool) *serving.Service
- func (c *Collection) GetKnativeSubscription(filter func(subscription *messaging.Subscription) bool) *messaging.Subscription
- func (c *Collection) GetKnativeTrigger(filter func(*eventing.Trigger) bool) *eventing.Trigger
- func (c *Collection) GetPodMonitor(filter func(*monitoringv1.PodMonitor) bool) *monitoringv1.PodMonitor
- func (c *Collection) GetRoute(filter func(*routev1.Route) bool) *routev1.Route
- func (c *Collection) GetSecret(filter func(*corev1.Secret) bool) *corev1.Secret
- func (c *Collection) GetService(filter func(*corev1.Service) bool) *corev1.Service
- func (c *Collection) GetServiceForIntegration(integration *v1.Integration) *corev1.Service
- func (c *Collection) GetUserServiceForIntegration(integration *v1.Integration) *corev1.Service
- func (c *Collection) HasDeployment(filter func(*appsv1.Deployment) bool) bool
- func (c *Collection) HasKnativeTrigger(filter func(trigger *eventing.Trigger) bool) bool
- func (c *Collection) Items() []ctrl.Object
- func (c *Collection) Remove(selector func(runtime.Object) bool) runtime.Object
- func (c *Collection) RemoveConfigMap(filter func(*corev1.ConfigMap) bool) *corev1.ConfigMap
- func (c *Collection) RemoveDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment
- func (c *Collection) Size() int
- func (c *Collection) Visit(visitor func(runtime.Object))
- func (c *Collection) VisitConfigMap(visitor func(*corev1.ConfigMap))
- func (c *Collection) VisitContainer(visitor func(container *corev1.Container))
- func (c *Collection) VisitCronJob(visitor func(*batchv1.CronJob))
- func (c *Collection) VisitCronJobE(visitor func(*batchv1.CronJob) error) error
- func (c *Collection) VisitDeployment(visitor func(*appsv1.Deployment))
- func (c *Collection) VisitDeploymentE(visitor func(*appsv1.Deployment) error) error
- func (c *Collection) VisitE(visitor func(runtime.Object) error) error
- func (c *Collection) VisitKnativeConfigurationSpec(visitor func(container *serving.ConfigurationSpec))
- func (c *Collection) VisitKnativeService(visitor func(*serving.Service))
- func (c *Collection) VisitKnativeServiceE(visitor func(*serving.Service) error) error
- func (c *Collection) VisitKnativeSubscription(visitor func(trigger *messaging.Subscription))
- func (c *Collection) VisitKnativeTrigger(visitor func(trigger *eventing.Trigger))
- func (c *Collection) VisitMetaObject(visitor func(metav1.Object))
- func (c *Collection) VisitPodMonitor(visitor func(*monitoringv1.PodMonitor))
- func (c *Collection) VisitPodSpec(visitor func(container *corev1.PodSpec))
- func (c *Collection) VisitPodTemplateMeta(visitor func(meta *metav1.ObjectMeta))
- func (c *Collection) VisitRoute(visitor func(*routev1.Route))
- func (c *Collection) VisitSecret(visitor func(*corev1.Secret))
- func (c *Collection) VisitService(visitor func(*corev1.Service))
Constants ¶
const ( CamelCreatorLabelPrefix = "camel.apache.org/created.by" CamelClonedLabelPrefix = "camel.apache.org/cloned.from" CamelCreatorLabelKind = CamelCreatorLabelPrefix + ".kind" CamelCreatorLabelName = CamelCreatorLabelPrefix + ".name" CamelCreatorLabelNamespace = CamelCreatorLabelPrefix + ".namespace" CamelCreatorLabelVersion = CamelCreatorLabelPrefix + ".version" CamelClonedLabelKind = CamelClonedLabelPrefix + ".kind" CamelClonedLabelName = CamelClonedLabelPrefix + ".name" CamelClonedLabelNamespace = CamelClonedLabelPrefix + ".namespace" CamelClonedLabelVersion = CamelClonedLabelPrefix + ".version" CamelLabelRuntimeVersion = "camel.apache.org/runtime.version" CamelLabelRuntimeProvider = "camel.apache.org/runtime.provider" )
const ConfigMapAutogenLabel = "camel.apache.org/generated"
ConfigMapAutogenLabel -- .
const ConfigMapOriginalFileNameLabel = "camel.apache.org/filename"
ConfigMapOriginalFileNameLabel -- .
const ConfigMapTypeLabel = "camel.apache.org/config.type"
ConfigMapTypeLabel -- .
Variables ¶
This section is empty.
Functions ¶
func CheckPermission ¶
func CheckPermission(ctx context.Context, client kubernetes.Interface, group, resource, namespace, name, verb string) (bool, error)
CheckPermission can be used to check if the current user/service-account is allowed to execute a given operation in the cluster. E.g. checkPermission(client, olmv1alpha1.GroupName, "clusterserviceversions", namespace, "camel-k", "get").
func ConfigureResource ¶
func ConfigureResource(resourceQty string, list corev1.ResourceList, name corev1.ResourceName) (corev1.ResourceList, error)
ConfigureResource will set a resource on the specified resource list or returns an error.
func DefaultOperatorSecurityContext ¶ added in v2.1.0
func DefaultOperatorSecurityContext() *corev1.SecurityContext
DefaultOperatorSecurityContext to ensure a container with low privilege and limited permissions.
func FilterCamelCreatorLabels ¶
FilterCamelCreatorLabels is used to inherit the creator information among resources.
func GetCamelCatalog ¶
func GetCamelCreator ¶
func GetCamelCreator(obj runtime.Object) *corev1.ObjectReference
GetCamelCreator returns the Camel creator object referenced by this runtime object, if present.
func GetConfigMap ¶
func GetConfigMapRefValue ¶
func GetConfigMapRefValue(ctx context.Context, client ctrl.Reader, namespace string, selector *corev1.ConfigMapKeySelector) (string, error)
GetConfigMapRefValue returns the value of a configmap in the supplied namespace.
func GetDeploymentCondition ¶
func GetDeploymentCondition(deployment appsv1.Deployment, conditionType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition
func GetIntegrationKit ¶
func GetIntegrationPlatform ¶
func GetIntegrationProfile ¶ added in v2.3.0
func GetJobCondition ¶
func GetJobCondition(job batchv1.Job, conditionType batchv1.JobConditionType) *batchv1.JobCondition
func GetPodCondition ¶
func GetPodCondition(pod corev1.Pod, conditionType corev1.PodConditionType) *corev1.PodCondition
func GetSecretRefData ¶
func GetSecretRefData(ctx context.Context, client ctrl.Reader, namespace string, selector *corev1.SecretKeySelector) ([]byte, error)
GetSecretRefData returns the value of a secret in the supplied namespace.
func GetSecretRefValue ¶
func GetSecretRefValue(ctx context.Context, client ctrl.Reader, namespace string, selector *corev1.SecretKeySelector) (string, error)
GetSecretRefValue returns the value of a secret in the supplied namespace.
func GetSecretsRefData ¶
func GetSecretsRefData(ctx context.Context, client ctrl.Reader, namespace string, selector []corev1.SecretKeySelector) ([][]byte, error)
GetSecretsRefData returns the value of the secrets in the supplied namespace.
func GetUnstructured ¶
func GetUnstructured(context context.Context, client ctrl.Reader, gvk schema.GroupVersionKind, name string, namespace string) (*unstructured.Unstructured, error)
GetUnstructured provides a generic unstructured K8S object. Useful in order to retrieve a non cached version of an object.
func IsAPIResourceInstalled ¶
func IsUnknownAPIError ¶
IsUnknownAPIError checks if the given error is due to some missing APIs in the cluster. Apparently there's no such method in Kubernetes Go API.
func LoadResourceFromYaml ¶
LoadResourceFromYaml returns a Kubernetes resource from its serialized YAML definition.
func LoadUnstructuredFromYaml ¶
LoadUnstructuredFromYaml returns an unstructured resource from its serialized YAML definition.
func LookupConfigmap ¶
func LookupConfigmap(ctx context.Context, c client.Client, ns string, name string) *corev1.ConfigMap
LookupConfigmap will look for any k8s Configmap with a given name in a given namespace. Deprecated: won't be supported in future releases.
func LookupDefaultStorageClass ¶
func LookupDefaultStorageClass(ctx context.Context, c client.Client) (*storagev1.StorageClass, error)
LookupDefaultStorageClass will look for the default k8s StorageClass in the cluster.
func LookupPersistentVolumeClaim ¶
func LookupPersistentVolumeClaim(ctx context.Context, c client.Client, ns string, name string) (*corev1.PersistentVolumeClaim, error)
LookupPersistentVolumeClaim will look for any k8s PersistentVolumeClaim with a given name in a given namespace.
func LookupResourceVersion ¶ added in v2.3.0
LookupResourceVersion will look for any k8s resource with a given name in a given namespace, returning its resource version only. It makes this safe against any resource that the operator is not allowed to inspect.
func LookupSecret ¶
LookupSecret will look for any k8s Secret with a given name in a given namespace. Deprecated: won't be supported in future releases.
func LookupStorageClass ¶ added in v2.5.0
func LookupStorageClass(ctx context.Context, c client.Client, ns string, name string) (*storagev1.StorageClass, error)
LookupStorageClass will look for any k8s StorageClass with a given name in a given namespace.
func MergeCamelCreatorLabels ¶
MergeCamelCreatorLabels is used to inject the creator information from another set of labels.
func NewConfigMap ¶
func NewConfigMap(namespace, cmName, originalFilename string, generatedKey string, textData string, binaryData []byte) *corev1.ConfigMap
NewConfigMap will create a ConfigMap.
func NewNodeSelectors ¶
NewNodeSelectors build a map of NodeSelectors from an array of string.
func NewPersistentVolumeClaim ¶
func NewPersistentVolumeClaim( ns, name, storageClassName string, capacityStorage resource.Quantity, accessMode corev1.PersistentVolumeAccessMode) *corev1.PersistentVolumeClaim
NewPersistentVolumeClaim will create a NewPersistentVolumeClaim based on a StorageClass.
func NewResourceRequirements ¶
func NewResourceRequirements(reqs []string) (corev1.ResourceRequirements, error)
NewResourceRequirements will build a CPU and memory requirements from an array of requests matching <requestType.requestResource=value> (ie, limits.memory=256Mi).
func NewTolerations ¶
func NewTolerations(taints []string) ([]corev1.Toleration, error)
NewTolerations build an array of Tolerations from an array of string.
func PortForward ¶
func ReplaceResource ¶
ReplaceResource allows to completely replace a resource on Kubernetes, taking care of immutable fields and resource versions.
func ResolveValueSource ¶
func SanitizeLabel ¶
SanitizeLabel sanitizes the given name to be compatible with k8s.
func SanitizeName ¶
SanitizeName sanitizes the given name to be compatible with k8s.
Types ¶
type CLIPrinter ¶
type CLIPrinter struct { // It accepts either yaml or json format Format string }
CLIPrinter is delegated to print the runtime object.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
A Collection is a container of Kubernetes resources.
func NewCollection ¶
func NewCollection(objects ...ctrl.Object) *Collection
NewCollection creates a new empty collection.
func (*Collection) Add ¶
func (c *Collection) Add(resource ctrl.Object)
Add adds a resource to the collection.
func (*Collection) AddAll ¶
func (c *Collection) AddAll(resource []ctrl.Object)
AddAll adds all resources to the collection.
func (*Collection) AddFirst ¶
func (c *Collection) AddFirst(resource ctrl.Object)
AddFirst adds a resource to the head of the collection.
func (*Collection) AsKubernetesList ¶
func (c *Collection) AsKubernetesList() *corev1.List
AsKubernetesList returns all resources wrapped in a Kubernetes list.
func (*Collection) GetConfigMap ¶
GetConfigMap returns a ConfigMap that matches the given function.
func (*Collection) GetContainer ¶
GetContainer --.
func (*Collection) GetContainerByName ¶
func (c *Collection) GetContainerByName(name string) *corev1.Container
GetContainerByName --.
func (*Collection) GetController ¶
GetController returns the controller associated with the integration (e.g. Deployment, Knative Service or CronJob).
func (*Collection) GetCronJob ¶
GetCronJob returns a CronJob that matches the given function.
func (*Collection) GetDeployment ¶
func (c *Collection) GetDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment
GetDeployment returns a Deployment that matches the given function.
func (*Collection) GetDeploymentForIntegration ¶
func (c *Collection) GetDeploymentForIntegration(integration *v1.Integration) *appsv1.Deployment
GetDeploymentForIntegration returns a Deployment for the given integration.
func (*Collection) GetKnativeService ¶
GetKnativeService returns a Knative Service that matches the given function.
func (*Collection) GetKnativeSubscription ¶ added in v2.3.1
func (c *Collection) GetKnativeSubscription(filter func(subscription *messaging.Subscription) bool) *messaging.Subscription
GetKnativeSubscription returns a Knative channel Subscription that matches the given function.
func (*Collection) GetKnativeTrigger ¶ added in v2.3.1
GetKnativeTrigger returns a Knative Trigger that matches the given function.
func (*Collection) GetPodMonitor ¶
func (c *Collection) GetPodMonitor(filter func(*monitoringv1.PodMonitor) bool) *monitoringv1.PodMonitor
func (*Collection) GetSecret ¶ added in v2.3.0
GetSecret returns a Secret that matches the given function.
func (*Collection) GetService ¶
GetService returns a Service that matches the given function.
func (*Collection) GetServiceForIntegration ¶
func (c *Collection) GetServiceForIntegration(integration *v1.Integration) *corev1.Service
GetServiceForIntegration returns a user Service for the given integration.
func (*Collection) GetUserServiceForIntegration ¶
func (c *Collection) GetUserServiceForIntegration(integration *v1.Integration) *corev1.Service
GetUserServiceForIntegration returns a user Service for the given integration.
func (*Collection) HasDeployment ¶
func (c *Collection) HasDeployment(filter func(*appsv1.Deployment) bool) bool
HasDeployment returns true if a deployment matching the given condition is present.
func (*Collection) HasKnativeTrigger ¶
func (c *Collection) HasKnativeTrigger(filter func(trigger *eventing.Trigger) bool) bool
HasKnativeTrigger returns true if a Knative trigger respecting filter is found.
func (*Collection) Items ¶
func (c *Collection) Items() []ctrl.Object
Items returns all resources belonging to the collection.
func (*Collection) RemoveConfigMap ¶
RemoveConfigMap removes and returns a ConfigMap that matches the given function.
func (*Collection) RemoveDeployment ¶
func (c *Collection) RemoveDeployment(filter func(*appsv1.Deployment) bool) *appsv1.Deployment
RemoveDeployment removes and returns a Deployment that matches the given function.
func (*Collection) Size ¶
func (c *Collection) Size() int
Size returns the number of resources belonging to the collection.
func (*Collection) Visit ¶
func (c *Collection) Visit(visitor func(runtime.Object))
Visit executes the visitor function on all resources.
func (*Collection) VisitConfigMap ¶
func (c *Collection) VisitConfigMap(visitor func(*corev1.ConfigMap))
VisitConfigMap executes the visitor function on all ConfigMap resources.
func (*Collection) VisitContainer ¶
func (c *Collection) VisitContainer(visitor func(container *corev1.Container))
VisitContainer executes the visitor function on all Containers inside deployments or other resources.
func (*Collection) VisitCronJob ¶
func (c *Collection) VisitCronJob(visitor func(*batchv1.CronJob))
VisitCronJob executes the visitor function on all CronJob resources.
func (*Collection) VisitCronJobE ¶
func (c *Collection) VisitCronJobE(visitor func(*batchv1.CronJob) error) error
VisitCronJobE executes the visitor function on all CronJob resources.
func (*Collection) VisitDeployment ¶
func (c *Collection) VisitDeployment(visitor func(*appsv1.Deployment))
VisitDeployment executes the visitor function on all Deployment resources.
func (*Collection) VisitDeploymentE ¶
func (c *Collection) VisitDeploymentE(visitor func(*appsv1.Deployment) error) error
VisitDeploymentE executes the visitor function on all Deployment resources.
func (*Collection) VisitE ¶
func (c *Collection) VisitE(visitor func(runtime.Object) error) error
VisitE executes the visitor function on all resources breaking if the visitor function returns an error.
func (*Collection) VisitKnativeConfigurationSpec ¶
func (c *Collection) VisitKnativeConfigurationSpec(visitor func(container *serving.ConfigurationSpec))
VisitKnativeConfigurationSpec executes the visitor function on all knative ConfigurationSpec inside serving Services.
func (*Collection) VisitKnativeService ¶
func (c *Collection) VisitKnativeService(visitor func(*serving.Service))
VisitKnativeService executes the visitor function on all Knative serving Service resources.
func (*Collection) VisitKnativeServiceE ¶
func (c *Collection) VisitKnativeServiceE(visitor func(*serving.Service) error) error
VisitKnativeServiceE executes the visitor function on all Knative serving Service resources.
func (*Collection) VisitKnativeSubscription ¶ added in v2.3.1
func (c *Collection) VisitKnativeSubscription(visitor func(trigger *messaging.Subscription))
VisitKnativeSubscription executes the visitor function on all Knative channel Subscription resources.
func (*Collection) VisitKnativeTrigger ¶
func (c *Collection) VisitKnativeTrigger(visitor func(trigger *eventing.Trigger))
VisitKnativeTrigger executes the visitor function on all Knative eventing Trigger resources.
func (*Collection) VisitMetaObject ¶
func (c *Collection) VisitMetaObject(visitor func(metav1.Object))
VisitMetaObject executes the visitor function on all meta.Object resources.
func (*Collection) VisitPodMonitor ¶
func (c *Collection) VisitPodMonitor(visitor func(*monitoringv1.PodMonitor))
func (*Collection) VisitPodSpec ¶
func (c *Collection) VisitPodSpec(visitor func(container *corev1.PodSpec))
VisitPodSpec executes the visitor function on all PodSpec inside deployments or other resources.
func (*Collection) VisitPodTemplateMeta ¶
func (c *Collection) VisitPodTemplateMeta(visitor func(meta *metav1.ObjectMeta))
VisitPodTemplateMeta executes the visitor function on all PodTemplate metadata inside deployments or other resources.
func (*Collection) VisitRoute ¶
func (c *Collection) VisitRoute(visitor func(*routev1.Route))
VisitRoute executes the visitor function on all Route resources.
func (*Collection) VisitSecret ¶ added in v2.3.0
func (c *Collection) VisitSecret(visitor func(*corev1.Secret))
VisitSecret executes the visitor function on all Secrets resources.
func (*Collection) VisitService ¶
func (c *Collection) VisitService(visitor func(*corev1.Service))
VisitService executes the visitor function on all Service resources.