Documentation ¶
Overview ¶
* This file is part of the KubeVirt project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright 2019 Red Hat, Inc. *
Index ¶
- Constants
- Variables
- func AddFinalizer(kv *virtv1.KubeVirt)
- func DaemonsetIsReady(kv *v1.KubeVirt, daemonset *appsv1.DaemonSet, stores Stores) bool
- func DeploymentIsReady(kv *v1.KubeVirt, deployment *appsv1.Deployment, stores Stores) bool
- func GetPassthroughEnv() map[string]string
- func IsManagedByOperator(labels map[string]string) bool
- func IsPrometheusRuleEnabled(clientset kubecli.KubevirtClient) (bool, error)
- func IsSCCStoreEmpty(store cache.Store) bool
- func IsServiceMonitorEnabled(clientset kubecli.KubevirtClient) (bool, error)
- func IsStoreEmpty(store cache.Store) bool
- func IsValidLabel(label string) bool
- func NewEnvVarMap(envMap map[string]string) *[]k8sv1.EnvVar
- func SetConditionTimestamps(kvOrig *virtv1.KubeVirt, kvUpdated *virtv1.KubeVirt)
- func SetOperatorVersion(kv *virtv1.KubeVirt)
- func UpdateConditionsAvailable(kv *virtv1.KubeVirt)
- func UpdateConditionsCreated(kv *virtv1.KubeVirt)
- func UpdateConditionsDeleting(kv *virtv1.KubeVirt)
- func UpdateConditionsDeletionFailed(kv *virtv1.KubeVirt, err error)
- func UpdateConditionsDeploying(kv *virtv1.KubeVirt)
- func UpdateConditionsFailedError(kv *virtv1.KubeVirt, err error)
- func UpdateConditionsFailedExists(kv *virtv1.KubeVirt)
- func UpdateConditionsUpdating(kv *virtv1.KubeVirt)
- func VerifyEnv() error
- type Expectations
- type Informers
- type KubeVirtDeploymentConfig
- func (c *KubeVirtDeploymentConfig) GetApiVersion() string
- func (c *KubeVirtDeploymentConfig) GetControllerVersion() string
- func (c *KubeVirtDeploymentConfig) GetDeploymentID() string
- func (c *KubeVirtDeploymentConfig) GetExtraEnv() map[string]string
- func (c *KubeVirtDeploymentConfig) GetHandlerVersion() string
- func (c *KubeVirtDeploymentConfig) GetImagePrefix() string
- func (c *KubeVirtDeploymentConfig) GetImagePullPolicy() k8sv1.PullPolicy
- func (c *KubeVirtDeploymentConfig) GetImageRegistry() string
- func (c *KubeVirtDeploymentConfig) GetJson() (string, error)
- func (c *KubeVirtDeploymentConfig) GetKubeVirtVersion() string
- func (c *KubeVirtDeploymentConfig) GetLauncherVersion() string
- func (c *KubeVirtDeploymentConfig) GetMonitorNamespaces() []string
- func (c *KubeVirtDeploymentConfig) GetMonitorServiceAccount() string
- func (c *KubeVirtDeploymentConfig) GetNamespace() string
- func (c *KubeVirtDeploymentConfig) GetOperatorVersion() string
- func (c *KubeVirtDeploymentConfig) GetProductName() string
- func (c *KubeVirtDeploymentConfig) GetProductVersion() string
- func (c *KubeVirtDeploymentConfig) GetVerbosity() string
- func (c *KubeVirtDeploymentConfig) SetObservedDeploymentConfig(kv *v1.KubeVirt) error
- func (c *KubeVirtDeploymentConfig) SetTargetDeploymentConfig(kv *v1.KubeVirt) error
- func (c *KubeVirtDeploymentConfig) UseShasums() bool
- func (c *KubeVirtDeploymentConfig) WorkloadUpdatesEnabled() bool
- type Stores
Constants ¶
const ( KubeVirtFinalizer string = "foregroundDeleteKubeVirt" ConditionReasonDeploymentFailedExisting = "ExistingDeployment" ConditionReasonDeploymentFailedError = "DeploymentFailed" ConditionReasonDeletionFailedError = "DeletionFailed" ConditionReasonDeploymentCreated = "AllResourcesCreated" ConditionReasonDeploymentReady = "AllComponentsReady" ConditionReasonDeploying = "DeploymentInProgress" ConditionReasonUpdating = "UpdateInProgress" ConditionReasonDeleting = "DeletionInProgress" )
const ( // Name of env var containing the operator's image name OperatorImageEnvName = "OPERATOR_IMAGE" VirtApiShasumEnvName = "VIRT_API_SHASUM" VirtControllerShasumEnvName = "VIRT_CONTROLLER_SHASUM" VirtHandlerShasumEnvName = "VIRT_HANDLER_SHASUM" VirtLauncherShasumEnvName = "VIRT_LAUNCHER_SHASUM" GsEnvShasumName = "GS_SHASUM" KubeVirtVersionEnvName = "KUBEVIRT_VERSION" // Deprecated, use TargetDeploymentConfig instead TargetInstallNamespace = "TARGET_INSTALL_NAMESPACE" // Deprecated, use TargetDeploymentConfig instead TargetImagePullPolicy = "TARGET_IMAGE_PULL_POLICY" // JSON containing all relevant deployment properties, replaces TargetInstallNamespace and TargetImagePullPolicy TargetDeploymentConfig = "TARGET_DEPLOYMENT_CONFIG" // these names need to match field names from KubeVirt Spec if they are set from there AdditionalPropertiesNamePullPolicy = "ImagePullPolicy" // lookup key in AdditionalProperties AdditionalPropertiesMonitorNamespace = "MonitorNamespace" // lookup key in AdditionalProperties AdditionalPropertiesMonitorServiceAccount = "MonitorAccount" // lookup key in AdditionalProperties AdditionalPropertiesWorkloadUpdatesEnabled = "WorkloadUpdatesEnabled" // account to use if one is not explicitly named DefaultMonitorAccount = "prometheus-k8s" // lookup keys in AdditionalProperties ImagePrefixKey = "imagePrefix" ProductNameKey = "productName" ProductVersionKey = "productVersion" // #nosec 101, the variable is not holding any credential // Prefix for env vars that will be passed along PassthroughEnvPrefix = "KV_IO_EXTRA_ENV_" )
Variables ¶
var DefaultMonitorNamespaces = []string{
"openshift-monitoring",
"monitoring",
}
DefaultMonitorNamespaces holds a set of well known prometheus-operator namespaces. Ordering in the list matters. First entries have precedence.
Functions ¶
func AddFinalizer ¶
func DaemonsetIsReady ¶ added in v0.16.0
func DeploymentIsReady ¶ added in v0.16.0
func GetPassthroughEnv ¶ added in v0.30.0
func IsManagedByOperator ¶ added in v0.20.0
func IsPrometheusRuleEnabled ¶ added in v0.26.0
func IsPrometheusRuleEnabled(clientset kubecli.KubevirtClient) (bool, error)
IsPrometheusRuleEnabled returns true if prometheusrules cr is defined and false otherwise.
func IsSCCStoreEmpty ¶ added in v0.20.0
func IsServiceMonitorEnabled ¶ added in v0.20.6
func IsServiceMonitorEnabled(clientset kubecli.KubevirtClient) (bool, error)
func IsStoreEmpty ¶
func IsValidLabel ¶ added in v0.39.0
func SetConditionTimestamps ¶ added in v0.20.0
func SetOperatorVersion ¶ added in v0.16.0
func UpdateConditionsAvailable ¶ added in v0.20.0
func UpdateConditionsCreated ¶ added in v0.20.0
func UpdateConditionsDeleting ¶ added in v0.20.0
func UpdateConditionsDeletionFailed ¶ added in v0.20.0
func UpdateConditionsDeploying ¶ added in v0.20.0
func UpdateConditionsFailedError ¶ added in v0.20.0
func UpdateConditionsFailedExists ¶ added in v0.20.0
func UpdateConditionsUpdating ¶ added in v0.20.0
Types ¶
type Expectations ¶
type Expectations struct { ServiceAccount *controller.UIDTrackingControllerExpectations ClusterRole *controller.UIDTrackingControllerExpectations ClusterRoleBinding *controller.UIDTrackingControllerExpectations Role *controller.UIDTrackingControllerExpectations RoleBinding *controller.UIDTrackingControllerExpectations Crd *controller.UIDTrackingControllerExpectations Service *controller.UIDTrackingControllerExpectations Deployment *controller.UIDTrackingControllerExpectations DaemonSet *controller.UIDTrackingControllerExpectations ValidationWebhook *controller.UIDTrackingControllerExpectations MutatingWebhook *controller.UIDTrackingControllerExpectations APIService *controller.UIDTrackingControllerExpectations SCC *controller.UIDTrackingControllerExpectations InstallStrategyConfigMap *controller.UIDTrackingControllerExpectations InstallStrategyJob *controller.UIDTrackingControllerExpectations PodDisruptionBudget *controller.UIDTrackingControllerExpectations ServiceMonitor *controller.UIDTrackingControllerExpectations PrometheusRule *controller.UIDTrackingControllerExpectations Secrets *controller.UIDTrackingControllerExpectations ConfigMap *controller.UIDTrackingControllerExpectations }
func (*Expectations) DeleteExpectations ¶
func (e *Expectations) DeleteExpectations(key string)
func (*Expectations) ResetExpectations ¶
func (e *Expectations) ResetExpectations(key string)
func (*Expectations) SatisfiedExpectations ¶
func (e *Expectations) SatisfiedExpectations(key string) bool
type Informers ¶
type Informers struct { ServiceAccount cache.SharedIndexInformer ClusterRole cache.SharedIndexInformer ClusterRoleBinding cache.SharedIndexInformer Role cache.SharedIndexInformer RoleBinding cache.SharedIndexInformer Crd cache.SharedIndexInformer Service cache.SharedIndexInformer Deployment cache.SharedIndexInformer DaemonSet cache.SharedIndexInformer ValidationWebhook cache.SharedIndexInformer MutatingWebhook cache.SharedIndexInformer APIService cache.SharedIndexInformer SCC cache.SharedIndexInformer InstallStrategyConfigMap cache.SharedIndexInformer InstallStrategyJob cache.SharedIndexInformer InfrastructurePod cache.SharedIndexInformer PodDisruptionBudget cache.SharedIndexInformer ServiceMonitor cache.SharedIndexInformer Namespace cache.SharedIndexInformer PrometheusRule cache.SharedIndexInformer Secrets cache.SharedIndexInformer ConfigMap cache.SharedIndexInformer }
type KubeVirtDeploymentConfig ¶
type KubeVirtDeploymentConfig struct { ID string `json:"id,omitempty" optional:"true"` Namespace string `json:"namespace,omitempty" optional:"true"` Registry string `json:"registry,omitempty" optional:"true"` ImagePrefix string `json:"imagePrefix,omitempty" optional:"true"` // the KubeVirt version // matches the image tag, if tags are used, either by the manifest, or by the KubeVirt CR // used on the KubeVirt CR status and on annotations, and for determining up-/downgrade path, even when using shasums for the images KubeVirtVersion string `json:"kubeVirtVersion,omitempty" optional:"true"` // the shasums of every image we use VirtOperatorSha string `json:"virtOperatorSha,omitempty" optional:"true"` VirtApiSha string `json:"virtApiSha,omitempty" optional:"true"` VirtControllerSha string `json:"virtControllerSha,omitempty" optional:"true"` VirtHandlerSha string `json:"virtHandlerSha,omitempty" optional:"true"` VirtLauncherSha string `json:"virtLauncherSha,omitempty" optional:"true"` GsSha string `json:"gsSha,omitempty" optional:"true"` // everything else, which can e.g. come from KubeVirt CR spec AdditionalProperties map[string]string `json:"additionalProperties,omitempty" optional:"true"` // environment variables from virt-operator to pass along PassthroughEnvVars map[string]string `json:"passthroughEnvVars,omitempty" optional:"true"` }
func GetConfigFromEnv ¶ added in v0.20.0
func GetConfigFromEnv() (*KubeVirtDeploymentConfig, error)
func GetTargetConfigFromKV ¶ added in v0.20.0
func GetTargetConfigFromKV(kv *v1.KubeVirt) *KubeVirtDeploymentConfig
func (*KubeVirtDeploymentConfig) GetApiVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetApiVersion() string
func (*KubeVirtDeploymentConfig) GetControllerVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetControllerVersion() string
func (*KubeVirtDeploymentConfig) GetDeploymentID ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetDeploymentID() string
func (*KubeVirtDeploymentConfig) GetExtraEnv ¶ added in v0.30.0
func (c *KubeVirtDeploymentConfig) GetExtraEnv() map[string]string
func (*KubeVirtDeploymentConfig) GetHandlerVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetHandlerVersion() string
func (*KubeVirtDeploymentConfig) GetImagePrefix ¶ added in v0.20.8
func (c *KubeVirtDeploymentConfig) GetImagePrefix() string
func (*KubeVirtDeploymentConfig) GetImagePullPolicy ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetImagePullPolicy() k8sv1.PullPolicy
func (*KubeVirtDeploymentConfig) GetImageRegistry ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetImageRegistry() string
func (*KubeVirtDeploymentConfig) GetJson ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetJson() (string, error)
func (*KubeVirtDeploymentConfig) GetKubeVirtVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetKubeVirtVersion() string
func (*KubeVirtDeploymentConfig) GetLauncherVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetLauncherVersion() string
func (*KubeVirtDeploymentConfig) GetMonitorNamespaces ¶ added in v0.42.0
func (c *KubeVirtDeploymentConfig) GetMonitorNamespaces() []string
func (*KubeVirtDeploymentConfig) GetMonitorServiceAccount ¶ added in v0.20.6
func (c *KubeVirtDeploymentConfig) GetMonitorServiceAccount() string
func (*KubeVirtDeploymentConfig) GetNamespace ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetNamespace() string
func (*KubeVirtDeploymentConfig) GetOperatorVersion ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetOperatorVersion() string
func (*KubeVirtDeploymentConfig) GetProductName ¶ added in v0.33.0
func (c *KubeVirtDeploymentConfig) GetProductName() string
func (*KubeVirtDeploymentConfig) GetProductVersion ¶ added in v0.33.0
func (c *KubeVirtDeploymentConfig) GetProductVersion() string
func (*KubeVirtDeploymentConfig) GetVerbosity ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) GetVerbosity() string
func (*KubeVirtDeploymentConfig) SetObservedDeploymentConfig ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) SetObservedDeploymentConfig(kv *v1.KubeVirt) error
func (*KubeVirtDeploymentConfig) SetTargetDeploymentConfig ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) SetTargetDeploymentConfig(kv *v1.KubeVirt) error
func (*KubeVirtDeploymentConfig) UseShasums ¶ added in v0.20.0
func (c *KubeVirtDeploymentConfig) UseShasums() bool
func (*KubeVirtDeploymentConfig) WorkloadUpdatesEnabled ¶ added in v0.39.0
func (c *KubeVirtDeploymentConfig) WorkloadUpdatesEnabled() bool
type Stores ¶
type Stores struct { ServiceAccountCache cache.Store ClusterRoleCache cache.Store ClusterRoleBindingCache cache.Store RoleCache cache.Store RoleBindingCache cache.Store CrdCache cache.Store ServiceCache cache.Store DeploymentCache cache.Store DaemonSetCache cache.Store ValidationWebhookCache cache.Store MutatingWebhookCache cache.Store APIServiceCache cache.Store SCCCache cache.Store InstallStrategyConfigMapCache cache.Store InstallStrategyJobCache cache.Store InfrastructurePodCache cache.Store PodDisruptionBudgetCache cache.Store ServiceMonitorCache cache.Store NamespaceCache cache.Store PrometheusRuleCache cache.Store SecretCache cache.Store ConfigMapCache cache.Store IsOnOpenshift bool ServiceMonitorEnabled bool PrometheusRulesEnabled bool }