Documentation ¶
Overview ¶
Copyright 2019 The Knative Authors
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.
Index ¶
- Constants
- func AppendInstalled(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
- func AppendTarget(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
- func CheckDeployments(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
- func ClusterScopedResource(apiVersion, kind, name string) *unstructured.Unstructured
- func ConfigMapTransform(config v1alpha1.ConfigMapData, log *zap.SugaredLogger) mf.Transformer
- func FinalizerRemovalPatch(obj v1alpha1.KComponent, toRemove string) ([]byte, error)
- func ImageTransform(registry *v1alpha1.Registry, log *zap.SugaredLogger) mf.Transformer
- func Install(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
- func InstalledManifest(instance v1alpha1.KComponent) (mf.Manifest, error)
- func IsUpDowngradeEligible(instance v1alpha1.KComponent) bool
- func JobTransform(obj v1alpha1.KComponent) mf.Transformer
- func NamespacedResource(apiVersion, kind, ns, name string) *unstructured.Unstructured
- func NoOp(context.Context, *mf.Manifest, v1alpha1.KComponent) error
- func ResourceImageTransformer(imageTransformer ImageTransformer, log *zap.SugaredLogger) mf.Transformer
- func ResourceRequirementsTransform(resources []v1alpha1.ResourceRequirementsOverride, log *zap.SugaredLogger) mf.Transformer
- func TargetManifest(instance v1alpha1.KComponent) (mf.Manifest, error)
- func TargetVersion(instance v1alpha1.KComponent) string
- func Transform(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent, ...) error
- func Uninstall(manifest *mf.Manifest) error
- func UpdateConfigMap(cm *unstructured.Unstructured, data map[string]string, log *zap.SugaredLogger) error
- type Extension
- type ExtensionGenerator
- type ImageTransformer
- type ManifestFetcher
- type Stage
- type Stages
Constants ¶
const ( // KoEnvKey is the key of the environment variable to specify the path to the ko data directory KoEnvKey = "KO_DATA_PATH" // VersionVariable is a string, which can be replaced with the value of spec.version VersionVariable = "${VERSION}" // COMMA is the character comma COMMA = "," )
Variables ¶
This section is empty.
Functions ¶
func AppendInstalled ¶ added in v0.16.0
func AppendInstalled(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
AppendInstalled mutates the passed manifest by appending one appropriate for the passed KComponent, which may not be the one corresponding to status.version
func AppendTarget ¶ added in v0.16.0
AppendTarget mutates the passed manifest by appending one appropriate for the passed KComponent
func CheckDeployments ¶
func CheckDeployments(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent) error
CheckDeployments checks all deployments in the given manifest and updates the given status with the status of the deployments.
func ClusterScopedResource ¶
func ClusterScopedResource(apiVersion, kind, name string) *unstructured.Unstructured
ClusterScopedResource is an unstructured resource with the given apiVersion, kind and name.
func ConfigMapTransform ¶
func ConfigMapTransform(config v1alpha1.ConfigMapData, log *zap.SugaredLogger) mf.Transformer
ConfigMapTransform updates the ConfigMap with the values specified in operator CR
func FinalizerRemovalPatch ¶
func FinalizerRemovalPatch(obj v1alpha1.KComponent, toRemove string) ([]byte, error)
FinalizerRemovalPatch generates a patch for removing the given finalizer.
func ImageTransform ¶
func ImageTransform(registry *v1alpha1.Registry, log *zap.SugaredLogger) mf.Transformer
ImageTransform updates image with a new registry and tag
func Install ¶
Install applies the manifest resources for the given version and updates the given status accordingly.
func InstalledManifest ¶ added in v0.16.0
func InstalledManifest(instance v1alpha1.KComponent) (mf.Manifest, error)
InstalledManifest returns the version currently installed, which is harder than it sounds, since status.version isn't set until the target version is successfully installed, which can take some time. So we return the target manifest if status.version is empty.
func IsUpDowngradeEligible ¶ added in v0.16.0
func IsUpDowngradeEligible(instance v1alpha1.KComponent) bool
IsUpDowngradeEligible returns the bool indicate whether the installed manifest is able to upgrade or downgrade to the target manifest.
func JobTransform ¶ added in v0.16.0
func JobTransform(obj v1alpha1.KComponent) mf.Transformer
JobTransform updates the job with the expected value for the key app in the label
func NamespacedResource ¶
func NamespacedResource(apiVersion, kind, ns, name string) *unstructured.Unstructured
NamespacedResource is an unstructured resource with the given apiVersion, kind, ns and name.
func ResourceImageTransformer ¶ added in v0.16.0
func ResourceImageTransformer(imageTransformer ImageTransformer, log *zap.SugaredLogger) mf.Transformer
ResourceImageTransformer takes an ImageTransformer and transform images across resources
func ResourceRequirementsTransform ¶
func ResourceRequirementsTransform(resources []v1alpha1.ResourceRequirementsOverride, log *zap.SugaredLogger) mf.Transformer
ResourceRequirementsTransform configures the resource requests for all containers within all deployments in the manifest
func TargetManifest ¶ added in v0.16.0
func TargetManifest(instance v1alpha1.KComponent) (mf.Manifest, error)
TargetManifest returns the manifest for the TargetVersion
func TargetVersion ¶ added in v0.16.0
func TargetVersion(instance v1alpha1.KComponent) string
TargetVersion returns the version of the manifest to be installed per the spec in the component. If spec.version is empty, the latest version known to the operator is returned.
func Transform ¶ added in v0.16.0
func Transform(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.KComponent, extra ...mf.Transformer) error
Transform will mutate the passed-by-reference manifest with one transformed by platform, common, and any extra passed in
func Uninstall ¶
Uninstall removes all resources except CRDs, which are never deleted automatically.
func UpdateConfigMap ¶
func UpdateConfigMap(cm *unstructured.Unstructured, data map[string]string, log *zap.SugaredLogger) error
UpdateConfigMap set some data in a configmap, only overwriting common keys if they differ
Types ¶
type Extension ¶ added in v0.16.0
type Extension interface { Transformers(v1alpha1.KComponent) []mf.Transformer Reconcile(context.Context, v1alpha1.KComponent) error Finalize(context.Context, v1alpha1.KComponent) error }
Extension enables platform-specific features
func NoExtension ¶ added in v0.16.0
NoPlatform "generates" a NilExtension
type ExtensionGenerator ¶ added in v0.16.0
ExtensionGenerator creates an Extension from a Context
type ImageTransformer ¶ added in v0.16.0
type ImageTransformer interface { ImageForContainer(container *corev1.Container, parentName string) (string, bool) ImageForEnvVar(env *corev1.EnvVar, parentName string) (string, bool) ImageForImage(image *caching.Image, parentName string) (string, bool) HandleImagePullSecrets(imagePullSecrets []corev1.LocalObjectReference, log *zap.SugaredLogger) []corev1.LocalObjectReference }
ImageTransformer is an interface for transforming images passed to the ResourceImageTransformer
type ManifestFetcher ¶ added in v0.16.0
ManifestFetcher returns a manifest appropriate for the instance
type Stage ¶ added in v0.16.0
Stage represents a step in the reconcile process
func DeleteObsoleteResources ¶ added in v0.16.0
func DeleteObsoleteResources(ctx context.Context, instance v1alpha1.KComponent, fetch ManifestFetcher) Stage
DeleteObsoleteResources returns a Stage after calculating the installed manifest from the instance. This is meant to be called *before* executing the reconciliation stages so that the proper manifest is captured in a closure before any stage might mutate the instance status, e.g. Install.