Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayContains(array []string, word string) bool
- func BuildChanges(a, e, changes interface{}) bool
- func BuildTimestampString() string
- func CannotChangeField(key string) error
- func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error
- func CloudupTaskAsString(t CloudupTask) string
- func CopyResource(dest io.Writer, r Resource) (int64, error)
- func DebugAsJsonString(v interface{}) string
- func DebugAsJsonStringIndent(v interface{}) string
- func DebugPrint(o interface{}) string
- func DownloadURL(url string, dest string, hash *hashing.Hash) (*hashing.Hash, error)
- func EnsureFileMode(destPath string, fileMode os.FileMode) (bool, error)
- func EnsureFileOwner(destPath string, owner string, groupName string) (bool, error)
- func FieldIsImmutable(newVal, oldVal interface{}, fldPath *field.Path) *field.Error
- func FileModeToString(mode os.FileMode) string
- func FindPrimary(keyset *kops.Keyset) *kops.KeysetItem
- func FindTaskDependencies[T SubContext](tasks map[string]Task[T]) map[string][]string
- func InstallDefaultDeltaRunMethod(e InstallTask, c *InstallContext) error
- func IsNilOrEmpty(s *string) bool
- func KeysetItemIdOlder(a, b string) bool
- func NewPKIKeystoreAdapter(reader KeystoreReader) pki.Keystore
- func NodeupDefaultDeltaRunMethod(e NodeupTask, c *NodeupContext) error
- func NodeupTaskAsString(t NodeupTask) string
- func ParseFileMode(s string, defaultMode os.FileMode) (os.FileMode, error)
- func PrintCompareWithID(o interface{}) (string, bool)
- func PrintResource(o interface{}) (string, bool)
- func PtrTo[T any](v T) *T
- func RequiredField(key string) error
- func ResourceAsBytes(r Resource) ([]byte, error)
- func ResourceAsString(r Resource) (string, error)
- func ResourcesMatch(a, b Resource) (bool, error)
- func SafeClose(r io.Reader)
- func StringSlice(stringSlice []string) []*string
- func StringSliceValue(stringSlice []*string) []string
- func TaskAsString[T SubContext](t Task[T]) string
- func ToInt64(s *string) *int64
- func ToString(v *int64) *string
- func TypeNameForTask(task interface{}) string
- func ValueOf[T any](v *T) T
- func WriteFile(destPath string, contents Resource, fileMode os.FileMode, dirMode os.FileMode, ...) error
- type ApiIngressStatus
- type AssetStore
- func (a *AssetStore) Add(id string) error
- func (a *AssetStore) AddForTest(id string, path string, content string)
- func (a *AssetStore) Find(key string, assetPath string) (Resource, error)
- func (a *AssetStore) FindMatch(expr *regexp.Regexp) (name string, res Resource, err error)
- func (a *AssetStore) FindMatches(expr *regexp.Regexp) map[string]Resource
- type ByTaskKey
- type BytesResource
- type CAStore
- type ClientsetCAStore
- func (c *ClientsetCAStore) AddSSHPublicKey(ctx context.Context, pubkey []byte) error
- func (c *ClientsetCAStore) DeleteSSHCredential() error
- func (c *ClientsetCAStore) FindKeyset(ctx context.Context, name string) (*Keyset, error)
- func (c *ClientsetCAStore) FindPrimaryKeypair(ctx context.Context, name string) (*pki.Certificate, *pki.PrivateKey, error)
- func (c *ClientsetCAStore) FindSSHPublicKeys() ([]*kops.SSHCredential, error)
- func (c *ClientsetCAStore) ListKeysets() (map[string]*Keyset, error)
- func (c *ClientsetCAStore) MirrorTo(ctx context.Context, basedir vfs.Path) error
- func (c *ClientsetCAStore) StoreKeyset(ctx context.Context, name string, keyset *Keyset) error
- type Cloud
- type CloudupContext
- type CloudupDeletion
- type CloudupDryRunTarget
- type CloudupHasCheckExisting
- type CloudupHasDependencies
- type CloudupModelBuilder
- type CloudupModelBuilderContext
- type CloudupNotADependency
- type CloudupProducesDeletions
- type CloudupSubContext
- type CloudupTarget
- type CloudupTask
- type CloudupTaskDependentResource
- type CloudupTaskNormalize
- type CompareWithID
- type Context
- type Deletion
- type DeletionByTaskName
- type DeletionProcessingMode
- type DryRunTarget
- func (t *DryRunTarget[T]) Changes() (map[string]Task[T], map[string]Task[T])
- func (t *DryRunTarget[T]) DefaultCheckExisting() bool
- func (t *DryRunTarget[T]) Deletions() []string
- func (t *DryRunTarget[T]) Finish(taskMap map[string]Task[T]) error
- func (t *DryRunTarget[T]) HasChanges() bool
- func (t *DryRunTarget[T]) PrintReport(taskMap map[string]Task[T], out io.Writer) error
- func (t *DryRunTarget[T]) RecordDeletion(deletion Deletion[T]) error
- func (t *DryRunTarget[T]) Render(a, e, changes Task[T]) error
- type ExistsAndWarnIfChangesError
- type FileResource
- type Group
- type HasAddress
- type HasCheckExisting
- type HasDeletions
- type HasDependencies
- type HasIsReady
- type HasLifecycle
- type HasName
- type HasSource
- type HasVFSPath
- type InstallContext
- type InstallHasDependencies
- type InstallModelBuilderContext
- type InstallSubContext
- type InstallTarget
- type InstallTask
- type Keyset
- type KeysetItem
- type Keystore
- type KeystoreReader
- type Lifecycle
- type ModelBuilder
- type ModelBuilderContext
- type NodeupContext
- type NodeupDryRunTarget
- type NodeupHasCheckExisting
- type NodeupHasDependencies
- type NodeupModelBuilder
- type NodeupModelBuilderContext
- type NodeupNotADependency
- type NodeupSubContext
- type NodeupTarget
- type NodeupTask
- type NodeupTaskDependentResource
- type NotADependency
- type ProducesDeletions
- type Resource
- type RunTasksOptions
- type SSHCredentialStore
- type Secret
- type SecretStore
- type SecretStoreReader
- type Source
- type StringResource
- type SubContext
- type SubnetInfo
- type Target
- type Task
- type TaskDependentResource
- type TaskNormalize
- type TaskPreRun
- type TryAgainLaterError
- type User
- type VFSCAStore
- func (c *VFSCAStore) AddSSHPublicKey(ctx context.Context, pubkey []byte) error
- func (c *VFSCAStore) DeleteSSHCredential() error
- func (c *VFSCAStore) FindSSHPublicKeys() ([]*kops.SSHCredential, error)
- func (c *VFSCAStore) ListKeysets() (map[string]*Keyset, error)
- func (c *VFSCAStore) MirrorTo(ctx context.Context, basedir vfs.Path) error
- func (c *VFSCAStore) StoreKeyset(ctx context.Context, name string, keyset *Keyset) error
- type VFSKeystoreReader
- type VFSResource
- type VPCInfo
- type Warning
Constants ¶
const CertificateIDCA = "kubernetes-ca"
const (
// SecretNameSSHPrimary is the Name for the primary SSH key
SecretNameSSHPrimary = "admin"
)
Variables ¶
var LifecycleNameMap = map[string]Lifecycle{ "Sync": LifecycleSync, "Ignore": LifecycleIgnore, "WarnIfInsufficientAccess": LifecycleWarnIfInsufficientAccess, "ExistsAndValidates": LifecycleExistsAndValidates, "ExistsAndWarnIfChanges": LifecycleExistsAndWarnIfChanges, }
LifecycleNameMap is used to validate in the UX. When a user provides a lifecycle name it then can be mapped to the actual lifecycle.
var Lifecycles = sets.NewString( string(LifecycleSync), string(LifecycleIgnore), string(LifecycleWarnIfInsufficientAccess), string(LifecycleExistsAndValidates), string(LifecycleExistsAndWarnIfChanges), )
Lifecycles are used for ux validation. When validation fails the lifecycle names are printed out.
Functions ¶
func ArrayContains ¶ added in v1.16.0
ArrayContains is checking does array contain single word
func BuildChanges ¶
func BuildChanges(a, e, changes interface{}) bool
BuildChanges compares the values of a & e, and populates differences into changes, except that if a value is nil in e, the corresponding value in a is ignored. a, e and changes must all be of the same type a is the actual object found, e is the expected value Note that the ignore-nil-in-e logic therefore implements the idea that nil value in e means "don't care" If a is nil, all the non-nil values in e will be copied over to changes, because every field in e must be applied
func BuildTimestampString ¶
func BuildTimestampString() string
func CannotChangeField ¶
func CloudupDefaultDeltaRunMethod ¶ added in v1.26.0
func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error
CloudupDefaultDeltaRunMethod implements the standard change-based run procedure: find the existing item; compare properties; call render with (actual, expected, changes)
func CloudupTaskAsString ¶ added in v1.26.0
func CloudupTaskAsString(t CloudupTask) string
CloudupTaskAsString renders the task for debug output TODO: Use reflection to make this cleaner: don't recurse into tasks - print their names instead also print resources in a cleaner way (use the resource source information?)
func DebugAsJsonString ¶
func DebugAsJsonString(v interface{}) string
func DebugAsJsonStringIndent ¶
func DebugAsJsonStringIndent(v interface{}) string
func DebugPrint ¶
func DebugPrint(o interface{}) string
func DownloadURL ¶
DownloadURL will download the file at the given url and store it as dest. If hash is non-nil, it will also verify that it matches the hash of the downloaded file.
func EnsureFileOwner ¶
EnsureFileOwner will set the owner & group for a file. Empty values for owner/group will leave the owner/group unchanged.
func FieldIsImmutable ¶ added in v1.10.0
func FileModeToString ¶
func FindPrimary ¶ added in v1.10.0
func FindPrimary(keyset *kops.Keyset) *kops.KeysetItem
FindPrimary returns the primary KeysetItem in the Keyset
func FindTaskDependencies ¶
func FindTaskDependencies[T SubContext](tasks map[string]Task[T]) map[string][]string
FindTaskDependencies returns a map from each task's key to the discovered list of dependencies
func InstallDefaultDeltaRunMethod ¶ added in v1.26.0
func InstallDefaultDeltaRunMethod(e InstallTask, c *InstallContext) error
InstallDefaultDeltaRunMethod implements the standard change-based run procedure: find the existing item; compare properties; call render with (actual, expected, changes)
func IsNilOrEmpty ¶
func KeysetItemIdOlder ¶ added in v1.21.3
KeysetItemIdOlder returns whether the KeysetItem Id a is older than b.
func NewPKIKeystoreAdapter ¶ added in v1.27.0
func NewPKIKeystoreAdapter(reader KeystoreReader) pki.Keystore
func NodeupDefaultDeltaRunMethod ¶ added in v1.26.0
func NodeupDefaultDeltaRunMethod(e NodeupTask, c *NodeupContext) error
NodeupDefaultDeltaRunMethod implements the standard change-based run procedure: find the existing item; compare properties; call render with (actual, expected, changes)
func NodeupTaskAsString ¶ added in v1.26.0
func NodeupTaskAsString(t NodeupTask) string
NodeupTaskAsString renders the task for debug output TODO: Use reflection to make this cleaner: don't recurse into tasks - print their names instead also print resources in a cleaner way (use the resource source information?)
func PrintCompareWithID ¶ added in v1.11.0
func PrintResource ¶ added in v1.11.0
func PtrTo ¶ added in v1.24.5
func PtrTo[T any](v T) *T
PtrTo returns a pointer to a copy of any value.
func RequiredField ¶
func ResourceAsBytes ¶
func ResourceAsString ¶
func ResourcesMatch ¶
func StringSlice ¶ added in v1.20.0
StringSlice is a helper that builds a []*string from a slice of strings
func StringSliceValue ¶ added in v1.20.0
StringSliceValue takes a slice of string pointers and returns a slice of strings
func TaskAsString ¶
func TaskAsString[T SubContext](t Task[T]) string
TaskAsString renders the task for debug output TODO: Use reflection to make this cleaner: don't recurse into tasks - print their names instead also print resources in a cleaner way (use the resource source information?)
func TypeNameForTask ¶ added in v1.10.0
func TypeNameForTask(task interface{}) string
Types ¶
type ApiIngressStatus ¶ added in v1.21.3
type ApiIngressStatus struct { // InternalEndpoint is true when the endpoint is only reachable from the cloud. InternalEndpoint bool // IP is set for load-balancer ingress points that are IP based // (typically GCE or OpenStack load-balancers) // +optional IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` // Hostname is set for load-balancer ingress points that are DNS based // (typically AWS load-balancers) // +optional Hostname string `json:"hostname,omitempty" protobuf:"bytes,2,opt,name=hostname"` }
ApiIngressStatus represents the status of an ingress point: traffic intended for the service should be sent to an ingress point.
type AssetStore ¶
type AssetStore struct {
// contains filtered or unexported fields
}
func NewAssetStore ¶
func NewAssetStore(cacheDir string) *AssetStore
func (*AssetStore) Add ¶
func (a *AssetStore) Add(id string) error
Add an asset into the store, in one of the recognized formats (see Assets in types package)
func (*AssetStore) AddForTest ¶ added in v1.19.0
func (a *AssetStore) AddForTest(id string, path string, content string)
Add an asset into the store, in one of the recognized formats (see Assets in types package)
func (*AssetStore) FindMatches ¶ added in v1.19.0
func (a *AssetStore) FindMatches(expr *regexp.Regexp) map[string]Resource
type ByTaskKey ¶ added in v1.10.0
type ByTaskKey[T SubContext] []*render[T]
ByTaskKey sorts []*render by TaskKey (type/name)
type BytesResource ¶
type BytesResource struct {
// contains filtered or unexported fields
}
func NewBytesResource ¶
func NewBytesResource(data []byte) *BytesResource
func (*BytesResource) MarshalJSON ¶ added in v1.11.0
func (b *BytesResource) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshaller so this will be printed as a string (instead of nothing) This is used in tests to verify the expected output.
type ClientsetCAStore ¶ added in v1.10.0
type ClientsetCAStore struct {
// contains filtered or unexported fields
}
ClientsetCAStore is a CAStore implementation that stores keypairs in Keyset on a API server
func NewClientsetCAStore ¶ added in v1.10.0
func NewClientsetCAStore(cluster *kops.Cluster, clientset kopsinternalversion.KopsInterface, namespace string) *ClientsetCAStore
NewClientsetCAStore is the constructor for ClientsetCAStore
func (*ClientsetCAStore) AddSSHPublicKey ¶ added in v1.10.0
func (c *ClientsetCAStore) AddSSHPublicKey(ctx context.Context, pubkey []byte) error
AddSSHPublicKey implements CAStore::AddSSHPublicKey
func (*ClientsetCAStore) DeleteSSHCredential ¶ added in v1.10.0
func (c *ClientsetCAStore) DeleteSSHCredential() error
DeleteSSHCredential implements SSHCredentialStore::DeleteSSHCredential
func (*ClientsetCAStore) FindKeyset ¶ added in v1.21.3
FindKeyset implements KeystoreReader.
func (*ClientsetCAStore) FindPrimaryKeypair ¶ added in v1.21.3
func (c *ClientsetCAStore) FindPrimaryKeypair(ctx context.Context, name string) (*pki.Certificate, *pki.PrivateKey, error)
FindPrimaryKeypair implements pki.Keystore
func (*ClientsetCAStore) FindSSHPublicKeys ¶ added in v1.10.0
func (c *ClientsetCAStore) FindSSHPublicKeys() ([]*kops.SSHCredential, error)
FindSSHPublicKeys implements CAStore::FindSSHPublicKeys
func (*ClientsetCAStore) ListKeysets ¶ added in v1.10.0
func (c *ClientsetCAStore) ListKeysets() (map[string]*Keyset, error)
ListKeysets implements CAStore::ListKeysets
func (*ClientsetCAStore) StoreKeyset ¶ added in v1.21.3
StoreKeyset implements CAStore::StoreKeyset
type Cloud ¶
type Cloud interface { ProviderID() kops.CloudProviderID DNS() (dnsprovider.Interface, error) // FindVPCInfo looks up the specified VPC by id, returning info if found, otherwise (nil, nil). FindVPCInfo(id string) (*VPCInfo, error) // DeleteInstance deletes a cloud instance. DeleteInstance(instance *cloudinstances.CloudInstance) error // // DeregisterInstance drains a cloud instance and loadbalancers. DeregisterInstance(instance *cloudinstances.CloudInstance) error // DeleteGroup deletes the cloud resources that make up a CloudInstanceGroup, including the instances. DeleteGroup(group *cloudinstances.CloudInstanceGroup) error // DetachInstance causes a cloud instance to no longer be counted against the group's size limits. DetachInstance(instance *cloudinstances.CloudInstance) error // GetCloudGroups returns a map of cloud instances that back a kops cluster. // Detached instances must be returned in the NeedUpdate slice. GetCloudGroups(cluster *kops.Cluster, instancegroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) // Region returns the cloud region bound to the cloud instance. // If the region concept does not apply, returns "". Region() string // FindClusterStatus discovers the status of the cluster, by inspecting the cloud objects FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error) GetApiIngressStatus(cluster *kops.Cluster) ([]ApiIngressStatus, error) }
type CloudupContext ¶ added in v1.26.0
type CloudupContext = Context[CloudupSubContext]
func NewCloudupContext ¶ added in v1.26.0
func NewCloudupContext(ctx context.Context, deletionProcessingMode DeletionProcessingMode, target CloudupTarget, cluster *kops.Cluster, cloud Cloud, keystore Keystore, secretStore SecretStore, clusterConfigBase vfs.Path, tasks map[string]CloudupTask) (*CloudupContext, error)
type CloudupDeletion ¶ added in v1.26.0
type CloudupDeletion = Deletion[CloudupSubContext]
type CloudupDryRunTarget ¶ added in v1.26.0
type CloudupDryRunTarget = DryRunTarget[CloudupSubContext]
func NewCloudupDryRunTarget ¶ added in v1.26.0
func NewCloudupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *CloudupDryRunTarget
type CloudupHasCheckExisting ¶ added in v1.26.0
type CloudupHasCheckExisting = HasCheckExisting[CloudupSubContext]
type CloudupHasDependencies ¶ added in v1.26.0
type CloudupHasDependencies = HasDependencies[CloudupSubContext]
type CloudupModelBuilder ¶ added in v1.26.0
type CloudupModelBuilder = ModelBuilder[CloudupSubContext]
type CloudupModelBuilderContext ¶ added in v1.26.0
type CloudupModelBuilderContext = ModelBuilderContext[CloudupSubContext]
type CloudupNotADependency ¶ added in v1.26.0
type CloudupNotADependency = NotADependency[CloudupSubContext]
type CloudupProducesDeletions ¶ added in v1.26.0
type CloudupProducesDeletions = ProducesDeletions[CloudupSubContext]
type CloudupSubContext ¶ added in v1.26.0
type CloudupTarget ¶ added in v1.26.0
type CloudupTarget = Target[CloudupSubContext]
type CloudupTask ¶ added in v1.26.0
type CloudupTask = Task[CloudupSubContext]
type CloudupTaskDependentResource ¶ added in v1.26.0
type CloudupTaskDependentResource = TaskDependentResource[CloudupSubContext]
type CloudupTaskNormalize ¶ added in v1.26.0
type CloudupTaskNormalize = TaskNormalize[CloudupSubContext]
type CompareWithID ¶
type CompareWithID interface {
CompareWithID() *string
}
CompareWithID indicates that the value should be compared by the returned ID value (instead of a deep comparison) Most Tasks implement this, because typically when a Task references another task, it only is concerned with being linked to that task, not the values of the task. For example, when an instance is linked to a disk, it cares that the disk is attached to that instance, not the size or speed of the disk.
type Context ¶
type Context[T SubContext] struct { Target Target[T] T T // contains filtered or unexported fields }
func (*Context[T]) AddWarning ¶ added in v1.10.0
AddWarning records a warning encountered during validation / creation. Typically this will be an error that we choose to ignore because of Lifecycle.
func (*Context[T]) Render ¶
Render dispatches the creation of an object to the appropriate handler defined on the Task, it is typically called after we have checked the existing state of the Task and determined that is different from the desired state.
func (*Context[T]) RunTasks ¶
func (c *Context[T]) RunTasks(options RunTasksOptions) error
type DeletionByTaskName ¶ added in v1.10.0
type DeletionByTaskName[T SubContext] []Deletion[T]
DeletionByTaskName sorts []Deletion by TaskName
func (DeletionByTaskName[T]) Len ¶ added in v1.10.0
func (a DeletionByTaskName[T]) Len() int
func (DeletionByTaskName[T]) Less ¶ added in v1.10.0
func (a DeletionByTaskName[T]) Less(i, j int) bool
func (DeletionByTaskName[T]) Swap ¶ added in v1.10.0
func (a DeletionByTaskName[T]) Swap(i, j int)
type DeletionProcessingMode ¶ added in v1.29.0
type DeletionProcessingMode string
const ( // DeletionProcessingModeIgnore will ignore all deletion tasks. // This is typically used when the target implements pruning directly (e.g. terraform) DeletionProcessingModeIgnore DeletionProcessingMode = "Ignore" // DeletionProcessingModeDeleteIfNotDeferrred will delete resources only if they are not marked for deferred-deletion. // This corresponds to a cluster update with --prune=false. DeletionProcessingModeDeleteIfNotDeferrred DeletionProcessingMode = "IfNotDeferred" // DeletionProcessingModeDeleteIncludingDeferrred will delete resources including those marked for deferred-deletion. // This corresponds to a cluster update with --prune=true. DeletionProcessingModeDeleteIncludingDeferred DeletionProcessingMode = "DeleteIncludingDeferred" )
type DryRunTarget ¶
type DryRunTarget[T SubContext] struct { // contains filtered or unexported fields }
DryRunTarget is a special Target that does not execute anything, but instead tracks all changes. By running against a DryRunTarget, a list of changes that would be made can be easily collected, without any special support from the Tasks.
func (*DryRunTarget[T]) Changes ¶ added in v1.15.1
func (t *DryRunTarget[T]) Changes() (map[string]Task[T], map[string]Task[T])
Changes returns tasks which is going to be created or updated
func (*DryRunTarget[T]) DefaultCheckExisting ¶ added in v1.26.0
func (t *DryRunTarget[T]) DefaultCheckExisting() bool
func (*DryRunTarget[T]) Deletions ¶ added in v1.15.1
func (t *DryRunTarget[T]) Deletions() []string
Deletions returns all task names which is going to be deleted
func (*DryRunTarget[T]) Finish ¶
func (t *DryRunTarget[T]) Finish(taskMap map[string]Task[T]) error
Finish is called at the end of a run, and prints a list of changes to the configured Writer
func (*DryRunTarget[T]) HasChanges ¶
func (t *DryRunTarget[T]) HasChanges() bool
HasChanges returns true iff any changes would have been made
func (*DryRunTarget[T]) PrintReport ¶
func (*DryRunTarget[T]) RecordDeletion ¶ added in v1.29.0
func (t *DryRunTarget[T]) RecordDeletion(deletion Deletion[T]) error
func (*DryRunTarget[T]) Render ¶
func (t *DryRunTarget[T]) Render(a, e, changes Task[T]) error
type ExistsAndWarnIfChangesError ¶ added in v1.10.0
type ExistsAndWarnIfChangesError struct {
// contains filtered or unexported fields
}
ExistsAndWarnIfChangesError is the custom error return for fi.LifecycleExistsAndWarnIfChanges. This error is used when an object needs to fail validation, but let the user proceed with a warning.
func NewExistsAndWarnIfChangesError ¶ added in v1.10.0
func NewExistsAndWarnIfChangesError(message string) *ExistsAndWarnIfChangesError
NewExistsAndWarnIfChangesError is a builder for ExistsAndWarnIfChangesError.
func (*ExistsAndWarnIfChangesError) Error ¶ added in v1.10.0
func (e *ExistsAndWarnIfChangesError) Error() string
ExistsAndWarnIfChangesError implementation of the error interface.
type FileResource ¶
type FileResource struct {
Path string
}
func NewFileResource ¶
func NewFileResource(path string) *FileResource
type HasAddress ¶
type HasAddress interface { Task[CloudupSubContext] // GetWellKnownServices returns the services that are behind this address. GetWellKnownServices() []wellknownservices.WellKnownService // FindIPAddress returns the address associated with the implementor. If there is no address, returns (nil, nil). FindAddresses(context *CloudupContext) ([]string, error) }
HasAddress is implemented by elastic/floating IP addresses in order to include relevant dynamically allocated addresses in the api-server's server TLS certificate.
type HasCheckExisting ¶
type HasCheckExisting[T SubContext] interface { Task[T] CheckExisting(c *Context[T]) bool }
type HasDeletions ¶ added in v1.21.0
type HasDeletions interface { ModelBuilder[CloudupSubContext] // FindDeletions finds cloud objects that are owned by the cluster but no longer in the model and creates tasks to delete them. // It is not called for the Terraform target. FindDeletions(context *ModelBuilderContext[CloudupSubContext], cloud Cloud) error }
HasDeletions is a ModelBuilder[CloudupContext] that creates tasks to delete cloud objects that no longer exist in the model.
type HasDependencies ¶
type HasDependencies[T SubContext] interface { GetDependencies(tasks map[string]Task[T]) []Task[T] }
type HasIsReady ¶ added in v1.19.0
type HasIsReady interface {
IsReady() bool
}
HasIsReady is implemented by Resources that are derived (and thus may not be ready at comparison time)
type HasLifecycle ¶ added in v1.10.0
type HasLifecycle interface { GetLifecycle() Lifecycle // SetLifecycle is used to override a tasks lifecycle. If a lifecycle override exists for a specific task name, then the // lifecycle is modified. SetLifecycle(lifecycle Lifecycle) }
HasLifecycle indicates that the task has a Lifecycle
type HasName ¶
type HasName interface {
GetName() *string
}
HasName indicates that the task has a Name.
type HasVFSPath ¶ added in v1.10.0
HasVFSPath is implemented by keystore & other stores that use a VFS path as their backing store
type InstallContext ¶ added in v1.26.0
type InstallContext = Context[InstallSubContext]
func NewInstallContext ¶ added in v1.26.0
func NewInstallContext(ctx context.Context, target InstallTarget, tasks map[string]InstallTask) (*InstallContext, error)
type InstallHasDependencies ¶ added in v1.26.0
type InstallHasDependencies = HasDependencies[InstallSubContext]
type InstallModelBuilderContext ¶ added in v1.26.0
type InstallModelBuilderContext = ModelBuilderContext[InstallSubContext]
type InstallSubContext ¶ added in v1.26.0
type InstallSubContext struct{}
type InstallTarget ¶ added in v1.26.0
type InstallTarget = Target[InstallSubContext]
type InstallTask ¶ added in v1.26.0
type InstallTask = Task[InstallSubContext]
type Keyset ¶ added in v1.21.3
type Keyset struct { // LegacyFormat instructs a keypair task to convert a Legacy Keyset to the new Keyset API format. LegacyFormat bool Items map[string]*KeysetItem // Primary is the KeysetItem that is considered the "active" key. // It is guaranteed to be non-nil, if there are any keypairs. Primary *KeysetItem }
Keyset is a parsed api.Keyset.
func NewKeyset ¶ added in v1.21.3
func NewKeyset(cert *pki.Certificate, privateKey *pki.PrivateKey) (*Keyset, error)
NewKeyset creates a Keyset.
func (*Keyset) AddItem ¶ added in v1.21.3
func (k *Keyset) AddItem(cert *pki.Certificate, privateKey *pki.PrivateKey, primary bool) (item *KeysetItem, err error)
AddItem adds an item to the keyset
func (*Keyset) ToAPIObject ¶ added in v1.21.3
func (*Keyset) ToCertificateBytes ¶ added in v1.21.3
func (*Keyset) ToPublicKeys ¶ added in v1.21.3
type KeysetItem ¶ added in v1.21.3
type KeysetItem struct { // Id is the identifier of this keypair. Id string // DistrustTimestamp is RFC 3339 date and time at which this keypair was distrusted. // If not set, keypair is trusted. DistrustTimestamp *time.Time // Certificate is the keypair's certificate. Certificate *pki.Certificate // PrivateKey is a reference to the keypair's private key. PrivateKey *pki.PrivateKey }
KeysetItem is a certificate/key pair in a Keyset.
type KeystoreReader ¶ added in v1.26.0
type KeystoreReader interface { // FindKeyset finds a Keyset. If the keyset is not found, it returns (nil, nil). FindKeyset(ctx context.Context, name string) (*Keyset, error) }
KeystoreReader contains just the functions we need to consume keypairs, not to update them.
type Lifecycle ¶ added in v1.10.0
type Lifecycle string
const ( // LifecycleSync should do the normal synchronization LifecycleSync Lifecycle = "Sync" // LifecycleIgnore will skip the task LifecycleIgnore Lifecycle = "Ignore" // LifecycleWarnIfInsufficientAccess will warn but ignore the task if there is an error during the find LifecycleWarnIfInsufficientAccess Lifecycle = "WarnIfInsufficientAccess" // LifecycleExistsAndValidates will check that the task exists and is the same LifecycleExistsAndValidates Lifecycle = "ExistsAndValidates" // LifecycleExistsAndWarnIfChanges will check that the task exists and will warn on changes, but then ignore them LifecycleExistsAndWarnIfChanges Lifecycle = "ExistsAndWarnIfChanges" )
type ModelBuilder ¶ added in v1.10.0
type ModelBuilder[T SubContext] interface { Build(context *ModelBuilderContext[T]) error }
ModelBuilder allows for plugins that configure an aspect of the model, based on the configuration
type ModelBuilderContext ¶ added in v1.10.0
type ModelBuilderContext[T SubContext] struct { Tasks map[string]Task[T] LifecycleOverrides map[string]Lifecycle // contains filtered or unexported fields }
ModelBuilderContext is a context object that holds state we want to pass to ModelBuilder
func (*ModelBuilderContext[T]) AddTask ¶ added in v1.10.0
func (c *ModelBuilderContext[T]) AddTask(task Task[T])
func (*ModelBuilderContext[T]) Context ¶ added in v1.26.0
func (c *ModelBuilderContext[T]) Context() context.Context
func (*ModelBuilderContext[T]) EnsureTask ¶ added in v1.10.0
func (c *ModelBuilderContext[T]) EnsureTask(task Task[T])
EnsureTask ensures that the specified task is configured. It adds the task if it does not already exist. If it does exist, it verifies that the existing task reflect.DeepEqual the new task, if they are different we panic; otherwise it's too easy to forget to check the error code, and realistically we have yet to find a scenario where we can recover from an error here.
func (*ModelBuilderContext[T]) WithContext ¶ added in v1.26.0
func (c *ModelBuilderContext[T]) WithContext(ctx context.Context) *ModelBuilderContext[T]
type NodeupContext ¶ added in v1.26.0
type NodeupContext = Context[NodeupSubContext]
func NewNodeupContext ¶ added in v1.26.0
func NewNodeupContext(ctx context.Context, target NodeupTarget, keystore KeystoreReader, bootConfig *nodeup.BootConfig, nodeupConfig *nodeup.Config, tasks map[string]NodeupTask) (*NodeupContext, error)
type NodeupDryRunTarget ¶ added in v1.26.0
type NodeupDryRunTarget = DryRunTarget[NodeupSubContext]
func NewNodeupDryRunTarget ¶ added in v1.26.0
func NewNodeupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *NodeupDryRunTarget
type NodeupHasCheckExisting ¶ added in v1.26.0
type NodeupHasCheckExisting = HasCheckExisting[NodeupSubContext]
type NodeupHasDependencies ¶ added in v1.26.0
type NodeupHasDependencies = HasDependencies[NodeupSubContext]
type NodeupModelBuilder ¶ added in v1.26.0
type NodeupModelBuilder = ModelBuilder[NodeupSubContext]
type NodeupModelBuilderContext ¶ added in v1.26.0
type NodeupModelBuilderContext = ModelBuilderContext[NodeupSubContext]
type NodeupNotADependency ¶ added in v1.26.0
type NodeupNotADependency = NotADependency[NodeupSubContext]
type NodeupSubContext ¶ added in v1.26.0
type NodeupSubContext struct { BootConfig *nodeup.BootConfig NodeupConfig *nodeup.Config Keystore KeystoreReader }
type NodeupTarget ¶ added in v1.26.0
type NodeupTarget = Target[NodeupSubContext]
type NodeupTask ¶ added in v1.26.0
type NodeupTask = Task[NodeupSubContext]
type NodeupTaskDependentResource ¶ added in v1.26.0
type NodeupTaskDependentResource = TaskDependentResource[NodeupSubContext]
type NotADependency ¶ added in v1.19.0
type NotADependency[T SubContext] struct{}
NotADependency is a marker type to prevent FindTaskDependencies() from considering it a potential dependency.
func (NotADependency[T]) GetDependencies ¶ added in v1.19.0
func (NotADependency[T]) GetDependencies(map[string]Task[T]) []Task[T]
type ProducesDeletions ¶
type ProducesDeletions[T SubContext] interface { FindDeletions(*Context[T]) ([]Deletion[T], error) }
type Resource ¶
func FunctionToResource ¶ added in v1.24.0
FunctionToResource converts a function to a Resource. The result of executing the function is cached.
type RunTasksOptions ¶ added in v1.10.0
func (*RunTasksOptions) InitDefaults ¶ added in v1.10.0
func (o *RunTasksOptions) InitDefaults()
type SSHCredentialStore ¶ added in v1.10.0
type SSHCredentialStore interface { // DeleteSSHCredential deletes the specified SSH credential. DeleteSSHCredential() error // AddSSHPublicKey adds an SSH public key. AddSSHPublicKey(ctx context.Context, data []byte) error // FindSSHPublicKeys retrieves the SSH public keys. FindSSHPublicKeys() ([]*kops.SSHCredential, error) }
SSHCredentialStore holds SSHCredential objects
func NewClientsetSSHCredentialStore ¶ added in v1.10.0
func NewClientsetSSHCredentialStore(cluster *kops.Cluster, clientset kopsinternalversion.KopsInterface, namespace string) SSHCredentialStore
NewClientsetSSHCredentialStore creates an SSHCredentialStore backed by an API client
func NewVFSSSHCredentialStore ¶ added in v1.10.0
func NewVFSSSHCredentialStore(cluster *kops.Cluster, basedir vfs.Path) SSHCredentialStore
NewVFSSSHCredentialStore creates a SSHCredentialStore backed by VFS
type SecretStore ¶
type SecretStore interface { SecretStoreReader // DeleteSecret deletes the specified secret DeleteSecret(id string) error // GetOrCreateSecret creates a secret GetOrCreateSecret(ctx context.Context, id string, secret *Secret) (current *Secret, created bool, err error) // ReplaceSecret will forcefully update an existing secret if it exists ReplaceSecret(id string, secret *Secret) (current *Secret, err error) // ListSecrets lists the ids of all known secrets ListSecrets() ([]string, error) // MirrorTo will copy secrets to a vfs.Path, which is often easier for a machine to read MirrorTo(ctx context.Context, basedir vfs.Path) error }
type SecretStoreReader ¶ added in v1.27.0
type StringResource ¶
type StringResource struct {
// contains filtered or unexported fields
}
func NewStringResource ¶
func NewStringResource(s string) *StringResource
func (*StringResource) MarshalJSON ¶ added in v1.10.0
func (r *StringResource) MarshalJSON() ([]byte, error)
type SubContext ¶ added in v1.26.0
type SubContext interface { CloudupSubContext | InstallSubContext | NodeupSubContext }
type SubnetInfo ¶ added in v1.10.0
type Target ¶
type Target[T SubContext] interface { // Lifecycle methods, called by the driver Finish(taskMap map[string]Task[T]) error // DefaultCheckExisting returns true if DefaultDeltaRun tasks which aren't HasCheckExisting // should invoke Find() when running against this Target. DefaultCheckExisting() bool }
type Task ¶
type Task[T SubContext] interface { Run(*Context[T]) error }
func FindDependencies ¶ added in v1.20.0
func FindDependencies[T SubContext](tasks map[string]Task[T], o interface{}) []Task[T]
FindDependencies will try to infer dependencies for an arbitrary object
type TaskDependentResource ¶ added in v1.19.0
type TaskDependentResource[T SubContext] struct { Resource Resource `json:"resource,omitempty"` Task Task[T] `json:"task,omitempty"` }
func (*TaskDependentResource[T]) GetDependencies ¶ added in v1.19.0
func (r *TaskDependentResource[T]) GetDependencies(tasks map[string]Task[T]) []Task[T]
func (*TaskDependentResource[T]) IsReady ¶ added in v1.19.0
func (r *TaskDependentResource[T]) IsReady() bool
IsReady implements HasIsReady::IsReady
type TaskNormalize ¶ added in v1.26.0
type TaskNormalize[T SubContext] interface { Task[T] // Normalize will be run for all TaskNormalizes, before the Run function of // the TaskNormalize and after the Run function of any Task it is dependent on. Normalize(*Context[T]) error }
TaskNormalize is implemented by tasks that perform some initial normalization.
type TaskPreRun ¶ added in v1.18.3
type TaskPreRun[T SubContext] interface { Task[T] // PreRun will be run for all TaskPreRuns, before any Run functions are invoked. PreRun(*Context[T]) error }
TaskPreRun is implemented by tasks that perform some initial validation.
type TryAgainLaterError ¶ added in v1.19.0
type TryAgainLaterError struct {
// contains filtered or unexported fields
}
TryAgainLaterError is the custom used when a task needs to fail validation with a message and try again later
func NewTryAgainLaterError ¶ added in v1.19.0
func NewTryAgainLaterError(message string) *TryAgainLaterError
NewTryAgainLaterError is a builder for TryAgainLaterError.
func (*TryAgainLaterError) Error ¶ added in v1.19.0
func (e *TryAgainLaterError) Error() string
TryAgainLaterError implementation of the error interface.
func (*TryAgainLaterError) Unwrap ¶ added in v1.28.0
func (e *TryAgainLaterError) Unwrap() error
func (*TryAgainLaterError) WithError ¶ added in v1.28.0
func (e *TryAgainLaterError) WithError(err error) *TryAgainLaterError
type VFSCAStore ¶
type VFSCAStore struct { VFSKeystoreReader // contains filtered or unexported fields }
func NewVFSCAStore ¶
func NewVFSCAStore(cluster *kops.Cluster, basedir vfs.Path) *VFSCAStore
func (*VFSCAStore) AddSSHPublicKey ¶
func (c *VFSCAStore) AddSSHPublicKey(ctx context.Context, pubkey []byte) error
AddSSHPublicKey stores an SSH public key
func (*VFSCAStore) DeleteSSHCredential ¶ added in v1.10.0
func (c *VFSCAStore) DeleteSSHCredential() error
func (*VFSCAStore) FindSSHPublicKeys ¶
func (c *VFSCAStore) FindSSHPublicKeys() ([]*kops.SSHCredential, error)
func (*VFSCAStore) ListKeysets ¶ added in v1.10.0
func (c *VFSCAStore) ListKeysets() (map[string]*Keyset, error)
ListKeysets implements CAStore::ListKeysets
func (*VFSCAStore) MirrorTo ¶ added in v1.10.0
MirrorTo will copy keys to a vfs.Path, which is often easier for a machine to read
func (*VFSCAStore) StoreKeyset ¶ added in v1.21.3
type VFSKeystoreReader ¶ added in v1.27.0
type VFSKeystoreReader struct {
// contains filtered or unexported fields
}
func NewVFSKeystoreReader ¶ added in v1.27.0
func NewVFSKeystoreReader(basedir vfs.Path) *VFSKeystoreReader
func (*VFSKeystoreReader) FindKeyset ¶ added in v1.27.0
func (*VFSKeystoreReader) FindPrimaryKeypair ¶
func (c *VFSKeystoreReader) FindPrimaryKeypair(ctx context.Context, name string) (*pki.Certificate, *pki.PrivateKey, error)
FindPrimaryKeypair implements pki.Keystore
func (*VFSKeystoreReader) VFSPath ¶ added in v1.27.0
func (c *VFSKeystoreReader) VFSPath() vfs.Path
type VFSResource ¶
func NewVFSResource ¶
func NewVFSResource(path vfs.Path) *VFSResource
type VPCInfo ¶ added in v1.10.0
type VPCInfo struct { // CIDR is the IP address range for the VPC CIDR string // Subnets is a list of subnets that are part of the VPC Subnets []*SubnetInfo }
type Warning ¶ added in v1.10.0
type Warning[T SubContext] struct { Task Task[T] Message string }
Warning holds the details of a warning encountered during validation/creation
Source Files ¶
- assetstore.go
- ca.go
- changes.go
- clientset_castore.go
- cloud.go
- compare_with_id.go
- context.go
- default_methods.go
- deletions.go
- doc.go
- dryrun_target.go
- errors.go
- executor.go
- files.go
- files_owner.go
- has_address.go
- http.go
- lifecycle.go
- named.go
- printers.go
- resources.go
- secrets.go
- target.go
- task.go
- timestamp.go
- topological_sort.go
- users.go
- values.go
- vfs_castore.go
- vfs_keystorereader.go