Skip to content

Commit

Permalink
#29 - delete artifact-mode functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
apanasiuk-el committed Aug 7, 2024
1 parent ba97fb5 commit b23a916
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 299 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ rmk update --version vX.X.X
to update release and service version declarations, automatically commit the changes to Git.
- **[Project structure generation:](docs/configuration/project-management/preparation-of-project-repository.md#automatic-generation-of-the-project-structure-from-scratch)** Generate a complete Kubernetes-based project structure from scratch using RMK, following the best practices.
- **[Documentation generation:](docs/commands.md#doc)** Generate the full command documentation in the Markdown format with one click.
- **[Support for different types of code sources:](docs/configuration/rmk-configuration-management.md#use-upstream-artifact-for-the-downstream-projects-repository)** Use Git when the _artifact-mode_ is _none_, S3 when the _artifact-mode_ is _online_,
switch to fully offline installations when the _artifact-mode_ is _offline_.

## Supported Kubernetes providers

Expand All @@ -185,7 +183,6 @@ Among the providers are:
- **Integration with Helmfile [vals](https://github.com/helmfile/vals)**: Integrate RMK with the **vals** tool for enhanced values and secret management.
- **Major update of the AWS [EKS](https://aws.amazon.com/eks/) cluster provider:** Update the AWS EKS cluster provider to the latest versions to utilize all the supported features of the [Terraform](https://www.terraform.io/) CLI and modules.
- **Implementation of additional RMK cluster providers:** Implement support for additional cluster providers for popular Kubernetes services such as [GKE](https://cloud.google.com/kubernetes-engine), [AKS](https://azure.microsoft.com/en-us/products/kubernetes-service/), etc.
- **Offline artifact mode:** Implement the **offline** artifact mode to install artifacts in fully isolated offline environments.
- **Web documentation generator:** Add an HTML documentation generator based on the **.md** files.
- **Automatic testing of RMK during the CI/CD pipeline:** Ensure that changes to the RMK codebase do not introduce errors or regressions during the CI/CD.

Expand Down
10 changes: 5 additions & 5 deletions cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (cc *ClusterCommands) clusterStateRefresh() error {

func clusterDestroyAction(conf *config.Config) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down Expand Up @@ -408,7 +408,7 @@ func clusterDestroyAction(conf *config.Config) cli.ActionFunc {

func clusterListAction(conf *config.Config) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down Expand Up @@ -437,7 +437,7 @@ func clusterListAction(conf *config.Config) cli.ActionFunc {

func clusterProvisionAction(conf *config.Config) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down Expand Up @@ -476,7 +476,7 @@ func clusterProvisionAction(conf *config.Config) cli.ActionFunc {

func clusterStateAction(conf *config.Config, action func(stateRunner StateRunner) error) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down Expand Up @@ -505,7 +505,7 @@ func clusterStateAction(conf *config.Config, action func(stateRunner StateRunner

func clusterSwitchAction(conf *config.Config) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down
16 changes: 13 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func getConfigFromEnvironment(c *cli.Context, conf *config.Config, gitSpec *git_
return nil
}

if err := util.ValidateArtifactModeDefault(c, "required parameter --github-token not set"); err != nil {
if err := util.ValidateGitHubToken(c, "required parameter --github-token not set"); err != nil {
return err
}

Expand Down Expand Up @@ -517,11 +517,9 @@ func configInitAction(conf *config.Config, gitSpec *git_handler.GitSpec) cli.Act
}
}

conf.ArtifactMode = c.String("artifact-mode")
conf.ProgressBar = c.Bool("progress-bar")
conf.Terraform.BucketKey = util.TenantBucketKey
conf.ClusterProvisionerSL = c.Bool("cluster-provisioner-state-locking")
conf.S3ChartsRepoRegion = c.String("s3-charts-repo-region")
conf.ClusterProvider = c.String("cluster-provider")
conf.AWSMFAProfile = c.String("aws-mfa-profile")
conf.AWSMFATokenExpiration = c.String("aws-mfa-token-expiration")
Expand Down Expand Up @@ -571,6 +569,18 @@ func configInitAction(conf *config.Config, gitSpec *git_handler.GitSpec) cli.Act
if err := conf.DownloadFromBucket("", conf.SopsBucketName, conf.SopsAgeKeys, conf.Tenant); err != nil {
return err
}

if err := resolveDependencies(conf.InitConfig(true), c, false); err != nil {
return err
}

zap.S().Infof("time spent on initialization: %.fs", time.Since(start).Seconds())

return nil
}

if err := resolveDependencies(conf.InitConfig(false), c, false); err != nil {
return err
}

zap.S().Infof("time spent on initialization: %.fs", time.Since(start).Seconds())
Expand Down
2 changes: 1 addition & 1 deletion cmd/container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (cr *CRCommands) dockerLogout() error {

func containerRegistryAction(conf *config.Config, action func(dockerRunner DockerRunner) error) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down
50 changes: 9 additions & 41 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ import (

func flagsConfig() []cli.Flag {
return []cli.Flag{
// TODO: will be deprecated
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "artifact-mode",
Usage: "choice of artifact usage model, available: none, online, offline",
Aliases: []string{"am"},
EnvVars: []string{"RMK_ARTIFACT_MODE"},
Value: util.ArtifactModeDefault,
},
),
// TODO: will be transfer to cluster category for AWS provider
altsrc.NewStringFlag(
&cli.StringFlag{
Expand Down Expand Up @@ -67,12 +57,6 @@ func flagsConfig() []cli.Flag {
Usage: "force AWS profile creation",
Aliases: []string{"r"},
},
// TODO: will be deprecated
&cli.BoolFlag{
Name: "aws-reconfigure-artifact-license",
Usage: "force AWS profile creation for artifact license, used only if RMK config option artifact-mode has values: online, offline",
Aliases: []string{"l"},
},
// TODO: will be transfer to cluster category for AWS provider
altsrc.NewBoolFlag(
&cli.BoolFlag{
Expand Down Expand Up @@ -116,6 +100,15 @@ func flagsConfig() []cli.Flag {
EnvVars: []string{"RMK_CLOUDFLARE_TOKEN"},
},
),
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "cluster-provider",
Usage: "select cluster provider to provision clusters",
Aliases: []string{"cp"},
EnvVars: []string{"RMK_CLUSTER_PROVIDER"},
Value: util.AWSClusterProvider,
},
),
// TODO: will be transfer to cluster category for AWS provider
altsrc.NewStringFlag(
&cli.StringFlag{
Expand All @@ -133,25 +126,6 @@ func flagsConfig() []cli.Flag {
Value: true,
},
),
// TODO: will be deprecated
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "s3-charts-repo-region",
Usage: "location constraint region of S3 charts repo",
Aliases: []string{"scrr"},
EnvVars: []string{"RMK_S3_CHARTS_REPO_REGION"},
Value: util.S3ChartsRepoRegion,
},
),
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "cluster-provider",
Usage: "select cluster provider to provision clusters",
Aliases: []string{"cp"},
EnvVars: []string{"RMK_CLUSTER_PROVIDER"},
Value: util.AWSClusterProvider,
},
),
altsrc.NewBoolFlag(
&cli.BoolFlag{
Name: "slack-notifications",
Expand Down Expand Up @@ -450,12 +424,6 @@ func flagsHidden() []cli.Flag {
Name: "config",
Hidden: true,
},
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "artifact-mode",
Hidden: true,
},
),
altsrc.NewStringFlag(
&cli.StringFlag{
Name: "github-token",
Expand Down
4 changes: 2 additions & 2 deletions cmd/k3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (k *K3DCommands) startStopK3DCluster() error {

func K3DCreateAction(conf *config.Config) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand All @@ -166,7 +166,7 @@ func K3DCreateAction(conf *config.Config) cli.ActionFunc {

func K3DAction(conf *config.Config, action func(k3dRunner K3DRunner) error) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func (p *ProjectCommands) generateProject(gitSpec *git_handler.GitSpec) error {

func projectGenerateAction(conf *config.Config, gitSpec *git_handler.GitSpec) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand All @@ -425,7 +425,7 @@ func projectGenerateAction(conf *config.Config, gitSpec *git_handler.GitSpec) cl

func projectUpdateAction(conf *config.Config, gitSpec *git_handler.GitSpec) cli.ActionFunc {
return func(c *cli.Context) error {
if err := util.ValidateArtifactModeDefault(c, ""); err != nil {
if err := util.ValidateGitHubToken(c, ""); err != nil {
return err
}

Expand Down
Loading

0 comments on commit b23a916

Please sign in to comment.