Documentation ¶
Overview ¶
Copyright 2020 The Tekton 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 AddCABundleConfigMapsToVolumes(volumes []corev1.Volume) []corev1.Volume
- func AddCABundlesToContainerVolumes(c *corev1.Container)
- func AddConfigMapValues(configMapName string, prop interface{}) mf.Transformer
- func AddConfiguration(config v1alpha1.Config) mf.Transformer
- func AddDeploymentRestrictedPSA() mf.Transformer
- func AddJobRestrictedPSA() mf.Transformer
- func AddStatefulSetRestrictedPSA() mf.Transformer
- func AppendManifest(manifest *mf.Manifest, yamlLocation string) error
- func AppendTarget(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.TektonComponent) error
- func ApplyProxySettings(u *unstructured.Unstructured) error
- func CheckUpgradePending(tc v1alpha1.TektonComponent) (bool, error)
- func ComponentDir(instance v1alpha1.TektonComponent) string
- func CopyConfigMap(configMapName string, expectedValues map[string]string) mf.Transformer
- func CreateTargetNamespace(ctx context.Context, labels map[string]string, obj v1alpha1.TektonComponent, ...) error
- func DeploymentImages(images map[string]string) mf.Transformer
- func Fetch(path string) (mf.Manifest, error)
- func FetchVersionFromConfigMap(manifest mf.Manifest, configMapName string) (string, error)
- func ImagesFromEnv(prefix string) map[string]string
- func InjectLabelOnNamespace(label string) mf.Transformer
- func InjectLabelOverwriteExisting(newLabels labels.Set, skipChecks ...mf.Predicate) mf.Transformer
- func InjectLabelPreserveExisting(newLabels labels.Set, skipChecks ...mf.Predicate) mf.Transformer
- func InjectOperandNameLabelOverwriteExisting(operandName string) mf.Transformer
- func InjectOperandNameLabelPreserveExisting(operandName string) mf.Transformer
- func IsFetchVersionError(err error) bool
- func JobImages(images map[string]string) mf.Transformer
- func LabelSelector(ls metav1.LabelSelector) (string, error)
- func NoOp(context.Context, *mf.Manifest, v1alpha1.TektonComponent) error
- func OperatorVersion(ctx context.Context) (string, error)
- func PipelineReady(informer informer.TektonPipelineInformer) (*v1alpha1.TektonPipeline, error)
- func PipelineTargetNamspace(informer informer.TektonPipelineInformer) (string, error)
- func PreemptDeadlock(ctx context.Context, m *manifestival.Manifest, kc kubernetes.Interface, ...) error
- func Prune(ctx context.Context, k kubernetes.Interface, tC *v1alpha1.TektonConfig) error
- func ReplaceDeploymentArg(deploymentName, existingArg, newArg string) mf.Transformer
- func ReplaceNamespaceInDeploymentArgs(targetNamespace string) mf.Transformer
- func ReplaceNamespaceInDeploymentEnv(targetNamespace string) mf.Transformer
- func SplitsByEqual(arg string) ([]string, bool)
- func TargetManifest(instance v1alpha1.TektonComponent) (mf.Manifest, error)
- func TargetVersion(instance v1alpha1.TektonComponent) string
- func TaskImages(images map[string]string) mf.Transformer
- func ToLowerCaseKeys(keyValues map[string]string) map[string]string
- func Transform(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.TektonComponent, ...) error
- func TriggerReady(informer informer.TektonTriggerInformer) (*v1alpha1.TektonTrigger, error)
- type Controller
- type Extension
- type ExtensionGenerator
- type ManifestFetcher
- type NameGenerator
- type PayloadOptions
- type Pruner
- type Recorder
- type Stage
- type Stages
- type VersionError
Constants ¶
const ( // user-provided and system CA certificates TrustedCAConfigMapName = "config-trusted-cabundle" TrustedCAConfigMapVolume = "config-trusted-cabundle-volume" TrustedCAKey = "ca-bundle.crt" // service serving certificates (required to talk to the internal registry) ServiceCAConfigMapName = "config-service-cabundle" ServiceCAConfigMapVolume = "config-service-cabundle-volume" ServiceCAKey = "service-ca.crt" )
const ( PipelineNotReady = "tekton-pipelines not ready" PipelineNotFound = "tekton-pipelines not installed" TriggerNotReady = "tekton-triggers not ready" TriggerNotFound = "tekton-triggers not installed" NamespaceIgnorePattern = "^(openshift|kube)-" )
const ( CronName = "tekton-resource-pruner" JobsTKNImageName = "IMAGE_JOB_PRUNER_TKN" )
const ( // KoEnvKey is the key of the environment variable to specify the path to the ko data directory KoEnvKey = "KO_DATA_PATH" // COMMA is the character comma COMMA = "," )
const ( AnnotationPreserveNS = "operator.tekton.dev/preserve-namespace" AnnotationPreserveRBSubjectNS = "operator.tekton.dev/preserve-rb-subject-namespace" PipelinesImagePrefix = "IMAGE_PIPELINES_" TriggersImagePrefix = "IMAGE_TRIGGERS_" AddonsImagePrefix = "IMAGE_ADDONS_" PacImagePrefix = "IMAGE_PAC_" ChainsImagePrefix = "IMAGE_CHAINS_" HubImagePrefix = "IMAGE_HUB_" ArgPrefix = "arg_" ParamPrefix = "param_" )
const ReleaseVersionUnknown = "Unknown"
Variables ¶
This section is empty.
Functions ¶
func AddCABundleConfigMapsToVolumes ¶ added in v0.55.0
AddCABundleConfigMapsToVolumes adds the config-trusted-cabundle and config-service-cabundle ConfigMaps to the given list of volumes and removes duplicates, if any
func AddCABundlesToContainerVolumes ¶ added in v0.55.0
AddCABundlesToContainerVolumes adds the CA bundles to the container via VolumeMounts. SSL_CERT_DIR environment variable is also set if it does not exist already.
func AddConfigMapValues ¶
func AddConfigMapValues(configMapName string, prop interface{}) mf.Transformer
AddConfigMapValues will loop on the interface passed and add the fields in configmap with key as json tag of the struct field
func AddConfiguration ¶
func AddConfiguration(config v1alpha1.Config) mf.Transformer
func AddDeploymentRestrictedPSA ¶ added in v0.63.0
func AddDeploymentRestrictedPSA() mf.Transformer
AddDeploymentRestrictedPSA will add the default restricted spec on Deployment to remove errors/warning
func AddJobRestrictedPSA ¶ added in v0.63.0
func AddJobRestrictedPSA() mf.Transformer
AddJobRestrictedPSA will add the default restricted spec on Job to remove errors/warning
func AddStatefulSetRestrictedPSA ¶ added in v0.63.0
func AddStatefulSetRestrictedPSA() mf.Transformer
AddStatefulSetRestrictedPSA will add the default restricted spec on StatefulSet to remove errors/warning
func AppendTarget ¶
func AppendTarget(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.TektonComponent) error
AppendTarget mutates the passed manifest by appending one appropriate for the passed TektonComponent
func ApplyProxySettings ¶
func ApplyProxySettings(u *unstructured.Unstructured) error
ApplyProxySettings is a transformer that propagate any proxy environment variables set on the operator deployment to the underlying deployment.
func CheckUpgradePending ¶ added in v0.55.0
func CheckUpgradePending(tc v1alpha1.TektonComponent) (bool, error)
func ComponentDir ¶
func ComponentDir(instance v1alpha1.TektonComponent) string
func CopyConfigMap ¶ added in v0.63.0
func CopyConfigMap(configMapName string, expectedValues map[string]string) mf.Transformer
CopyConfigMap will copy all the values from the passed configmap to the configmap in the manifest, the fields which are in manifest configmap will only be copied any extra field will be ignored
func CreateTargetNamespace ¶ added in v0.55.0
func CreateTargetNamespace(ctx context.Context, labels map[string]string, obj v1alpha1.TektonComponent, kubeClientSet kubernetes.Interface) error
func DeploymentImages ¶
func DeploymentImages(images map[string]string) mf.Transformer
DeploymentImages replaces container and args images.
func FetchVersionFromConfigMap ¶ added in v0.50.0
FetchVersionFromConfigMap finds the component version from the ConfigMap data field. It looks for the version key in the ConfigMap and if the ConfigMap or version key is not found then return the error.
func ImagesFromEnv ¶
ImagesFromEnv will provide map of key value.
func InjectLabelOnNamespace ¶
func InjectLabelOnNamespace(label string) mf.Transformer
InjectLabelOnNamespace will add a label on tekton-pipelines and openshift-pipelines namespace
func InjectLabelOverwriteExisting ¶ added in v0.59.0
func InjectLabelPreserveExisting ¶ added in v0.59.0
func InjectOperandNameLabelOverwriteExisting ¶ added in v0.59.0
func InjectOperandNameLabelOverwriteExisting(operandName string) mf.Transformer
func InjectOperandNameLabelPreserveExisting ¶ added in v0.59.0
func InjectOperandNameLabelPreserveExisting(operandName string) mf.Transformer
func IsFetchVersionError ¶ added in v0.50.0
func JobImages ¶
func JobImages(images map[string]string) mf.Transformer
JobImages replaces container and args images.
func LabelSelector ¶ added in v0.55.0
func LabelSelector(ls metav1.LabelSelector) (string, error)
func PipelineReady ¶
func PipelineReady(informer informer.TektonPipelineInformer) (*v1alpha1.TektonPipeline, error)
func PipelineTargetNamspace ¶ added in v0.55.0
func PipelineTargetNamspace(informer informer.TektonPipelineInformer) (string, error)
func PreemptDeadlock ¶ added in v0.55.0
func PreemptDeadlock(ctx context.Context, m *manifestival.Manifest, kc kubernetes.Interface, component string) error
func Prune ¶
func Prune(ctx context.Context, k kubernetes.Interface, tC *v1alpha1.TektonConfig) error
func ReplaceDeploymentArg ¶ added in v0.63.0
func ReplaceDeploymentArg(deploymentName, existingArg, newArg string) mf.Transformer
func ReplaceNamespaceInDeploymentArgs ¶
func ReplaceNamespaceInDeploymentArgs(targetNamespace string) mf.Transformer
ReplaceNamespaceInDeploymentArgs replaces namespace in deployment's args
func ReplaceNamespaceInDeploymentEnv ¶
func ReplaceNamespaceInDeploymentEnv(targetNamespace string) mf.Transformer
ReplaceNamespaceInDeploymentEnv replaces namespace in deployment's env var
func SplitsByEqual ¶ added in v0.55.1
func TargetManifest ¶
func TargetManifest(instance v1alpha1.TektonComponent) (mf.Manifest, error)
TargetManifest returns the manifest for the TargetVersion
func TargetVersion ¶
func TargetVersion(instance v1alpha1.TektonComponent) 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 TaskImages ¶
func TaskImages(images map[string]string) mf.Transformer
TaskImages replaces step and params images.
func ToLowerCaseKeys ¶
ToLowerCaseKeys converts key value to lower cases.
func Transform ¶
func Transform(ctx context.Context, manifest *mf.Manifest, instance v1alpha1.TektonComponent, extra ...mf.Transformer) error
Transform will mutate the passed-by-reference manifest with one transformed by platform, common, and any extra passed in
func TriggerReady ¶
func TriggerReady(informer informer.TektonTriggerInformer) (*v1alpha1.TektonTrigger, error)
Types ¶
type Controller ¶ added in v0.55.0
type Controller struct { Manifest *mf.Manifest Logger *zap.SugaredLogger VersionConfigMap string }
func (Controller) InitController ¶ added in v0.55.0
func (ctrl Controller) InitController(ctx context.Context, opts PayloadOptions) (mf.Manifest, string)
type Extension ¶
type Extension interface { Transformers(v1alpha1.TektonComponent) []mf.Transformer PreReconcile(context.Context, v1alpha1.TektonComponent) error PostReconcile(context.Context, v1alpha1.TektonComponent) error Finalize(context.Context, v1alpha1.TektonComponent) error }
Extension enables platform-specific features
func NoExtension ¶
NoPlatform "generates" a NilExtension
type ExtensionGenerator ¶
ExtensionGenerator creates an Extension from a Context
type ManifestFetcher ¶
type ManifestFetcher func(ctx context.Context, instance v1alpha1.TektonComponent) (*mf.Manifest, error)
ManifestFetcher returns a manifest appropriate for the instance
type NameGenerator ¶
type NameGenerator interface { // RestrictLengthWithRandomSuffix generates a valid name from the base name, adding a random suffix to the // the base. If base is valid, the returned name must also be valid. The generator is // responsible for knowing the maximum valid name length. RestrictLengthWithRandomSuffix(base string) string // RestrictLength generates a valid name from the name of a step specified in a Task, // shortening it to the maximum valid name length if needed. RestrictLength(base string) string }
NameGenerator generates names for objects. Some backends may have more information available to guide selection of new names and this interface hides those details.
var SimpleNameGenerator NameGenerator = simpleNameGenerator{}
SimpleNameGenerator is a generator that returns the name plus a random suffix of five alphanumerics when a name is requested. The string is guaranteed to not exceed the length of a standard Kubernetes name (63 characters)
type PayloadOptions ¶ added in v0.55.0
type PayloadOptions struct {
ReadOnly bool
}
type Recorder ¶ added in v0.63.0
type Recorder struct { }
func (*Recorder) LogMetrics ¶ added in v0.63.0
func (m *Recorder) LogMetrics(status, version string, logger *zap.SugaredLogger)
type Stage ¶
Stage represents a step in the reconcile process
func DeleteObsoleteResources ¶
func DeleteObsoleteResources(ctx context.Context, instance v1alpha1.TektonComponent, 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.
type VersionError ¶ added in v0.50.0
type VersionError error