Documentation ¶
Overview ¶
Copyright 2020 The Kubernetes 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 ¶
- Variables
- func SortManifests(in map[string]string) []string
- type DependentResourceWatchUpdater
- type Helper
- type HelperOptions
- type KubedgeBaseManager
- func (m KubedgeBaseManager) BaseInstallResource(ctx context.Context) (*av1.SubResourceList, error)
- func (m KubedgeBaseManager) BaseReconcileResource(ctx context.Context) (*av1.SubResourceList, error)
- func (m *KubedgeBaseManager) BaseSync(ctx context.Context) error
- func (m KubedgeBaseManager) BaseUninstallResource(ctx context.Context) (*av1.SubResourceList, error)
- func (m KubedgeBaseManager) BaseUpdateResource(ctx context.Context) (*av1.SubResourceList, *av1.SubResourceList, error)
- func (m KubedgeBaseManager) IsInstalled() bool
- func (m KubedgeBaseManager) IsUpdateRequired() bool
- func (m KubedgeBaseManager) Render(ctx context.Context) (*av1.SubResourceList, error)
- func (m KubedgeBaseManager) ResourceName() string
- type KubedgeBaseRenderer
- func (o *KubedgeBaseRenderer) FromYaml(name string, namespace string, filecontent string) (*av1.SubResourceList, error)
- func (o *KubedgeBaseRenderer) MergePodTemplateSpec(template *corev1.PodTemplateSpec, k corev1.PodTemplateSpec) error
- func (o KubedgeBaseRenderer) RenderFile(name string, namespace string, fileName string) (*av1.SubResourceList, error)
- func (o *KubedgeBaseRenderer) SplitManifests(bigFile string) map[string]string
- func (o *KubedgeBaseRenderer) Unmarshal(str string) map[string]interface{}
- func (o *KubedgeBaseRenderer) UpdateStatefulSet(u *unstructured.Unstructured, k *av1.KubedgeSetSpec)
- type KubedgeResourceManager
- type KubedgeResourceManagerFactory
- type KubedgeResourceRenderer
- type Option
- type WithForceOverwriteConditions
- type WithOwnedConditions
- type WithStatusObservedGeneration
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound indicates the resource was not found. ErrNotFound = errors.New("Resource not found") // ErrOwnershipMismatch indicates that one of the subresources does // not have the right ownership. ErrOwnershipMismatch = errors.New("Ownership Mismatch") // ErrSync detected during SyncResource ErrSync = errors.New("Sync Error") // ErrInstall detected during InstallResource ErrInstall = errors.New("Install Error") // ErrUninstall detected during UninstallResource ErrUninstall = errors.New("Uninstall Error") // ErrUpdate detected during UpdateResource ErrUpdate = errors.New("Update Error") // ErrReconcile detected during ReconcileResource ErrReconcile = errors.New("Reconcile Error") )
Functions ¶
func SortManifests ¶
Types ¶
type DependentResourceWatchUpdater ¶
type DependentResourceWatchUpdater func([]unstructured.Unstructured) error
DependentResourceWatchUpdater does xxx
func BuildDependentResourceWatchUpdater ¶
func BuildDependentResourceWatchUpdater(mgr manager.Manager, owner *unstructured.Unstructured, c controller.Controller, dependentPredicate crtpredicate.Funcs) DependentResourceWatchUpdater
BuildDependentResourceWatchUpdater builds a function that adds watches for resources in released Helm charts.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper is a utility for ensuring the proper patching of objects.
type HelperOptions ¶
type HelperOptions struct { // IncludeStatusObservedGeneration sets the status.observedGeneration field // on the incoming object to match metadata.generation, only if there is a change. IncludeStatusObservedGeneration bool // ForceOverwriteConditions allows the patch helper to overwrite conditions in case of conflicts. // This option should only ever be set in controller managing the object being patched. ForceOverwriteConditions bool // OwnedConditions defines condition types owned by the controller. // In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller. OwnedConditions []av1.KubedgeConditionType }
HelperOptions contains options for patch options.
type KubedgeBaseManager ¶
type KubedgeBaseManager struct { KubeClient client.Client Renderer KubedgeResourceRenderer OwnerRefs []metav1.OwnerReference PhaseName string PhaseNamespace string Source *av1.KubedgeSource IsInstalledFlag bool IsUpdateRequiredFlag bool DeployedSubResourceList *av1.SubResourceList }
KubedgeBaseManager provides the default implementation.
func (KubedgeBaseManager) BaseInstallResource ¶
func (m KubedgeBaseManager) BaseInstallResource(ctx context.Context) (*av1.SubResourceList, error)
BaseInstallResource performs a "helm install" equivalent It creates K8s sub resources (Workflow, Job, ....) attached to this Kubedge CR
func (KubedgeBaseManager) BaseReconcileResource ¶
func (m KubedgeBaseManager) BaseReconcileResource(ctx context.Context) (*av1.SubResourceList, error)
BaseReconcileResource creates or patches resources as necessary to match this deployed Kubedge CR
func (*KubedgeBaseManager) BaseSync ¶
func (m *KubedgeBaseManager) BaseSync(ctx context.Context) error
BaseSync retrieves from K8s the sub resources (Workflow, Job, ....) attached to this Oslc CR
func (KubedgeBaseManager) BaseUninstallResource ¶
func (m KubedgeBaseManager) BaseUninstallResource(ctx context.Context) (*av1.SubResourceList, error)
BaseUninstallResource performs a "helm delete" equivalent It delete K8s sub resources (Workflow, Job, ....) attached to this Kubedge CR
func (KubedgeBaseManager) BaseUpdateResource ¶
func (m KubedgeBaseManager) BaseUpdateResource(ctx context.Context) (*av1.SubResourceList, *av1.SubResourceList, error)
BasedUpdateResource performs a "helm upgrade" equivalent. Most likely the Values field in the Kubedge Resource. It updates K8s sub resources (Workflow, Job, ....) attached to this CR
func (KubedgeBaseManager) IsInstalled ¶
func (m KubedgeBaseManager) IsInstalled() bool
IsInstalled indicates with the resources have been installed.
func (KubedgeBaseManager) IsUpdateRequired ¶
func (m KubedgeBaseManager) IsUpdateRequired() bool
IsUpdateRequired indicates with the resources have been installed.
func (KubedgeBaseManager) Render ¶ added in v0.1.5
func (m KubedgeBaseManager) Render(ctx context.Context) (*av1.SubResourceList, error)
Render a chart or just a file
func (KubedgeBaseManager) ResourceName ¶
func (m KubedgeBaseManager) ResourceName() string
ResourceName returns the name of the release.
type KubedgeBaseRenderer ¶
type KubedgeBaseRenderer struct { Refs []metav1.OwnerReference Suffix string RenderFiles []string RenderValues map[string]interface{} }
func (*KubedgeBaseRenderer) FromYaml ¶
func (o *KubedgeBaseRenderer) FromYaml(name string, namespace string, filecontent string) (*av1.SubResourceList, error)
Reads a yaml file and converts into an Unstructured object
func (*KubedgeBaseRenderer) MergePodTemplateSpec ¶
func (o *KubedgeBaseRenderer) MergePodTemplateSpec(template *corev1.PodTemplateSpec, k corev1.PodTemplateSpec) error
MergePodTemplate takes a possibly nil container template and a list of steps, merging each of the steps with the container template, if it's not nil, and returning the resulting list. Deprecated
func (KubedgeBaseRenderer) RenderFile ¶
func (o KubedgeBaseRenderer) RenderFile(name string, namespace string, fileName string) (*av1.SubResourceList, error)
Adds the ownerrefs to all the documents in a YAML file
func (*KubedgeBaseRenderer) SplitManifests ¶
func (o *KubedgeBaseRenderer) SplitManifests(bigFile string) map[string]string
SplitManifests takes a string of manifest and returns a map contains individual manifests
func (*KubedgeBaseRenderer) Unmarshal ¶
func (o *KubedgeBaseRenderer) Unmarshal(str string) map[string]interface{}
FromYaml converts a YAML document into a map[string]interface{}.
func (*KubedgeBaseRenderer) UpdateStatefulSet ¶
func (o *KubedgeBaseRenderer) UpdateStatefulSet(u *unstructured.Unstructured, k *av1.KubedgeSetSpec)
Update the Unstructured read in the file using the content of the Spec.
type KubedgeResourceManager ¶
type KubedgeResourceManager interface { ResourceName() string IsInstalled() bool IsUpdateRequired() bool Render(ctx context.Context) (*av1.SubResourceList, error) Sync(context.Context) error InstallResource(context.Context) (*av1.SubResourceList, error) UpdateResource(context.Context) (*av1.SubResourceList, *av1.SubResourceList, error) ReconcileResource(context.Context) (*av1.SubResourceList, error) UninstallResource(context.Context) (*av1.SubResourceList, error) }
KubedgeResourceManager provides the interface for base manaager.
type KubedgeResourceManagerFactory ¶
type KubedgeResourceManagerFactory interface { NewArpscanManager(r *av1.Arpscan) KubedgeResourceManager NewECDSClusterManager(r *av1.ECDSCluster) KubedgeResourceManager NewMMESimManager(r *av1.MMESim) KubedgeResourceManager NewEMBBSliceManager(r *av1.EMBBSlice) KubedgeResourceManager }
KubedgeResourceManagerFactory creates Managers that are specific to custom resources.
func NewManagerFactory ¶
func NewManagerFactory(mgr manager.Manager) KubedgeResourceManagerFactory
NewManagerFactory returns a new factory.
type KubedgeResourceRenderer ¶
type KubedgeResourceRenderer interface {
RenderFile(name string, namespace string, fileName string) (*av1.SubResourceList, error)
}
KubedgeResourceRenderer
func NewKubedgeBaseRenderer ¶
func NewKubedgeBaseRenderer(refs []metav1.OwnerReference, suffix string, renderFiles []string, renderValues map[string]interface{}) KubedgeResourceRenderer
NewKubedgeBaseRenderer creates a new OwnerRef engine with a set of metav1.OwnerReferences to be added to assets
type Option ¶
type Option interface { // ApplyToHelper applies this configuration to the given Helper options. ApplyToHelper(*HelperOptions) }
Option is some configuration that modifies options for a patch request.
type WithForceOverwriteConditions ¶
type WithForceOverwriteConditions struct{}
WithForceOverwriteConditions allows the patch helper to overwrite conditions in case of conflicts. This option should only ever be set in controller managing the object being patched.
func (WithForceOverwriteConditions) ApplyToHelper ¶
func (w WithForceOverwriteConditions) ApplyToHelper(in *HelperOptions)
ApplyToHelper applies this configuration to the given HelperOptions.
type WithOwnedConditions ¶
type WithOwnedConditions struct {
Conditions []av1.KubedgeConditionType
}
WithOwnedConditions allows to define condition types owned by the controller. In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
func (WithOwnedConditions) ApplyToHelper ¶
func (w WithOwnedConditions) ApplyToHelper(in *HelperOptions)
ApplyToHelper applies this configuration to the given HelperOptions.
type WithStatusObservedGeneration ¶
type WithStatusObservedGeneration struct{}
WithStatusObservedGeneration sets the status.observedGeneration field on the incoming object to match metadata.generation, only if there is a change.
func (WithStatusObservedGeneration) ApplyToHelper ¶
func (w WithStatusObservedGeneration) ApplyToHelper(in *HelperOptions)
ApplyToHelper applies this configuration to the given HelperOptions.