-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create management cluster using controller behind feature flag
- Loading branch information
1 parent
59789da
commit 8beb6e9
Showing
10 changed files
with
606 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ docs/.hugo_build.lock | |
*.log | ||
pkg/executables/TestDeployTemplate* | ||
pkg/files/config | ||
*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package management | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/eks-anywhere/pkg/cluster" | ||
"github.com/aws/eks-anywhere/pkg/constants" | ||
"github.com/aws/eks-anywhere/pkg/filewriter" | ||
"github.com/aws/eks-anywhere/pkg/providers" | ||
"github.com/aws/eks-anywhere/pkg/task" | ||
"github.com/aws/eks-anywhere/pkg/types" | ||
"github.com/aws/eks-anywhere/pkg/workflows/interfaces" | ||
) | ||
|
||
// CreateManagement is a schema for create cluster. | ||
type CreateManagement struct { | ||
bootstrapper interfaces.Bootstrapper | ||
provider providers.Provider | ||
clusterManager interfaces.ClusterManager | ||
gitOpsManager interfaces.GitOpsManager | ||
writer filewriter.FileWriter | ||
eksdInstaller interfaces.EksdInstaller | ||
packageInstaller interfaces.PackageInstaller | ||
clusterUpgrader interfaces.ClusterUpgrader | ||
} | ||
|
||
// NewCreateManagement builds a new create construct. | ||
func NewCreateManagement(bootstrapper interfaces.Bootstrapper, provider providers.Provider, | ||
clusterManager interfaces.ClusterManager, gitOpsManager interfaces.GitOpsManager, | ||
writer filewriter.FileWriter, eksdInstaller interfaces.EksdInstaller, | ||
packageInstaller interfaces.PackageInstaller, | ||
clusterUpgrade interfaces.ClusterUpgrader, | ||
) *CreateManagement { | ||
return &CreateManagement{ | ||
bootstrapper: bootstrapper, | ||
provider: provider, | ||
clusterManager: clusterManager, | ||
gitOpsManager: gitOpsManager, | ||
writer: writer, | ||
eksdInstaller: eksdInstaller, | ||
packageInstaller: packageInstaller, | ||
clusterUpgrader: clusterUpgrade, | ||
} | ||
} | ||
|
||
// Run runs all the create management cluster tasks. | ||
func (c *CreateManagement) Run(ctx context.Context, clusterSpec *cluster.Spec, validator interfaces.Validator, forceCleanup bool) error { | ||
if forceCleanup { | ||
if err := c.bootstrapper.DeleteBootstrapCluster(ctx, &types.Cluster{ | ||
Name: clusterSpec.Cluster.Name, | ||
}, constants.Create, forceCleanup); err != nil { | ||
return err | ||
} | ||
} | ||
commandContext := &task.CommandContext{ | ||
Bootstrapper: c.bootstrapper, | ||
Provider: c.provider, | ||
ClusterManager: c.clusterManager, | ||
GitOpsManager: c.gitOpsManager, | ||
ClusterSpec: clusterSpec, | ||
Writer: c.writer, | ||
Validations: validator, | ||
EksdInstaller: c.eksdInstaller, | ||
PackageInstaller: c.packageInstaller, | ||
ClusterUpgrader: c.clusterUpgrader, | ||
} | ||
|
||
if clusterSpec.ManagementCluster != nil { | ||
commandContext.BootstrapCluster = clusterSpec.ManagementCluster | ||
} | ||
|
||
err := task.NewTaskRunner(&setupAndValidateCreate{}, c.writer).RunTask(ctx, commandContext) | ||
|
||
return err | ||
} |
Oops, something went wrong.