Documentation ¶
Index ¶
- Constants
- Variables
- func ListAllCachedValues(ctx context.Context, labelKey string, installer Installer) []string
- type Cache
- func (c *Cache) Delete(obj *unstructured.Unstructured)
- func (c *Cache) Get(key kuberesource.ResourceKey) *unstructured.Unstructured
- func (c *Cache) Init(ctx context.Context, cfg *rest.Config, ...) error
- func (c *Cache) List() kuberesource.UnstructuredResources
- func (c *Cache) Refresh(ctx context.Context, cfg *rest.Config, ...) error
- func (c *Cache) Set(obj *unstructured.Unstructured)
- type CallbackOption
- func (cb *CallbackOption) PostCreate(res *unstructured.Unstructured) error
- func (cb *CallbackOption) PostDelete(res *unstructured.Unstructured) error
- func (cb *CallbackOption) PostInstall() error
- func (cb *CallbackOption) PostUpdate(res *unstructured.Unstructured) error
- func (cb *CallbackOption) PreCreate(res *unstructured.Unstructured) error
- func (cb *CallbackOption) PreDelete(res *unstructured.Unstructured) error
- func (cb *CallbackOption) PreInstall() error
- func (cb *CallbackOption) PreUpdate(res *unstructured.Unstructured) error
- type CallbackOptions
- type CreationPolicy
- type Installer
- type KubeInstaller
- type KubeInstallerOptions
- type ReconcileParams
Constants ¶
View Source
const ( // Attempt to create, return any error CreationPolicy_ReturnErrors = iota // Attempt to create, ignore AlreadyExists error CreationPolicy_IgnoreOnExists // Attempt to create, fall back to Update on AlreadyExists error CreationPolicy_UpdateOnExists // Attempt to create, fall back to Update on AlreadyExists error, fall back to Destroy&Recreate on ImmutableField error CreationPolicy_ForceUpdateOnExists )
Variables ¶
View Source
var DefaultFilters = []kuberesource.FilterResource{ func(resource schema.GroupVersionResource) bool { for _, ignoredType := range ignoreTypesForInstall { if resource.String() == ignoredType.String() { return true } } return false }, }
to speed up the cache init, filter out resource types
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Contains a snapshot of all installed resources Starts with a snapshot of everytihng in cluster Warning: takes about 30-45s (in testing) to initialize this cache
func (*Cache) Delete ¶
func (c *Cache) Delete(obj *unstructured.Unstructured)
func (*Cache) Get ¶
func (c *Cache) Get(key kuberesource.ResourceKey) *unstructured.Unstructured
func (*Cache) Init ¶
func (c *Cache) Init(ctx context.Context, cfg *rest.Config, filterFuncs ...kuberesource.FilterResource) error
Initialize the cache with the snapshot of the current cluster
func (*Cache) List ¶
func (c *Cache) List() kuberesource.UnstructuredResources
func (*Cache) Refresh ¶
func (c *Cache) Refresh(ctx context.Context, cfg *rest.Config, filterFuncs ...kuberesource.FilterResource) error
Refresh the cache with the snapshot of the current cluster
func (*Cache) Set ¶
func (c *Cache) Set(obj *unstructured.Unstructured)
type CallbackOption ¶
type CallbackOption struct { OnPreInstall func() error OnPostInstall func() error OnPreCreate func(res *unstructured.Unstructured) error OnPostCreate func(res *unstructured.Unstructured) error OnPreUpdate func(res *unstructured.Unstructured) error OnPostUpdate func(res *unstructured.Unstructured) error OnPreDelete func(res *unstructured.Unstructured) error OnPostDelete func(res *unstructured.Unstructured) error }
func (*CallbackOption) PostCreate ¶
func (cb *CallbackOption) PostCreate(res *unstructured.Unstructured) error
func (*CallbackOption) PostDelete ¶
func (cb *CallbackOption) PostDelete(res *unstructured.Unstructured) error
func (*CallbackOption) PostInstall ¶
func (cb *CallbackOption) PostInstall() error
func (*CallbackOption) PostUpdate ¶
func (cb *CallbackOption) PostUpdate(res *unstructured.Unstructured) error
func (*CallbackOption) PreCreate ¶
func (cb *CallbackOption) PreCreate(res *unstructured.Unstructured) error
func (*CallbackOption) PreDelete ¶
func (cb *CallbackOption) PreDelete(res *unstructured.Unstructured) error
func (*CallbackOption) PreInstall ¶
func (cb *CallbackOption) PreInstall() error
func (*CallbackOption) PreUpdate ¶
func (cb *CallbackOption) PreUpdate(res *unstructured.Unstructured) error
type CallbackOptions ¶
type CallbackOptions interface { PreInstall() error PostInstall() error PreCreate(res *unstructured.Unstructured) error PostCreate(res *unstructured.Unstructured) error PreUpdate(res *unstructured.Unstructured) error PostUpdate(res *unstructured.Unstructured) error PreDelete(res *unstructured.Unstructured) error PostDelete(res *unstructured.Unstructured) error }
type CreationPolicy ¶
type CreationPolicy int
policies for how to handle resource creation specifies behavior when resource creation fails
type Installer ¶
type Installer interface { ReconcileResources(ctx context.Context, params ReconcileParams) error PurgeResources(ctx context.Context, withLabels map[string]string) error ListAllResources(ctx context.Context) kuberesource.UnstructuredResources }
an interface allowing these methods to be mocked
type KubeInstaller ¶
type KubeInstaller struct {
// contains filtered or unexported fields
}
func NewKubeInstaller ¶
func NewKubeInstaller(cfg *rest.Config, cache *Cache, opts *KubeInstallerOptions) (*KubeInstaller, error)
NewKubeInstaller does not initialize the cache. Should be one once globally
func (*KubeInstaller) ListAllResources ¶
func (r *KubeInstaller) ListAllResources(ctx context.Context) kuberesource.UnstructuredResources
func (*KubeInstaller) PurgeResources ¶
func (*KubeInstaller) ReconcileResources ¶
func (r *KubeInstaller) ReconcileResources(ctx context.Context, params ReconcileParams) error
type KubeInstallerOptions ¶
type KubeInstallerOptions struct { Callbacks []CallbackOptions RetryOptions []retry.Option // define how to handle AlreadyExist errors on resource creation CreationPolicy CreationPolicy }
type ReconcileParams ¶
type ReconcileParams struct { InstallNamespace string Resources kuberesource.UnstructuredResources OwnerLabels map[string]string // respect hard-coded namespaces inside of manifests RespectManifestNamespaces bool }
func NewReconcileParams ¶
func NewReconcileParams(installNamespace string, resources kuberesource.UnstructuredResources, ownerLabels map[string]string, respectManifestNamespaces bool) ReconcileParams
Click to show internal directories.
Click to hide internal directories.