Documentation
¶
Index ¶
- Constants
- Variables
- func DisclaimerTransform(_ context.Context, _ Object, resources []*unstructured.Unstructured) error
- func KymaComponentTransform(_ context.Context, obj Object, resources []*unstructured.Unstructured) error
- func ManagedByOwnedBy(_ context.Context, obj Object, resources []*unstructured.Unstructured) error
- func NewClientProxy(config *rest.Config, mapper meta.RESTMapper) (client.Client, error)
- type Client
- type ClientCache
- type ClientCacheKeyFn
- type ClusterFn
- type ClusterInfo
- type ExistsStateCheck
- type InMemoryManifestCache
- type ManagedByLabelRemoval
- type ManifestAPIClient
- type ManifestCache
- type ManifestParser
- type MemoryClientCache
- type Object
- type ObjectTransform
- type Option
- type Options
- type PostRenderTransformOption
- type ProxyClient
- func (p *ProxyClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (p *ProxyClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (p *ProxyClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (p *ProxyClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, ...) error
- func (p *ProxyClient) GroupVersionKindFor(obj machineryruntime.Object) (schema.GroupVersionKind, error)
- func (p *ProxyClient) IsObjectNamespaced(obj machineryruntime.Object) (bool, error)
- func (p *ProxyClient) List(ctx context.Context, obj client.ObjectList, opts ...client.ListOption) error
- func (p *ProxyClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (p *ProxyClient) RESTMapper() meta.RESTMapper
- func (p *ProxyClient) Scheme() *machineryruntime.Scheme
- func (p *ProxyClient) Status() client.StatusWriter
- func (p *ProxyClient) SubResource(subResource string) client.SubResourceClient
- func (p *ProxyClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type Reconciler
- type ResourceList
- func (r *ResourceList) Append(val *resource.Info)
- func (r ResourceList) Contains(info *resource.Info) bool
- func (r ResourceList) Difference(rs ResourceList) ResourceList
- func (r ResourceList) Filter(fn func(*resource.Info) bool) ResourceList
- func (r ResourceList) Get(info *resource.Info) *resource.Info
- func (r ResourceList) Intersect(rs ResourceList) ResourceList
- func (r ResourceList) Visit(fn resource.VisitorFunc) error
- type SingletonClients
- func (s *SingletonClients) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)
- func (s *SingletonClients) OpenAPIGetter() *openapi.CachedOpenAPIGetter
- func (s *SingletonClients) OpenAPISchema() (openapi.Resources, error)
- func (s *SingletonClients) ResourceInfo(obj *unstructured.Unstructured, retryOnNoMatch bool) (*resource.Info, error)
- func (s *SingletonClients) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (s *SingletonClients) ToRESTConfig() (*rest.Config, error)
- func (s *SingletonClients) ToRESTMapper() (meta.RESTMapper, error)
- func (s *SingletonClients) ToRawKubeConfigLoader() clientcmd.ClientConfig
- func (s *SingletonClients) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)
- type Spec
- type SpecResolver
- type StateCheck
- type WithClientCacheKeyOption
- type WithCustomResourceLabels
- type WithCustomStateCheckOption
- type WithManagerOption
- type WithManifestCache
- type WithManifestParserOption
- type WithRemoteTargetClusterOption
- type WithSingletonClientCacheOption
Constants ¶
const ( DisclaimerAnnotation = shared.OperatorGroup + shared.Separator + "managed-by-reconciler-disclaimer" DisclaimerAnnotationValue = "DO NOT EDIT - This resource is managed by Kyma.\n" + "Any modifications are discarded and the resource is reverted to the original state." OwnedByFormat = "%s/%s" )
const ( EventRecorderDefault = "declarative.kyma-project.io/events" DefaultInMemoryParseTTL = 24 * time.Hour )
const (
ManifestFilePrefix = "manifest"
)
const (
SyncedOCIRefAnnotation = "sync-oci-ref"
)
Variables ¶
var ( ErrManagerInErrorState = errors.New("manager is in error state") ErrResourceSyncDiffInSameOCILayer = errors.New("resource syncTarget diff detected but in " + "same oci layer, prevent sync resource to be deleted") )
var ErrNotValidClientObject = errors.New("object in resource info is not a valid client object")
Functions ¶
func DisclaimerTransform ¶
func DisclaimerTransform(_ context.Context, _ Object, resources []*unstructured.Unstructured) error
func KymaComponentTransform ¶
func KymaComponentTransform(_ context.Context, obj Object, resources []*unstructured.Unstructured) error
func ManagedByOwnedBy ¶
func ManagedByOwnedBy(_ context.Context, obj Object, resources []*unstructured.Unstructured) error
func NewClientProxy ¶
NewClientProxy returns a new instance of ProxyClient.
Types ¶
type Client ¶
type Client interface { resource.RESTClientGetter skrresources.ResourceInfoConverter client.Client }
type ClientCache ¶
type ClusterInfo ¶
ClusterInfo describes client and config for a cluster.
func (ClusterInfo) IsEmpty ¶
func (r ClusterInfo) IsEmpty() bool
IsEmpty indicates if ClusterInfo is empty.
type ExistsStateCheck ¶
type ExistsStateCheck struct{}
func NewExistsStateCheck ¶
func NewExistsStateCheck() *ExistsStateCheck
type InMemoryManifestCache ¶
type InMemoryManifestCache struct { TTL time.Duration *ttlcache.Cache[string, internal.ManifestResources] }
func NewInMemoryCachedManifestParser ¶
func NewInMemoryCachedManifestParser(ttl time.Duration) *InMemoryManifestCache
func (*InMemoryManifestCache) EvictCache ¶
func (c *InMemoryManifestCache) EvictCache(spec *Spec)
func (*InMemoryManifestCache) Parse ¶
func (c *InMemoryManifestCache) Parse(spec *Spec, ) (internal.ManifestResources, error)
type ManagedByLabelRemoval ¶
type ManifestAPIClient ¶
type ManifestCache ¶
type ManifestCache string
type ManifestParser ¶
type ManifestParser interface { Parse(spec *Spec) (internal.ManifestResources, error) EvictCache(spec *Spec) }
type MemoryClientCache ¶
type MemoryClientCache struct {
// contains filtered or unexported fields
}
func NewMemoryClientCache ¶
func NewMemoryClientCache() *MemoryClientCache
func (*MemoryClientCache) AddClient ¶
func (m *MemoryClientCache) AddClient(key string, value Client)
func (*MemoryClientCache) DeleteClient ¶
func (m *MemoryClientCache) DeleteClient(key string)
func (*MemoryClientCache) GetClient ¶
func (m *MemoryClientCache) GetClient(key string) Client
func (*MemoryClientCache) Size ¶
func (m *MemoryClientCache) Size() int
type ObjectTransform ¶
type ObjectTransform = func(context.Context, Object, []*unstructured.Unstructured) error
type Options ¶
type Options struct { record.EventRecorder Config *rest.Config client.Client TargetCluster ClusterFn ClientCache ClientCacheKeyFn ManifestParser ManifestCache CustomStateCheck StateCheck PostRenderTransforms []ObjectTransform }
func DefaultOptions ¶
func DefaultOptions() *Options
type PostRenderTransformOption ¶
type PostRenderTransformOption struct {
ObjectTransforms []ObjectTransform
}
func WithPostRenderTransform ¶
func WithPostRenderTransform(transforms ...ObjectTransform) PostRenderTransformOption
func (PostRenderTransformOption) Apply ¶
func (o PostRenderTransformOption) Apply(options *Options)
type ProxyClient ¶
type ProxyClient struct {
// contains filtered or unexported fields
}
ProxyClient holds information required to proxy Client requests to verify RESTMapper integrity. During the proxy, the underlying mapper verifies mapping for the calling resource. If not available and NoMatchesKind error occurs, the mappings are reset (if type meta.ResettableRESTMapper). After reset a follow-up call verifies if mappings are now available.
func (*ProxyClient) Create ¶
func (p *ProxyClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
Create implements client.Client.
func (*ProxyClient) Delete ¶
func (p *ProxyClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
Delete implements client.Client.
func (*ProxyClient) DeleteAllOf ¶
func (p *ProxyClient) DeleteAllOf( ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption, ) error
DeleteAllOf implements client.Client.
func (*ProxyClient) Get ¶
func (p *ProxyClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption, ) error
Get implements client.Client.
func (*ProxyClient) GroupVersionKindFor ¶
func (p *ProxyClient) GroupVersionKindFor(obj machineryruntime.Object) (schema.GroupVersionKind, error)
func (*ProxyClient) IsObjectNamespaced ¶
func (p *ProxyClient) IsObjectNamespaced(obj machineryruntime.Object) (bool, error)
func (*ProxyClient) List ¶
func (p *ProxyClient) List(ctx context.Context, obj client.ObjectList, opts ...client.ListOption) error
List implements client.Client.
func (*ProxyClient) Patch ¶
func (p *ProxyClient) Patch( ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption, ) error
Patch implements client.Client.
func (*ProxyClient) RESTMapper ¶
func (p *ProxyClient) RESTMapper() meta.RESTMapper
RESTMapper returns the rest mapper this client is using.
func (*ProxyClient) Scheme ¶
func (p *ProxyClient) Scheme() *machineryruntime.Scheme
Scheme returns the scheme this client is using.
func (*ProxyClient) Status ¶
func (p *ProxyClient) Status() client.StatusWriter
Status implements client.StatusClient.
func (*ProxyClient) SubResource ¶
func (p *ProxyClient) SubResource(subResource string) client.SubResourceClient
func (*ProxyClient) Update ¶
func (p *ProxyClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
Update implements client.Client.
type Reconciler ¶
type Reconciler struct { queue.RequeueIntervals *Options ManifestMetrics *metrics.ManifestMetrics MandatoryModuleMetrics *metrics.MandatoryModulesMetrics // contains filtered or unexported fields }
func NewFromManager ¶
func NewFromManager(mgr manager.Manager, requeueIntervals queue.RequeueIntervals, metrics *metrics.ManifestMetrics, mandatoryModulesMetrics *metrics.MandatoryModulesMetrics, manifestAPIClient ManifestAPIClient, specResolver SpecResolver, options ...Option, ) *Reconciler
type ResourceList ¶
ResourceList provides convenience methods for comparing collections of Infos. Copy from helm.sh/helm/v3/pkg/kube.
func (*ResourceList) Append ¶
func (r *ResourceList) Append(val *resource.Info)
Append adds an Info to the Result.
func (ResourceList) Contains ¶
func (r ResourceList) Contains(info *resource.Info) bool
Contains checks to see if an object exists.
func (ResourceList) Difference ¶
func (r ResourceList) Difference(rs ResourceList) ResourceList
Difference will return a new Result with objects not contained in rs.
func (ResourceList) Filter ¶
func (r ResourceList) Filter(fn func(*resource.Info) bool) ResourceList
Filter returns a new Result with Infos that satisfy the predicate fn.
func (ResourceList) Get ¶
func (r ResourceList) Get(info *resource.Info) *resource.Info
Get returns the Info from the result that matches the name and kind.
func (ResourceList) Intersect ¶
func (r ResourceList) Intersect(rs ResourceList) ResourceList
Intersect will return a new Result with objects contained in both Results.
func (ResourceList) Visit ¶
func (r ResourceList) Visit(fn resource.VisitorFunc) error
Visit implements resource.Visitor.
type SingletonClients ¶
type SingletonClients struct { // controller runtime client client.Client // contains filtered or unexported fields }
SingletonClients serves as a single-minded client interface that combines all kubernetes Client APIs (Kubernetes, Client-Go) under the hood. It offers a simple initialization lifecycle during creation, but delegates all heavy-duty work to deferred discovery logic and a single http client as well as a client cache to support GV-based clients.
func NewSingletonClients ¶
func NewSingletonClients(info *ClusterInfo) (*SingletonClients, error)
func (*SingletonClients) ClientForMapping ¶
func (s *SingletonClients) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)
ClientForMapping returns a RESTClient for working with the specified RESTMapping or an error. This is intended for working with arbitrary resources and is not guaranteed to point to a Kubernetes APIServer.
func (*SingletonClients) OpenAPIGetter ¶
func (s *SingletonClients) OpenAPIGetter() *openapi.CachedOpenAPIGetter
OpenAPIGetter returns a getter for the openapi schema document.
func (*SingletonClients) OpenAPISchema ¶
func (s *SingletonClients) OpenAPISchema() (openapi.Resources, error)
OpenAPISchema returns metadata and structural information about Kubernetes object definitions.
func (*SingletonClients) ResourceInfo ¶
func (s *SingletonClients) ResourceInfo(obj *unstructured.Unstructured, retryOnNoMatch bool) (*resource.Info, error)
func (*SingletonClients) ToDiscoveryClient ¶
func (s *SingletonClients) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*SingletonClients) ToRESTConfig ¶
func (s *SingletonClients) ToRESTConfig() (*rest.Config, error)
func (*SingletonClients) ToRESTMapper ¶
func (s *SingletonClients) ToRESTMapper() (meta.RESTMapper, error)
func (*SingletonClients) ToRawKubeConfigLoader ¶
func (s *SingletonClients) ToRawKubeConfigLoader() clientcmd.ClientConfig
func (*SingletonClients) UnstructuredClientForMapping ¶
func (s *SingletonClients) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)
UnstructuredClientForMapping returns a RESTClient for working with Unstructured objects.
type SpecResolver ¶
type StateCheck ¶
type WithClientCacheKeyOption ¶
type WithClientCacheKeyOption struct {
ClientCacheKeyFn
}
func (WithClientCacheKeyOption) Apply ¶
func (o WithClientCacheKeyOption) Apply(options *Options)
type WithCustomResourceLabels ¶
func (WithCustomResourceLabels) Apply ¶
func (o WithCustomResourceLabels) Apply(options *Options)
type WithCustomStateCheckOption ¶
type WithCustomStateCheckOption struct {
StateCheck
}
func WithCustomStateCheck ¶
func WithCustomStateCheck(check StateCheck) WithCustomStateCheckOption
func (WithCustomStateCheckOption) Apply ¶
func (o WithCustomStateCheckOption) Apply(options *Options)
type WithManagerOption ¶
func WithManager ¶
func WithManager(mgr manager.Manager) WithManagerOption
func (WithManagerOption) Apply ¶
func (o WithManagerOption) Apply(options *Options)
type WithManifestCache ¶
type WithManifestCache ManifestCache
func (WithManifestCache) Apply ¶
func (o WithManifestCache) Apply(options *Options)
type WithManifestParserOption ¶
type WithManifestParserOption struct {
ManifestParser
}
func WithManifestParser ¶
func WithManifestParser(parser ManifestParser) WithManifestParserOption
func (WithManifestParserOption) Apply ¶
func (o WithManifestParserOption) Apply(options *Options)
type WithRemoteTargetClusterOption ¶
type WithRemoteTargetClusterOption struct {
ClusterFn
}
func WithRemoteTargetCluster ¶
func WithRemoteTargetCluster(configFn ClusterFn) WithRemoteTargetClusterOption
func (WithRemoteTargetClusterOption) Apply ¶
func (o WithRemoteTargetClusterOption) Apply(options *Options)
type WithSingletonClientCacheOption ¶
type WithSingletonClientCacheOption struct {
ClientCache
}
func WithSingletonClientCache ¶
func WithSingletonClientCache(cache ClientCache) WithSingletonClientCacheOption
func (WithSingletonClientCacheOption) Apply ¶
func (o WithSingletonClientCacheOption) Apply(options *Options)