Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rmk 29 refactor internal logic of rmk cluster provider initialization and selection #40

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
654e3b0
#29 - restructuring code files, refactoring
apanasiuk-el Aug 1, 2024
ba97fb5
#29 - fix command "config list" output for adjacent tenant names
apanasiuk-el Aug 5, 2024
b23a916
#29 - delete artifact-mode functionality
apanasiuk-el Aug 7, 2024
8d4acd5
#29 - draft refactoring 'rmk config init'
apanasiuk-el Aug 8, 2024
7da2c5f
#29 - deprecate Terraform commands, add commands for managing CAPI
apanasiuk-el Sep 25, 2024
5318f79
#29 - refactoring latest changes
apanasiuk-el Sep 26, 2024
12b1761
#29 - refactoring k3d list command
apanasiuk-el Sep 30, 2024
f1fd76b
#29 - change root-domain configuration
apanasiuk-el Oct 1, 2024
5ae37e4
#29 - refactoring
apanasiuk-el Oct 1, 2024
116bd15
#29 - refactoring
apanasiuk-el Oct 2, 2024
e7a2085
#29 - implement support Azure provider for Cluster API
apanasiuk-el Oct 23, 2024
0100612
#29 - implement support AWS provider for Cluster API
apanasiuk-el Oct 31, 2024
2204611
#29 - refactoring
apanasiuk-el Oct 31, 2024
8b518de
#29 - add creating SSH keys pair for AWS provider
apanasiuk-el Nov 6, 2024
1c0ca2f
#29 - refactoring
apanasiuk-el Nov 6, 2024
c4e02de
#29 - refactoring
apanasiuk-el Nov 6, 2024
016ac74
#29 - refactoring
apanasiuk-el Nov 6, 2024
c5fedc5
#29 - refactoring
apanasiuk-el Nov 7, 2024
8597c60
#29 - refactoring
apanasiuk-el Nov 8, 2024
57d810c
#29 - implement support GCP provider for Cluster API
apanasiuk-el Nov 21, 2024
1d7baf1
#29 - refactoring
apanasiuk-el Nov 21, 2024
a00f79d
#29 - refactoring
apanasiuk-el Nov 21, 2024
358d4e6
#29 - refactoring Google provider environment variables
apanasiuk-el Nov 25, 2024
57c742a
#29 - implement support Azure key vault for store SOPS Age keys
apanasiuk-el Dec 11, 2024
e37b7e3
#29 - refactoring
apanasiuk-el Dec 11, 2024
92ed29e
#29 - refactoring
apanasiuk-el Dec 11, 2024
81db188
#29 - implement support GCP secrets manager for store SOPS Age keys
apanasiuk-el Dec 16, 2024
50d34cf
#29 - refactoring
apanasiuk-el Dec 16, 2024
bf028e7
#29 - implement support AWS secrets manager for store SOPS Age keys
apanasiuk-el Dec 17, 2024
20e0ccf
#29 - refactoring
apanasiuk-el Dec 17, 2024
e1b43a7
#29 - add release notes
apanasiuk-el Dec 17, 2024
8b0d70f
#29 - refactoring release notes
apanasiuk-el Dec 17, 2024
6c9c60f
#29 - fix project generate behavior
apanasiuk-el Dec 18, 2024
cc25491
#29 - refactoring
apanasiuk-el Dec 18, 2024
ff3f732
#29 - resolved conflicts
apanasiuk-el Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
70 changes: 70 additions & 0 deletions cmd/cluster.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package cmd

import (
"strings"

"github.com/urfave/cli/v2"

"rmk/config"
"rmk/util"
)

type ClusterCommands struct {
*ReleaseCommands
}

func newClusterCommands(conf *config.Config, ctx *cli.Context, workDir string) *ClusterCommands {
return &ClusterCommands{&ReleaseCommands{Conf: conf, Ctx: ctx, WorkDir: workDir}}
}

func (cc *ClusterCommands) awsEks() *util.SpecCMD {
return &util.SpecCMD{
Envs: []string{
"AWS_PROFILE=" + cc.Conf.Profile,
"AWS_CONFIG_FILE=" + strings.Join(cc.Conf.AWSSharedConfigFile(cc.Conf.Profile), ""),
"AWS_SHARED_CREDENTIALS_FILE=" + strings.Join(cc.Conf.AWSSharedCredentialsFile(cc.Conf.Profile), ""),
},
Args: []string{"eks", "--region",
cc.Conf.Region,
"update-kubeconfig",
"--name",
cc.Conf.Name + "-eks",
"--profile",
cc.Conf.Profile,
},
Command: "aws",
Ctx: cc.Ctx.Context,
Dir: cc.WorkDir,
Debug: true,
}
}

func (cc *ClusterCommands) awsClusterContext() error {
cc.SpecCMD = cc.awsEks()
return runner(cc).runCMD()
}

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

if err := util.ValidateNArg(c, 0); err != nil {
return err
}

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

rc := &ReleaseCommands{
Conf: conf,
Ctx: c,
WorkDir: util.GetPwdPath(""),
UpdateContext: c.Bool("force"),
}

return rc.releaseKubeContext()
}
}
Loading