resourceapply

package
v0.0.0-...-bb0df7c Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAPIService

ApplyAPIService merges objectmeta and requires apiservice coordinates. It does not touch CA bundles, which should be managed via service CA controller.

func ApplyCSIDriverV1Beta1

func ApplyCSIDriverV1Beta1(client storageclientv1beta1.CSIDriversGetter, recorder events.Recorder, required *storagev1beta1.CSIDriver) (*storagev1beta1.CSIDriver, bool, error)

ApplyCSIDriverV1Beta1 merges objectmeta, does not worry about anything else

func ApplyClusterRole

func ApplyClusterRole(client rbacclientv1.ClusterRolesGetter, recorder events.Recorder, required *rbacv1.ClusterRole) (*rbacv1.ClusterRole, bool, error)

ApplyClusterRole merges objectmeta, requires rules, aggregation rules are not allowed for now.

func ApplyClusterRoleBinding

func ApplyClusterRoleBinding(client rbacclientv1.ClusterRoleBindingsGetter, recorder events.Recorder, required *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, bool, error)

ApplyClusterRoleBinding merges objectmeta, requires subjects and role refs TODO on non-matching roleref, delete and recreate

func ApplyConfigMap

func ApplyConfigMap(client coreclientv1.ConfigMapsGetter, recorder events.Recorder, required *corev1.ConfigMap) (*corev1.ConfigMap, bool, error)

ApplyConfigMap merges objectmeta, requires data

func ApplyCustomResourceDefinitionV1

ApplyCustomResourceDefinitionV1 applies the required CustomResourceDefinition to the cluster.

func ApplyCustomResourceDefinitionV1Beta1

ApplyCustomResourceDefinitionV1Beta1 applies the required CustomResourceDefinition to the cluster.

func ApplyDaemonSet

func ApplyDaemonSet(client appsclientv1.DaemonSetsGetter, recorder events.Recorder,
	requiredOriginal *appsv1.DaemonSet, expectedGeneration int64) (*appsv1.DaemonSet, bool, error)

ApplyDaemonSet ensures the form of the specified daemonset is present in the API. If it does not exist, it will be created. If it does exist, the metadata of the required daemonset will be merged with the existing daemonset and an update performed if the daemonset spec and metadata differ from the previously required spec and metadata. For further detail, check the top-level comment.

NOTE: The previous implementation of this method was renamed to ApplyDaemonSetWithForce. If are reading this in response to a compile error due to the change in signature, you have the following options:

- Update the calling code to rely on the spec comparison provided by the new implementation. If the code in question was specifying the force parameter to ensure rollout in response to changes in resources external to the daemonset, it will need to be revised to set that external state as an annotation e.g.

myoperator.openshift.io/my-resource: <resourceVersion>

- Update the call to use ApplyDaemonSetWithForce. This is available as a temporary measure but the method is deprecated and will be removed in 4.6.

func ApplyDaemonSetWithForce

func ApplyDaemonSetWithForce(client appsclientv1.DaemonSetsGetter, recorder events.Recorder, requiredOriginal *appsv1.DaemonSet, expectedGeneration int64, forceRollout bool) (*appsv1.DaemonSet, bool, error)

ApplyDaemonSetWithForce merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error DEPRECATED - This method will be removed in 4.6 and callers will need to migrate to ApplyDaemonSet before then.

func ApplyDeployment

func ApplyDeployment(client appsclientv1.DeploymentsGetter, recorder events.Recorder,
	requiredOriginal *appsv1.Deployment, expectedGeneration int64) (*appsv1.Deployment, bool, error)

ApplyDeployment ensures the form of the specified deployment is present in the API. If it does not exist, it will be created. If it does exist, the metadata of the required deployment will be merged with the existing deployment and an update performed if the deployment spec and metadata differ from the previously required spec and metadata. For further detail, check the top-level comment.

NOTE: The previous implementation of this method was renamed to ApplyDeploymentWithForce. If are reading this in response to a compile error due to the change in signature, you have the following options:

- Update the calling code to rely on the spec comparison provided by the new implementation. If the code in question was specifying the force parameter to ensure rollout in response to changes in resources external to the deployment, it will need to be revised to set that external state as an annotation e.g.

myoperator.openshift.io/my-resource: <resourceVersion>

- Update the call to use ApplyDeploymentWithForce. This is available as a temporary measure but the method is deprecated and will be removed in 4.6.

func ApplyDeploymentWithForce

func ApplyDeploymentWithForce(client appsclientv1.DeploymentsGetter, recorder events.Recorder, requiredOriginal *appsv1.Deployment, expectedGeneration int64,
	forceRollout bool) (*appsv1.Deployment, bool, error)

ApplyDeploymentWithForce merges objectmeta and requires matching generation. It returns the final Object, whether any change as made, and an error.

DEPRECATED - This method will be removed in 4.6 and callers will need to migrate to ApplyDeployment before then.

func ApplyNamespace

func ApplyNamespace(client coreclientv1.NamespacesGetter, recorder events.Recorder, required *corev1.Namespace) (*corev1.Namespace, bool, error)

ApplyNamespace merges objectmeta, does not worry about anything else

func ApplyPod

func ApplyPod(client coreclientv1.PodsGetter, recorder events.Recorder, required *corev1.Pod) (*corev1.Pod, bool, error)

ApplyPod merges objectmeta, does not worry about anything else

func ApplyRole

func ApplyRole(client rbacclientv1.RolesGetter, recorder events.Recorder, required *rbacv1.Role) (*rbacv1.Role, bool, error)

ApplyRole merges objectmeta, requires rules

func ApplyRoleBinding

func ApplyRoleBinding(client rbacclientv1.RoleBindingsGetter, recorder events.Recorder, required *rbacv1.RoleBinding) (*rbacv1.RoleBinding, bool, error)

ApplyRoleBinding merges objectmeta, requires subjects and role refs TODO on non-matching roleref, delete and recreate

func ApplySecret

func ApplySecret(client coreclientv1.SecretsGetter, recorder events.Recorder, required *corev1.Secret) (*corev1.Secret, bool, error)

ApplySecret merges objectmeta, requires data

func ApplyService

func ApplyService(client coreclientv1.ServicesGetter, recorder events.Recorder, required *corev1.Service) (*corev1.Service, bool, error)

ApplyService merges objectmeta and requires TODO, since this cannot determine whether changes are due to legitimate actors (api server) or illegitimate ones (users), we cannot update TODO I've special cased the selector for now

func ApplyServiceAccount

func ApplyServiceAccount(client coreclientv1.ServiceAccountsGetter, recorder events.Recorder, required *corev1.ServiceAccount) (*corev1.ServiceAccount, bool, error)

ApplyServiceAccount merges objectmeta, does not worry about anything else

func ApplyServiceMonitor

func ApplyServiceMonitor(client dynamic.Interface, recorder events.Recorder, serviceMonitorBytes []byte) (bool, error)

ApplyServiceMonitor applies the Prometheus service monitor.

func ApplyStorageClass

func ApplyStorageClass(client storageclientv1.StorageClassesGetter, recorder events.Recorder, required *storagev1.StorageClass) (*storagev1.StorageClass, bool,
	error)

ApplyStorageClass merges objectmeta, tries to write everything else

func JSONPatchNoError

func JSONPatchNoError(original, modified runtime.Object) string

JSONPatchNoError generates a JSON patch between original and modified objects and return the JSON as a string. Note:

In case of error, the returned string will contain the error messages.

func JSONPatchSecretNoError

func JSONPatchSecretNoError(original, modified *corev1.Secret) string

JSONPatchSecretNoError generates a JSON patch between original and modified secrets, hiding its data, and return the JSON as a string.

Note: In case of error, the returned string will contain the error messages.

func SetSpecHashAnnotation

func SetSpecHashAnnotation(objMeta *metav1.ObjectMeta, spec interface{}) error

SetSpecHashAnnotation computes the hash of the provided spec and sets an annotation of the hash on the provided ObjectMeta. This method is used internally by Apply<type> methods, and is exposed to support testing with fake clients that need to know the mutated form of the resource resulting from an Apply<type> call.

func SyncConfigMap

func SyncConfigMap(client coreclientv1.ConfigMapsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, ownerRefs []metav1.OwnerReference) (*corev1.ConfigMap, bool, error)

func SyncSecret

func SyncSecret(client coreclientv1.SecretsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, ownerRefs []metav1.OwnerReference) (*corev1.Secret, bool, error)

Types

type ApplyResult

type ApplyResult struct {
	File    string
	Type    string
	Result  runtime.Object
	Changed bool
	Error   error
}

func ApplyDirectly

func ApplyDirectly(clients *ClientHolder, recorder events.Recorder, manifests AssetFunc, files ...string) []ApplyResult

ApplyDirectly applies the given manifest files to API server.

type AssetFunc

type AssetFunc func(name string) ([]byte, error)

type ClientHolder

type ClientHolder struct {
	// contains filtered or unexported fields
}

func NewClientHolder

func NewClientHolder() *ClientHolder

func NewKubeClientHolder

func NewKubeClientHolder(client kubernetes.Interface) *ClientHolder

func (*ClientHolder) WithAPIExtensionsClient

func (c *ClientHolder) WithAPIExtensionsClient(client apiextensionsclient.Interface) *ClientHolder

func (*ClientHolder) WithKubernetes

func (c *ClientHolder) WithKubernetes(client kubernetes.Interface) *ClientHolder

func (*ClientHolder) WithKubernetesInformers

func (c *ClientHolder) WithKubernetesInformers(kubeInformers v1helpers.KubeInformersForNamespaces) *ClientHolder

Jump to

Keyboard shortcuts

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