scope

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

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.

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

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ClusterScope

type ClusterScope struct {
	logr.Logger

	DOClients
	Cluster   *clusterv1.Cluster
	DOCluster *infrav1.DOCluster
	// contains filtered or unexported fields
}

ClusterScope defines the basic context for an actuator to operate upon.

func NewClusterScope

func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error)

NewClusterScope creates a new ClusterScope from the supplied parameters. This is meant to be called for each reconcile iteration only on DOClusterReconciler.

func (*ClusterScope) APIServerLoadbalancers

func (s *ClusterScope) APIServerLoadbalancers() *infrav1.DOLoadBalancer

APIServerLoadbalancers get the DOCluster Spec Network APIServerLoadbalancers.

func (*ClusterScope) APIServerLoadbalancersRef

func (s *ClusterScope) APIServerLoadbalancersRef() *infrav1.DOResourceReference

APIServerLoadbalancersRef get the DOCluster status Network APIServerLoadbalancersRef.

func (*ClusterScope) Close

func (s *ClusterScope) Close() error

Close closes the current scope persisting the cluster configuration and status.

func (*ClusterScope) Name

func (s *ClusterScope) Name() string

Name returns the cluster name.

func (*ClusterScope) Namespace

func (s *ClusterScope) Namespace() string

Namespace returns the cluster namespace.

func (*ClusterScope) Network

func (s *ClusterScope) Network() *infrav1.DONetworkResource

Network returns the cluster network object.

func (*ClusterScope) Region

func (s *ClusterScope) Region() string

Region returns the cluster region.

func (*ClusterScope) SetAPIEndpoint

func (s *ClusterScope) SetAPIEndpoint(apiEndpoint []infrav1.APIEndpoint)

SetAPIEndpoint sets the DOCluster status APIEndpoints.

func (*ClusterScope) SetReady

func (s *ClusterScope) SetReady()

SetReady sets the DOCluster Ready Status.

type ClusterScopeGetter

type ClusterScopeGetter interface {
	ClusterScope(params ClusterScopeParams) (*ClusterScope, error)
}

type ClusterScopeGetterFunc

type ClusterScopeGetterFunc func(params ClusterScopeParams) (*ClusterScope, error)

func (ClusterScopeGetterFunc) ClusterScope

func (f ClusterScopeGetterFunc) ClusterScope(params ClusterScopeParams) (*ClusterScope, error)

type ClusterScopeParams

type ClusterScopeParams struct {
	DOClients
	Client    client.Client
	Logger    logr.Logger
	Cluster   *clusterv1.Cluster
	DOCluster *infrav1.DOCluster
}

ClusterScopeParams defines the input parameters used to create a new Scope.

type DOClients

type DOClients struct {
	Actions       godo.ActionsService
	Droplets      godo.DropletsService
	Images        godo.ImagesService
	Keys          godo.KeysService
	LoadBalancers godo.LoadBalancersService
}

func (*DOClients) Session

func (c *DOClients) Session() (*godo.Client, error)

type MachineScope

type MachineScope struct {
	logr.Logger

	Cluster   *clusterv1.Cluster
	Machine   *clusterv1.Machine
	DOCluster *infrav1.DOCluster
	DOMachine *infrav1.DOMachine
	// contains filtered or unexported fields
}

MachineScope defines a scope defined around a machine and its cluster.

func NewMachineScope

func NewMachineScope(params MachineScopeParams) (*MachineScope, error)

NewMachineScope creates a new MachineScope from the supplied parameters. This is meant to be called for each reconcile iteration both DOClusterReconciler and DOMachineReconciler.

func (*MachineScope) AdditionalTags

func (m *MachineScope) AdditionalTags() infrav1.Tags

AdditionalTags returns AdditionalTags from the scope's DOMachine. The returned value will never be nil.

func (*MachineScope) Close

func (m *MachineScope) Close() error

Close the MachineScope by updating the machine spec, machine status.

func (*MachineScope) GetInstanceID

func (m *MachineScope) GetInstanceID() string

GetInstanceID returns the DOMachine droplet instance id by parsing Spec.ProviderID.

func (*MachineScope) GetInstanceStatus

func (m *MachineScope) GetInstanceStatus() *infrav1.DOResourceStatus

GetInstanceStatus returns the DOMachine droplet instance status from the status.

func (*MachineScope) GetProviderID

func (m *MachineScope) GetProviderID() string

GetProviderID returns the DOMachine providerID from the spec.

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the DOMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

func (*MachineScope) Role

func (m *MachineScope) Role() string

Role returns the machine role from the labels.

func (*MachineScope) SetAddresses

func (m *MachineScope) SetAddresses(addrs []corev1.NodeAddress)

SetAddresses sets the address status.

func (*MachineScope) SetErrorMessage

func (m *MachineScope) SetErrorMessage(v error)

SetErrorMessage sets the DOMachine status error message.

func (*MachineScope) SetErrorReason

func (m *MachineScope) SetErrorReason(v capierrors.MachineStatusError)

SetErrorReason sets the DOMachine status error reason.

func (*MachineScope) SetInstanceStatus

func (m *MachineScope) SetInstanceStatus(v infrav1.DOResourceStatus)

SetInstanceStatus sets the DOMachine droplet id.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(dropletID string)

SetProviderID sets the DOMachine providerID in spec from droplet id.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the DOMachine Ready Status.

type MachineScopeGetter

type MachineScopeGetter interface {
	MachineScope(params MachineScopeParams) (*MachineScope, error)
}

type MachineScopeGetterFunc

type MachineScopeGetterFunc func(params MachineScopeParams) (*MachineScope, error)

func (MachineScopeGetterFunc) MachineScope

func (f MachineScopeGetterFunc) MachineScope(params MachineScopeParams) (*MachineScope, error)

type MachineScopeParams

type MachineScopeParams struct {
	DOClients
	Client    client.Client
	Logger    logr.Logger
	Cluster   *clusterv1.Cluster
	Machine   *clusterv1.Machine
	DOCluster *infrav1.DOCluster
	DOMachine *infrav1.DOMachine
}

MachineScopeParams defines the input parameters used to create a new MachineScope.

type TokenSource

type TokenSource struct {
	AccessToken string
}

func (*TokenSource) Token

func (t *TokenSource) Token() (*oauth2.Token, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL