mirror of https://github.com/kubernetes/kops.git
Make some functions private
This commit is contained in:
parent
f7383b29da
commit
a16dbf3747
|
@ -69,7 +69,7 @@ type Warning[T SubContext] struct {
|
||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext[T SubContext](ctx context.Context, target Target[T], cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, sub T, tasks map[string]Task[T]) (*Context[T], error) {
|
func newContext[T SubContext](ctx context.Context, target Target[T], cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, sub T, tasks map[string]Task[T]) (*Context[T], error) {
|
||||||
c := &Context[T]{
|
c := &Context[T]{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
Cluster: cluster,
|
Cluster: cluster,
|
||||||
|
@ -86,7 +86,7 @@ func NewContext[T SubContext](ctx context.Context, target Target[T], cluster *ko
|
||||||
|
|
||||||
func NewNodeupContext(ctx context.Context, target NodeupTarget, cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, tasks map[string]NodeupTask) (*NodeupContext, error) {
|
func NewNodeupContext(ctx context.Context, target NodeupTarget, cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, tasks map[string]NodeupTask) (*NodeupContext, error) {
|
||||||
sub := NodeupSubContext{}
|
sub := NodeupSubContext{}
|
||||||
return NewContext[NodeupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks)
|
return newContext[NodeupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCloudupContext(ctx context.Context, target CloudupTarget, cluster *kops.Cluster, cloud Cloud, keystore Keystore, secretStore SecretStore, clusterConfigBase vfs.Path, checkExisting bool, tasks map[string]CloudupTask) (*CloudupContext, error) {
|
func NewCloudupContext(ctx context.Context, target CloudupTarget, cluster *kops.Cluster, cloud Cloud, keystore Keystore, secretStore SecretStore, clusterConfigBase vfs.Path, checkExisting bool, tasks map[string]CloudupTask) (*CloudupContext, error) {
|
||||||
|
@ -94,7 +94,7 @@ func NewCloudupContext(ctx context.Context, target CloudupTarget, cluster *kops.
|
||||||
Cloud: cloud,
|
Cloud: cloud,
|
||||||
ClusterConfigBase: clusterConfigBase,
|
ClusterConfigBase: clusterConfigBase,
|
||||||
}
|
}
|
||||||
return NewContext[CloudupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks)
|
return newContext[CloudupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context[T]) AllTasks() map[string]Task[T] {
|
func (c *Context[T]) AllTasks() map[string]Task[T] {
|
||||||
|
|
|
@ -26,18 +26,18 @@ import (
|
||||||
// NodeupDefaultDeltaRunMethod implements the standard change-based run procedure:
|
// NodeupDefaultDeltaRunMethod implements the standard change-based run procedure:
|
||||||
// find the existing item; compare properties; call render with (actual, expected, changes)
|
// find the existing item; compare properties; call render with (actual, expected, changes)
|
||||||
func NodeupDefaultDeltaRunMethod(e NodeupTask, c *NodeupContext) error {
|
func NodeupDefaultDeltaRunMethod(e NodeupTask, c *NodeupContext) error {
|
||||||
return DefaultDeltaRunMethod[NodeupSubContext](e, c)
|
return defaultDeltaRunMethod[NodeupSubContext](e, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloudupDefaultDeltaRunMethod implements the standard change-based run procedure:
|
// CloudupDefaultDeltaRunMethod implements the standard change-based run procedure:
|
||||||
// find the existing item; compare properties; call render with (actual, expected, changes)
|
// find the existing item; compare properties; call render with (actual, expected, changes)
|
||||||
func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error {
|
func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error {
|
||||||
return DefaultDeltaRunMethod[CloudupSubContext](e, c)
|
return defaultDeltaRunMethod[CloudupSubContext](e, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultDeltaRunMethod implements the standard change-based run procedure:
|
// defaultDeltaRunMethod implements the standard change-based run procedure:
|
||||||
// find the existing item; compare properties; call render with (actual, expected, changes)
|
// find the existing item; compare properties; call render with (actual, expected, changes)
|
||||||
func DefaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error {
|
func defaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error {
|
||||||
var a Task[T]
|
var a Task[T]
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (a DeletionByTaskName[T]) Less(i, j int) bool {
|
||||||
|
|
||||||
var _ Target[CloudupSubContext] = &DryRunTarget[CloudupSubContext]{}
|
var _ Target[CloudupSubContext] = &DryRunTarget[CloudupSubContext]{}
|
||||||
|
|
||||||
func NewDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Writer) *DryRunTarget[T] {
|
func newDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Writer) *DryRunTarget[T] {
|
||||||
t := &DryRunTarget[T]{}
|
t := &DryRunTarget[T]{}
|
||||||
t.out = out
|
t.out = out
|
||||||
t.assetBuilder = assetBuilder
|
t.assetBuilder = assetBuilder
|
||||||
|
@ -85,11 +85,11 @@ func NewDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Wri
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCloudupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *CloudupDryRunTarget {
|
func NewCloudupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *CloudupDryRunTarget {
|
||||||
return NewDryRunTarget[CloudupSubContext](assetBuilder, out)
|
return newDryRunTarget[CloudupSubContext](assetBuilder, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNodeupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *NodeupDryRunTarget {
|
func NewNodeupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *NodeupDryRunTarget {
|
||||||
return NewDryRunTarget[NodeupSubContext](assetBuilder, out)
|
return newDryRunTarget[NodeupSubContext](assetBuilder, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *DryRunTarget[T]) ProcessDeletions() bool {
|
func (t *DryRunTarget[T]) ProcessDeletions() bool {
|
||||||
|
|
|
@ -73,7 +73,7 @@ func Test_DryrunTarget_PrintReport(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, false)
|
}, false)
|
||||||
var stdout bytes.Buffer
|
var stdout bytes.Buffer
|
||||||
target := NewDryRunTarget[CloudupSubContext](builder, &stdout)
|
target := newDryRunTarget[CloudupSubContext](builder, &stdout)
|
||||||
tasks := map[string]CloudupTask{}
|
tasks := map[string]CloudupTask{}
|
||||||
a := &testTask{
|
a := &testTask{
|
||||||
Name: PtrTo("TestName"),
|
Name: PtrTo("TestName"),
|
||||||
|
|
Loading…
Reference in New Issue