Documentation ¶
Overview ¶
Copyright 2020-2021 The UnDistro 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 ¶
- type Empty
- type MoveGroup
- type MoveSequence
- type Node
- type ObjectGraph
- func (o *ObjectGraph) CheckVirtualNode()
- func (o *ObjectGraph) Discovery(namespace string) error
- func (o *ObjectGraph) GetCapiClusters() []*Node
- func (o *ObjectGraph) GetClusters() []*Node
- func (o *ObjectGraph) GetDiscoveryTypes() error
- func (o *ObjectGraph) GetMachines() []*Node
- func (o *ObjectGraph) GetMoveNodes() []*Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MoveGroup ¶
type MoveGroup []*Node
MoveGroup defines is a list of nodes read from the object graph that can be moved in parallel.
type MoveSequence ¶
MoveSequence defines a list of group of moveGroups
func GetMoveSequence ¶
func GetMoveSequence(graph *ObjectGraph) *MoveSequence
Define the move sequence by processing the ownerReference chain.
func (*MoveSequence) AddGroup ¶
func (s *MoveSequence) AddGroup(group MoveGroup)
func (*MoveSequence) GetGroup ¶
func (s *MoveSequence) GetGroup(i int) MoveGroup
func (*MoveSequence) HasNode ¶
func (s *MoveSequence) HasNode(n *Node) bool
type Node ¶
type Node struct { Identity corev1.ObjectReference // Owners contains the list of nodes that are owned by the current node. Owners map[*Node]ownerReferenceAttributes // SoftOwners contains the list of nodes that are soft-owned by the current node. // E.g. secrets are soft-owned by a cluster via a naming convention, but without an explicit OwnerReference. SoftOwners map[*Node]Empty // ForceMove is set to true if the CRD of this object has the "move" label attached. // This ensures the node is moved, regardless of its owner refs. ForceMove bool // IsGlobal gets set to true if this object is a global resource (no namespace). IsGlobal bool // Virtual records if this node was discovered indirectly, e.g. by processing an OwnerRef, but not yet observed as a concrete object. Virtual bool //newID stores the new UID the objects gets once created in the target cluster. NewUID types.UID // TenantClusters define the list of Clusters which are tenant for the node, no matter if the node has a direct OwnerReference to the Cluster or if // the node is linked to a Cluster indirectly in the OwnerReference chain. TenantClusters map[*Node]Empty // TenantCRSs define the list of ClusterResourceSet which are tenant for the node, no matter if the node has a direct OwnerReference to the ClusterResourceSet or if // the node is linked to a ClusterResourceSet indirectly in the OwnerReference chain. TenantCRSs map[*Node]Empty }
Node defines a Node in the Kubernetes object graph that is visited during the discovery phase for the move operation.
type ObjectGraph ¶
type ObjectGraph struct { genericclioptions.IOStreams // contains filtered or unexported fields }
ObjectGraph manages the Kubernetes object graph that is generated during the discovery phase for the move operation.
func NewObjectGraph ¶
func NewObjectGraph(proxy client.Client, streams genericclioptions.IOStreams) *ObjectGraph
func (*ObjectGraph) CheckVirtualNode ¶
func (o *ObjectGraph) CheckVirtualNode()
checkVirtualNode logs if nodes are still virtual
func (*ObjectGraph) Discovery ¶
func (o *ObjectGraph) Discovery(namespace string) error
Discovery reads all the Kubernetes objects existing in a namespace (or in all namespaces if empty) for the types received in input, and then adds everything to the objects graph.
func (*ObjectGraph) GetCapiClusters ¶ added in v0.17.13
func (o *ObjectGraph) GetCapiClusters() []*Node
GetCapiClusters returns the list of Clusters existing in the object graph.
func (*ObjectGraph) GetClusters ¶
func (o *ObjectGraph) GetClusters() []*Node
GetClusters returns the list of Clusters existing in the object graph.
func (*ObjectGraph) GetDiscoveryTypes ¶
func (o *ObjectGraph) GetDiscoveryTypes() error
getDiscoveryTypes returns the list of TypeMeta to be considered for the the move discovery phase. This list includes all the types defines by the CRDs installed by clusterctl and the ConfigMap/Secret core types.
func (*ObjectGraph) GetMachines ¶
func (o *ObjectGraph) GetMachines() []*Node
getMachines returns the list of Machine existing in the object graph.
func (*ObjectGraph) GetMoveNodes ¶
func (o *ObjectGraph) GetMoveNodes() []*Node
GetMoveNodes returns the list of nodes existing in the object graph that belong at least to one Cluster or to a ClusterResourceSet or to a CRD containing the "move" label.