Documentation
¶
Index ¶
- Constants
- func AnchorName(instance base.KComponent) string
- func AppendAdditionalManifests(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func AppendInstalled(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func AppendTarget(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func CheckDeployments(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func CheckWebhookDeployment(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func ClearCache()
- func ClusterProfileProviderFile() string
- func ClusterScopedResource(apiVersion, kind, name string) *unstructured.Unstructured
- func ConfigMapTransform(config base.ConfigMapData, log *zap.SugaredLogger) mf.Transformer
- func DeleteAnchorConfigMap(ctx context.Context, kubeClient kubernetes.Interface, instance base.KComponent) error
- func EnsureAnchorConfigMap(ctx context.Context, kubeClient kubernetes.Interface, instance base.KComponent) (*corev1.ConfigMap, error)
- func FetchManifest(path string) (mf.Manifest, error)
- func FetchManifestFromArray(paths []string) (mf.Manifest, error)
- func FinalizeRemoteCluster(ctx context.Context, clients RemoteClusterClients, manifest *mf.Manifest, ...) error
- func FinalizeRemoteClusterIfNeeded(ctx context.Context, provider *ClusterProvider, manifest *mf.Manifest, ...) (bool, error)
- func FinalizerRemovalPatch(obj base.KComponent, toRemove string) ([]byte, error)
- func GetLatestIngressRelease(version string) string
- func GetLatestRelease(instance base.KComponent, version string) string
- func HighAvailabilityTransform(obj base.KComponent) mf.Transformer
- func ImageTransform(registry *base.Registry, log *zap.SugaredLogger) mf.Transformer
- func InjectLabel(key, value string) mf.Transformer
- func InjectNamespace(manifest *mf.Manifest, instance base.KComponent, extra ...mf.Transformer) error
- func InjectOwner(owner mf.Owner, anchorOwner mf.Owner) mf.Transformer
- func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func InstallWebhookConfigs(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func InstallWebhookDependentResources(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func InstalledManifest(instance base.KComponent) (mf.Manifest, error)
- func IsDeploymentsNotReadyError(err error) bool
- func IsVersionValidMigrationEligible(instance base.KComponent) error
- func JobTransform(obj base.KComponent) mf.Transformer
- func KubernetesMinVersionTransform() mf.Transformer
- func LatestRelease(instance base.KComponent) string
- func MarkStatusSuccess(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
- func NamespaceConfigurationTransform(namespaceConfiguration *base.NamespaceConfiguration) mf.Transformer
- func NamespacedResource(apiVersion, kind, ns, name string) *unstructured.Unstructured
- func NoOp(context.Context, *mf.Manifest, base.KComponent) error
- func OverridesTransform(overrides []base.WorkloadOverride, log *zap.SugaredLogger) mf.Transformer
- func PodDisruptionBudgetsTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
- func RemoteDeploymentsPollIntervalValue() time.Duration
- func ResourceRequirementsTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
- func SameClusterProfile(a, b *base.ClusterProfileReference) bool
- func SanitizeSemver(version string) string
- func ServicesTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
- func ShouldFinalizeClusterScoped(components []base.KComponent, original base.KComponent) bool
- func TargetAdditionalManifest(instance base.KComponent) (mf.Manifest, error)
- func TargetManifest(instance base.KComponent) (mf.Manifest, error)
- func TargetManifestPathArray(instance base.KComponent) []string
- func TargetVersion(instance base.KComponent) string
- func Transform(ctx context.Context, manifest *mf.Manifest, instance base.KComponent, ...) error
- func Uninstall(manifest *mf.Manifest) error
- func UpdateConfigMap(cm *unstructured.Unstructured, data map[string]string, log *zap.SugaredLogger) error
- type ClientFactory
- type ClusterProfileAccess
- type ClusterProfileListener
- type ClusterProvider
- func (c *ClusterProvider) CloseAll()
- func (c *ClusterProvider) Get(ctx context.Context, clusterName string) (RemoteClusterClients, string, error)
- func (c *ClusterProvider) GetOrRefresh(ctx context.Context, namespace, name string) (RemoteClusterClients, string, error)
- func (c *ClusterProvider) Refresh(ctx context.Context, namespace, name string) (string, error)
- func (c *ClusterProvider) RegisterListener(l ClusterProfileListener)
- func (c *ClusterProvider) Remove(key string)
- func (c *ClusterProvider) StartInformer(ctx context.Context)
- type ExecuteResult
- type Extension
- type ExtensionGenerator
- type ManifestFetcher
- type NoOpClusterProfileAccess
- type ProviderOption
- type ReconcileState
- type RemoteClusterClients
- 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 = "," // LATEST_VERSION is the special version Knative Operator support, besides all semantic versions of Knative. LATEST_VERSION = "latest" )
Variables ¶
This section is empty.
Functions ¶
func AnchorName ¶ added in v0.49.0
func AnchorName(instance base.KComponent) string
func AppendAdditionalManifests ¶ added in v0.22.0
func AppendAdditionalManifests(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
AppendAdditionalManifests mutates the passed manifest by appending the manifests specified with the field spec.additionalManifests.
func AppendInstalled ¶ added in v0.16.0
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 ¶
CheckDeployments checks all deployments in the given manifest and updates the given status with the status of the deployments.
func CheckWebhookDeployment ¶ added in v0.47.0
func CheckWebhookDeployment(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
CheckWebhookDeployment checks if the webhook deployment is ready. This is needed before creating webhook-dependent resources (e.g., Certificates) because the ValidatingWebhookConfiguration with failurePolicy=Fail will reject Certificate creation if the webhook pod is not ready.
func ClearCache ¶ added in v0.22.0
func ClearCache()
ClearCache removes all the records saved in the cache.
func ClusterProfileProviderFile ¶ added in v0.49.0
func ClusterProfileProviderFile() string
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 base.ConfigMapData, log *zap.SugaredLogger) mf.Transformer
ConfigMapTransform updates the ConfigMap with the values specified in operator CR
func DeleteAnchorConfigMap ¶ added in v0.49.0
func DeleteAnchorConfigMap( ctx context.Context, kubeClient kubernetes.Interface, instance base.KComponent, ) error
func EnsureAnchorConfigMap ¶ added in v0.49.0
func EnsureAnchorConfigMap( ctx context.Context, kubeClient kubernetes.Interface, instance base.KComponent, ) (*corev1.ConfigMap, error)
EnsureAnchorConfigMap creates or updates the anchor ConfigMap on the remote cluster.
func FetchManifest ¶ added in v0.21.0
FetchManifest returns the manifest by either getting it from the cache, or reading them from the path. The manifest is saved in the cache, if it is not available.
func FetchManifestFromArray ¶ added in v0.38.0
FetchManifestFromArray returns the manifest by either getting it from the cache, or reading them from the path. The manifest is saved in the cache, if it is not available.
func FinalizeRemoteCluster ¶ added in v0.49.0
func FinalizeRemoteCluster( ctx context.Context, clients RemoteClusterClients, manifest *mf.Manifest, instance base.KComponent, optionalPreds ...mf.Predicate, ) error
func FinalizeRemoteClusterIfNeeded ¶ added in v0.49.0
func FinalizeRemoteClusterIfNeeded( ctx context.Context, provider *ClusterProvider, manifest *mf.Manifest, instance base.KComponent, optionalPreds ...mf.Predicate, ) (bool, error)
FinalizeRemoteClusterIfNeeded runs remote finalization if the instance targets a remote cluster.
func FinalizerRemovalPatch ¶
func FinalizerRemovalPatch(obj base.KComponent, toRemove string) ([]byte, error)
FinalizerRemovalPatch generates a patch for removing the given finalizer.
func GetLatestIngressRelease ¶ added in v0.23.0
GetLatestIngressRelease returns the latest release tag available under kodata directory for the ingress based on spec.version.
func GetLatestRelease ¶
func GetLatestRelease(instance base.KComponent, version string) string
GetLatestRelease returns the latest release tag available under kodata directory for Knative component based on spec.version.
func HighAvailabilityTransform ¶ added in v0.21.0
func HighAvailabilityTransform(obj base.KComponent) mf.Transformer
HighAvailabilityTransform mutates configmaps and replicacounts of certain controllers when HA control plane is specified.
func ImageTransform ¶
func ImageTransform(registry *base.Registry, log *zap.SugaredLogger) mf.Transformer
ImageTransform updates image with a new registry and tag
func InjectLabel ¶ added in v0.43.6
func InjectLabel(key, value string) mf.Transformer
InjectLabel adds the given key and value as label.
func InjectNamespace ¶ added in v0.38.0
func InjectNamespace(manifest *mf.Manifest, instance base.KComponent, extra ...mf.Transformer) error
InjectNamespace will mutate the namespace of all installed resources
func InjectOwner ¶ added in v0.49.0
InjectOwner sets OwnerReference on namespace-scoped resources.
func Install ¶
Install applies the manifest resources for the given version and updates the given status accordingly.
func InstallWebhookConfigs ¶ added in v0.43.4
func InstallWebhookConfigs(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
InstallWebhookConfigs applies the Webhook manifest resources and updates the given status accordingly.
func InstallWebhookDependentResources ¶ added in v0.43.4
func InstallWebhookDependentResources(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error
InstallWebhookDependentResources applies the Webhook dependent resources updates the given status accordingly.
func InstalledManifest ¶ added in v0.16.0
func InstalledManifest(instance base.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 IsDeploymentsNotReadyError ¶ added in v0.43.4
IsDeploymentsNotReadyError returns true if the given error is a deploymentsNotReadyError.
func IsVersionValidMigrationEligible ¶ added in v0.19.0
func IsVersionValidMigrationEligible(instance base.KComponent) error
IsVersionValidMigrationEligible returns the bool indicate whether the target version is valid and the installed manifest is able to upgrade or downgrade to the target manifest.
func JobTransform ¶ added in v0.16.0
func JobTransform(obj base.KComponent) mf.Transformer
JobTransform updates the job with the expected value for the key app in the label
func KubernetesMinVersionTransform ¶ added in v0.49.0
func KubernetesMinVersionTransform() mf.Transformer
KubernetesMinVersionTransform injects KUBERNETES_MIN_VERSION into all workloads managed by this operator instance so operand components can honor the override.
func LatestRelease ¶ added in v0.36.0
func LatestRelease(instance base.KComponent) string
LatestRelease returns the latest release tag available under kodata directory for Knative component.
func MarkStatusSuccess ¶ added in v0.43.4
MarkStatusSuccess updates the component status to success.
func NamespaceConfigurationTransform ¶ added in v0.43.0
func NamespaceConfigurationTransform(namespaceConfiguration *base.NamespaceConfiguration) mf.Transformer
NamespaceConfigurationTransform mutates the only namespace available for knative serving or eventing by changing the labels and annotations.
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 OverridesTransform ¶ added in v0.35.0
func OverridesTransform(overrides []base.WorkloadOverride, log *zap.SugaredLogger) mf.Transformer
OverridesTransform transforms deployments based on the configuration in `spec.overrides`.
func PodDisruptionBudgetsTransform ¶ added in v0.33.0
func PodDisruptionBudgetsTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
PodDisruptionBudgetsTransform transforms PodDisruptionBudgets based on the configuration in `spec.podDisruptionBudgets`.
func RemoteDeploymentsPollIntervalValue ¶ added in v0.49.0
RemoteDeploymentsPollIntervalValue returns the configured poll interval, clamping values below 1s to the default.
func ResourceRequirementsTransform ¶
func ResourceRequirementsTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
ResourceRequirementsTransform configures the resource requests for all containers within all deployments in the manifest
func SameClusterProfile ¶ added in v0.49.0
func SameClusterProfile(a, b *base.ClusterProfileReference) bool
func SanitizeSemver ¶ added in v0.21.0
SanitizeSemver always adds `v` in front of the version. x.y.z is the standard format we use as the semantic version for Knative. The letter `v` is added for comparison purpose.
func ServicesTransform ¶ added in v0.31.0
func ServicesTransform(obj base.KComponent, log *zap.SugaredLogger) mf.Transformer
ServicesTransform transforms services based on the configuration in `spec.service`.
func ShouldFinalizeClusterScoped ¶ added in v0.49.0
func ShouldFinalizeClusterScoped( components []base.KComponent, original base.KComponent, ) bool
ShouldFinalizeClusterScoped returns true when no other KComponent targets the same cluster.
func TargetAdditionalManifest ¶ added in v0.22.0
func TargetAdditionalManifest(instance base.KComponent) (mf.Manifest, error)
TargetAdditionalManifest returns the manifest for the TargetVersion specified with spec.additionalManifests.
func TargetManifest ¶ added in v0.16.0
func TargetManifest(instance base.KComponent) (mf.Manifest, error)
TargetManifest returns the default manifest for the TargetVersion or the manifest for the TargetVersion specified with spec.manifests
func TargetManifestPathArray ¶ added in v0.37.0
func TargetManifestPathArray(instance base.KComponent) []string
TargetManifestPathArray returns an array of strings, which include all the paths of the Serving or Eventing manifests.
func TargetVersion ¶ added in v0.16.0
func TargetVersion(instance base.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 base.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 ClientFactory ¶ added in v0.49.0
type ClientFactory interface {
NewMfClient(*rest.Config) (mf.Client, error)
NewKubeClient(*rest.Config) (kubernetes.Interface, error)
}
ClientFactory abstracts remote-cluster client construction.
type ClusterProfileAccess ¶ added in v0.49.0
type ClusterProfileAccess interface {
BuildConfigFromCP(cp *clusterinventoryv1alpha1.ClusterProfile) (*rest.Config, error)
}
ClusterProfileAccess builds a rest.Config from a ClusterProfile.
type ClusterProfileListener ¶ added in v0.49.0
type ClusterProfileListener struct {
ListCRs func(namespace, name string) []types.NamespacedName
EnqueueKey func(types.NamespacedName)
}
ClusterProfileListener receives notifications when a ClusterProfile changes.
type ClusterProvider ¶ added in v0.49.0
type ClusterProvider struct {
// contains filtered or unexported fields
}
ClusterProvider resolves ClusterProfile references into cached client sets.
func GetOrCreateClusterProvider ¶ added in v0.49.0
func NewClusterProvider ¶ added in v0.49.0
func NewClusterProvider( controllerCtx context.Context, localConfig *rest.Config, providerFile string, opts ...ProviderOption, ) (*ClusterProvider, error)
func (*ClusterProvider) CloseAll ¶ added in v0.49.0
func (c *ClusterProvider) CloseAll()
func (*ClusterProvider) Get ¶ added in v0.49.0
func (c *ClusterProvider) Get(ctx context.Context, clusterName string) (RemoteClusterClients, string, error)
func (*ClusterProvider) GetOrRefresh ¶ added in v0.49.0
func (c *ClusterProvider) GetOrRefresh(ctx context.Context, namespace, name string) (RemoteClusterClients, string, error)
func (*ClusterProvider) RegisterListener ¶ added in v0.49.0
func (c *ClusterProvider) RegisterListener(l ClusterProfileListener)
func (*ClusterProvider) Remove ¶ added in v0.49.0
func (c *ClusterProvider) Remove(key string)
func (*ClusterProvider) StartInformer ¶ added in v0.49.0
func (c *ClusterProvider) StartInformer(ctx context.Context)
type ExecuteResult ¶ added in v0.49.0
type ExecuteResult struct {
DeploymentsNotReady bool
}
type Extension ¶ added in v0.16.0
type Extension interface {
Manifests(base.KComponent) ([]mf.Manifest, error)
Transformers(base.KComponent) []mf.Transformer
Reconcile(context.Context, base.KComponent) error
Finalize(context.Context, base.KComponent) error
}
Extension enables platform-specific features
func NoExtension ¶ added in v0.16.0
func NoExtension(context.Context, *controller.Impl) Extension
NoPlatform "generates" a NilExtension
type ExtensionGenerator ¶ added in v0.16.0
type ExtensionGenerator func(context.Context, *controller.Impl) Extension
ExtensionGenerator creates an Extension from a Context
type ManifestFetcher ¶ added in v0.16.0
ManifestFetcher returns a manifest appropriate for the instance
type NoOpClusterProfileAccess ¶ added in v0.49.0
type NoOpClusterProfileAccess struct{}
func (NoOpClusterProfileAccess) BuildConfigFromCP ¶ added in v0.49.0
func (NoOpClusterProfileAccess) BuildConfigFromCP(*clusterinventoryv1alpha1.ClusterProfile) (*rest.Config, error)
type ProviderOption ¶ added in v0.49.0
type ProviderOption func(*ClusterProvider)
ProviderOption configures a ClusterProvider.
func WithClientFactory ¶ added in v0.49.0
func WithClientFactory(f ClientFactory) ProviderOption
WithClientFactory overrides the factory used to construct remote-cluster clients.
type ReconcileState ¶ added in v0.49.0
type ReconcileState struct {
AnchorOwner mf.Owner
RemoteClients RemoteClusterClients
}
func (*ReconcileState) IsRemote ¶ added in v0.49.0
func (s *ReconcileState) IsRemote() bool
type RemoteClusterClients ¶ added in v0.49.0
type RemoteClusterClients interface {
MfClient() mf.Client
KubeClient() kubernetes.Interface
RestConfig() *rest.Config
}
RemoteClusterClients provides clients for a resolved remote cluster.
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 base.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.
func ResolveTargetCluster ¶ added in v0.49.0
func ResolveTargetCluster(provider *ClusterProvider, state *ReconcileState) Stage
Source Files
¶
- access_provider_flag.go
- clusterprofile_informer.go
- config_maps.go
- deployments.go
- env_override.go
- extensions.go
- finalizer.go
- ha.go
- hpa.go
- images.go
- install.go
- job.go
- kubernetes_min_version.go
- multicluster.go
- namespace.go
- poddisruptionbudget_override.go
- poll_interval_flag.go
- probe_override.go
- releases.go
- resources.go
- services_override.go
- stages.go
- transformers.go
- unstructured.go
- workload_override.go