Documentation ¶
Index ¶
- Constants
- Variables
- func DetectIfTagWebhookIsNeeded(iop *operatorv1a1.IstioOperator, exists bool) bool
- func InstallTreeString() string
- func NamespacedResources() []schema.GroupVersionKind
- func ProcessDefaultWebhook(client kube.Client, iop *operatorv1a1.IstioOperator, exists bool, ...) (processed bool, err error)
- func PrunedResourcesSchemas() []schema.GroupVersionKind
- func WaitForResources(objects object.K8sObjects, client kube.Client, waitTimeout time.Duration, ...) error
- type AppliedResult
- type ComponentTree
- type HelmReconciler
- func (h *HelmReconciler) ApplyManifest(manifest name.Manifest) (result AppliedResult, _ error)
- func (h *HelmReconciler) ApplyObject(obj *unstructured.Unstructured) error
- func (h *HelmReconciler) Delete() error
- func (h *HelmReconciler) DeleteIOPInClusterIfExists(iop *operatorv1a1.IstioOperator)
- func (h *HelmReconciler) DeleteObjectsList(objectsList []*unstructured.UnstructuredList, componentName string) error
- func (h *HelmReconciler) GetPrunedResources(revision string, includeClusterResources bool, componentName string) ([]*unstructured.UnstructuredList, error)
- func (h *HelmReconciler) Prune(manifests name.ManifestMap, all bool) error
- func (h *HelmReconciler) PruneControlPlaneByRevisionWithController(iopSpec *iopv1a1.IstioOperatorSpec) (*iopv1a1.InstallStatus, error)
- func (h *HelmReconciler) Reconcile() (*iopv1a1.InstallStatus, error)
- func (h *HelmReconciler) RenderCharts() (name.ManifestMap, error)
- func (h *HelmReconciler) SetStatusBegin() error
- func (h *HelmReconciler) SetStatusComplete(status *iopv1a1.InstallStatus) error
- type Options
- type ProcessDefaultWebhookOptions
Constants ¶
const ( // MetadataNamespace is the namespace for mesh metadata (labels, annotations) MetadataNamespace = "install.operator.istio.io" // OwningResourceName represents the name of the owner to which the resource relates OwningResourceName = MetadataNamespace + "/owning-resource" // OwningResourceNamespace represents the namespace of the owner to which the resource relates OwningResourceNamespace = MetadataNamespace + "/owning-resource-namespace" // OwningResourceNotPruned indicates that the resource should not be pruned during reconciliation cycles, // note this will not prevent the resource from being deleted if the owning resource is deleted. OwningResourceNotPruned = MetadataNamespace + "/owning-resource-not-pruned" // IstioComponentLabelStr indicates which Istio component a resource belongs to. IstioComponentLabelStr = name.OperatorAPINamespace + "/component" )
Variables ¶
var ( // ComponentDependencies is a tree of component dependencies. The semantics are ComponentDependencies[cname] gives // the subtree of components that must wait for cname to be installed before starting installation themselves. ComponentDependencies = componentNameToListMap{ name.PilotComponentName: { name.CNIComponentName, name.IngressComponentName, name.EgressComponentName, }, name.IstioBaseComponentName: { name.PilotComponentName, }, name.CNIComponentName: { name.ZtunnelComponentName, }, } // InstallTree is a top down hierarchy tree of dependencies where children must wait for the parent to complete // before starting installation. InstallTree = make(ComponentTree) )
var ( // ClusterResources are resource types the operator prunes, ordered by which types should be deleted, first to last. ClusterResources = []schema.GroupVersionKind{ {Group: "admissionregistration.k8s.io", Version: "v1", Kind: name.MutatingWebhookConfigurationStr}, {Group: "admissionregistration.k8s.io", Version: "v1", Kind: name.ValidatingWebhookConfigurationStr}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: name.ClusterRoleStr}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: name.ClusterRoleBindingStr}, } // ClusterCPResources lists cluster scope resources types which should be deleted during uninstall command. ClusterCPResources = []schema.GroupVersionKind{ {Group: "admissionregistration.k8s.io", Version: "v1", Kind: name.MutatingWebhookConfigurationStr}, {Group: "admissionregistration.k8s.io", Version: "v1", Kind: name.ValidatingWebhookConfigurationStr}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: name.ClusterRoleStr}, {Group: "rbac.authorization.k8s.io", Version: "v1", Kind: name.ClusterRoleBindingStr}, } // AllClusterResources lists all cluster scope resources types which should be deleted in purge case, including CRD. AllClusterResources = append(ClusterResources, schema.GroupVersionKind{Group: "apiextensions.k8s.io", Version: "v1", Kind: name.CRDStr}, schema.GroupVersionKind{Group: "k8s.cni.cncf.io", Version: "v1", Kind: name.NetworkAttachmentDefinitionStr}, ) )
var ( // TestMode sets the controller into test mode. Used for unit tests to bypass things like waiting on resources. TestMode = false )
Functions ¶
func DetectIfTagWebhookIsNeeded ¶
func DetectIfTagWebhookIsNeeded(iop *operatorv1a1.IstioOperator, exists bool) bool
func InstallTreeString ¶
func InstallTreeString() string
InstallTreeString returns a string representation of the dependency tree.
func NamespacedResources ¶
func NamespacedResources() []schema.GroupVersionKind
NamespacedResources gets specific pruning resources based on the k8s version
func ProcessDefaultWebhook ¶
func ProcessDefaultWebhook(client kube.Client, iop *operatorv1a1.IstioOperator, exists bool, opt *ProcessDefaultWebhookOptions) (processed bool, err error)
func PrunedResourcesSchemas ¶
func PrunedResourcesSchemas() []schema.GroupVersionKind
func WaitForResources ¶
func WaitForResources(objects object.K8sObjects, client kube.Client, waitTimeout time.Duration, dryRun bool, l *progress.ManifestLog, ) error
WaitForResources polls to get the current status of all pods, PVCs, and Services until all are ready or a timeout is reached
Types ¶
type AppliedResult ¶
type AppliedResult struct {
// contains filtered or unexported fields
}
AppliedResult is the result of applying a Manifest.
func (AppliedResult) Succeed ¶
func (r AppliedResult) Succeed() bool
Succeed returns true if the apply operation succeeded.
type ComponentTree ¶
type ComponentTree map[name.ComponentName]any
ComponentTree represents a tree of component dependencies.
type HelmReconciler ¶
type HelmReconciler struct {
// contains filtered or unexported fields
}
HelmReconciler reconciles resources rendered by a set of helm charts.
func NewHelmReconciler ¶
func NewHelmReconciler(client client.Client, kubeClient kube.Client, iop *operatorv1a1.IstioOperator, opts *Options) (*HelmReconciler, error)
NewHelmReconciler creates a HelmReconciler and returns a ptr to it
func (*HelmReconciler) ApplyManifest ¶
func (h *HelmReconciler) ApplyManifest(manifest name.Manifest) (result AppliedResult, _ error)
ApplyManifest applies the manifest to create or update resources. It returns the processed (created or updated) objects and the number of objects in the manifests.
func (*HelmReconciler) ApplyObject ¶
func (h *HelmReconciler) ApplyObject(obj *unstructured.Unstructured) error
ApplyObject creates or updates an object in the API server depending on whether it already exists. It mutates obj.
func (*HelmReconciler) Delete ¶
func (h *HelmReconciler) Delete() error
Delete resources associated with the custom resource instance
func (*HelmReconciler) DeleteIOPInClusterIfExists ¶
func (h *HelmReconciler) DeleteIOPInClusterIfExists(iop *operatorv1a1.IstioOperator)
func (*HelmReconciler) DeleteObjectsList ¶
func (h *HelmReconciler) DeleteObjectsList(objectsList []*unstructured.UnstructuredList, componentName string) error
DeleteObjectsList removed resources that are in the slice of UnstructuredList.
func (*HelmReconciler) GetPrunedResources ¶
func (h *HelmReconciler) GetPrunedResources(revision string, includeClusterResources bool, componentName string) ( []*unstructured.UnstructuredList, error, )
GetPrunedResources get the list of resources to be removed 1. if includeClusterResources is false, we list the namespaced resources by matching revision and component labels. 2. if includeClusterResources is true, we list the namespaced and cluster resources by component labels only. If componentName is not empty, only resources associated with specific components would be returned UnstructuredList of objects and corresponding list of name kind hash of k8sObjects would be returned
func (*HelmReconciler) Prune ¶
func (h *HelmReconciler) Prune(manifests name.ManifestMap, all bool) error
Prune removes any resources not specified in manifests generated by HelmReconciler h.
func (*HelmReconciler) PruneControlPlaneByRevisionWithController ¶
func (h *HelmReconciler) PruneControlPlaneByRevisionWithController(iopSpec *iopv1a1.IstioOperatorSpec) (*iopv1a1.InstallStatus, error)
PruneControlPlaneByRevisionWithController is called to remove specific control plane revision during reconciliation process of controller. It returns the install status and any error encountered.
func (*HelmReconciler) Reconcile ¶
func (h *HelmReconciler) Reconcile() (*iopv1a1.InstallStatus, error)
Reconcile reconciles the associated resources.
func (*HelmReconciler) RenderCharts ¶
func (h *HelmReconciler) RenderCharts() (name.ManifestMap, error)
RenderCharts renders charts for h.
func (*HelmReconciler) SetStatusBegin ¶
func (h *HelmReconciler) SetStatusBegin() error
SetStatusBegin updates the status field on the IstioOperator instance before reconciling.
func (*HelmReconciler) SetStatusComplete ¶
func (h *HelmReconciler) SetStatusComplete(status *iopv1a1.InstallStatus) error
SetStatusComplete updates the status field on the IstioOperator instance based on the resulting err parameter.
type Options ¶
type Options struct { // DryRun executes all actions but does not write anything to the cluster. DryRun bool // Log is a console logger for user visible CLI output. Log clog.Logger // Wait determines if we will wait for resources to be fully applied. Only applies to components that have no // dependencies. Wait bool // WaitTimeout controls the amount of time to wait for resources in a component to become ready before giving up. WaitTimeout time.Duration // Log tracks the installation progress for all components. ProgressLog *progress.Log // Force ignores validation errors Force bool // SkipPrune will skip pruning SkipPrune bool }
Options are options for HelmReconciler.