Skip to content

Commit

Permalink
Merge branch 'aws:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
vrv7567 authored Jun 10, 2024
2 parents 74afe28 + 560fbf4 commit 1c9b3fb
Show file tree
Hide file tree
Showing 263 changed files with 12,611 additions and 3,382 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Run go test with coverage
run: COVER_PROFILE=coverage.txt make coverage-unit-test
- name: Codecov upload
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.1
with:
files: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
only-new-issues: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/vulnerability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches:
- main
pull_request:
paths-ignore:
- '**.yaml'
- '**.yml'
workflow_dispatch:
schedule:
# every day at 7am UTC
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ endif

ifeq (,$(findstring $(BRANCH_NAME),main))
## use the branch-specific bundle manifest if the branch is not 'main'
BUNDLE_MANIFEST_URL?=https://dev-release-assets.eks-anywhere.model-rocket.aws.dev/${BRANCH_NAME}/bundle-release.yaml
RELEASE_MANIFEST_URL?=$(RELEASE_MANIFEST_HOST)/${BRANCH_NAME}/eks-a-release.yaml
LATEST=$(BRANCH_NAME)
else
## use the standard bundle manifest if the branch is 'main'
BUNDLE_MANIFEST_URL?=https://dev-release-assets.eks-anywhere.model-rocket.aws.dev/bundle-release.yaml
RELEASE_MANIFEST_URL?=$(RELEASE_MANIFEST_HOST)/eks-a-release.yaml
LATEST=latest
endif
BUNDLE_MANIFEST_URL?=$(shell curl $(RELEASE_MANIFEST_URL) | yq ".spec.releases[-1].bundleManifestUrl")

# DEV_GIT_VERSION should be something like v0.19.0-dev+latest, depending on the base branch
# and if this is a local build or a CI build.
Expand Down Expand Up @@ -160,7 +159,7 @@ EKS_A_CROSS_PLATFORMS := $(foreach platform,$(EKS_A_PLATFORMS),eks-a-cross-platf
E2E_CROSS_PLATFORMS := $(foreach platform,$(EKS_A_PLATFORMS),e2e-cross-platform-$(platform))
EKS_A_RELEASE_CROSS_PLATFORMS := $(foreach platform,$(EKS_A_PLATFORMS),eks-a-release-cross-platform-$(platform))

DOCKER_E2E_TEST := TestDockerKubernetes125SimpleFlow
DOCKER_E2E_TEST := TestDockerKubernetes130SimpleFlow
LOCAL_E2E_TESTS ?= $(DOCKER_E2E_TEST)

EMBED_CONFIG_FOLDER = pkg/files/config
Expand Down Expand Up @@ -568,7 +567,7 @@ mocks: ## Generate mocks
${MOCKGEN} -destination=pkg/bootstrapper/mocks/bootstrapper.go -package=mocks "github.com/aws/eks-anywhere/pkg/bootstrapper" ClusterClient
${MOCKGEN} -destination=pkg/git/providers/github/mocks/github.go -package=mocks "github.com/aws/eks-anywhere/pkg/git/providers/github" GithubClient
${MOCKGEN} -destination=pkg/git/mocks/git.go -package=mocks "github.com/aws/eks-anywhere/pkg/git" Client,ProviderClient
${MOCKGEN} -destination=pkg/workflows/interfaces/mocks/clients.go -package=mocks "github.com/aws/eks-anywhere/pkg/workflows/interfaces" Bootstrapper,ClusterManager,GitOpsManager,Validator,CAPIManager,EksdInstaller,EksdUpgrader,PackageInstaller,ClusterUpgrader,ClusterCreator,ClientFactory,EksaInstaller,ClusterDeleter
${MOCKGEN} -destination=pkg/workflows/interfaces/mocks/clients.go -package=mocks "github.com/aws/eks-anywhere/pkg/workflows/interfaces" Bootstrapper,ClusterManager,GitOpsManager,Validator,CAPIManager,EksdInstaller,EksdUpgrader,PackageManager,ClusterUpgrader,ClusterCreator,ClientFactory,EksaInstaller,ClusterDeleter,ClusterMover
${MOCKGEN} -destination=pkg/git/gogithub/mocks/client.go -package=mocks "github.com/aws/eks-anywhere/pkg/git/gogithub" Client
${MOCKGEN} -destination=pkg/git/gitclient/mocks/client.go -package=mocks "github.com/aws/eks-anywhere/pkg/git/gitclient" GoGit
${MOCKGEN} -destination=pkg/validations/mocks/docker.go -package=mocks "github.com/aws/eks-anywhere/pkg/validations" DockerExecutable
Expand Down
3 changes: 1 addition & 2 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ approvers:
- abhay-krishna
- abhinavmpandey08
- ahreehong
- chrisdoherty4
- cxbrowne1207
- d8660091
- drewvanstone
Expand All @@ -18,4 +17,4 @@ approvers:
- taneyland
- tatlat
- vignesh-goutham
- vivek-koppuru
- vivek-koppuru
2 changes: 1 addition & 1 deletion cmd/eks-a-tool/cmd/cloudstackrmvms.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var cloudstackRmVmsCmd = &cobra.Command{
if err != nil {
return err
}
err = cleanup.CleanUpCloudstackTestResources(cmd.Context(), clusterName, viper.GetBool(dryRunFlag))
err = cleanup.CloudstackTestResources(cmd.Context(), clusterName, viper.GetBool(dryRunFlag), false)
if err != nil {
log.Fatalf("Error removing vms: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/eks-a-tool/cmd/nutanixrmvms.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var nutanixRmVmsCmd = &cobra.Command{
if viper.IsSet(insecureFlag) {
insecure = true
}
err = cleanup.NutanixTestResourcesCleanup(cmd.Context(), clusterName, viper.GetString(endpointFlag), viper.GetString(portFlag), insecure, viper.GetBool(ignoreErrorsFlag))
err = cleanup.NutanixTestResources(clusterName, viper.GetString(endpointFlag), viper.GetString(portFlag), insecure, viper.GetBool(ignoreErrorsFlag))
if err != nil {
log.Fatalf("Error removing vms: %v", err)
}
Expand Down
21 changes: 18 additions & 3 deletions cmd/eksctl-anywhere/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package cmd
import (
"context"

anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/dependencies"
"github.com/aws/eks-anywhere/pkg/files"
"github.com/aws/eks-anywhere/pkg/helm"
"github.com/aws/eks-anywhere/pkg/kubeconfig"
"github.com/aws/eks-anywhere/pkg/manifests/bundles"
"github.com/aws/eks-anywhere/pkg/registrymirror"
"github.com/aws/eks-anywhere/pkg/version"
"github.com/aws/eks-anywhere/release/api/v1alpha1"
)
Expand Down Expand Up @@ -50,7 +52,7 @@ func getKubeconfigPath(clusterName, override string) string {

func NewDependenciesForPackages(ctx context.Context, opts ...PackageOpt) (*dependencies.Dependencies, error) {
config := New(opts...)
return dependencies.NewFactory().
f := dependencies.NewFactory().
WithExecutableMountDirs(config.mountPaths...).
WithCustomBundles(config.bundlesOverride).
WithExecutableBuilder().
Expand All @@ -59,8 +61,13 @@ func NewDependenciesForPackages(ctx context.Context, opts ...PackageOpt) (*depen
WithHelm(helm.WithInsecure()).
WithCuratedPackagesRegistry(config.registryName, config.kubeVersion, version.Get()).
WithPackageControllerClient(config.spec, config.kubeConfig).
WithLogger().
Build(ctx)
WithLogger()

if config.cluster != nil && config.cluster.Spec.RegistryMirrorConfiguration != nil {
f.WithRegistryMirror(registrymirror.FromCluster(config.cluster))
}

return f.Build(ctx)
}

type PackageOpt func(*PackageConfig)
Expand All @@ -72,6 +79,7 @@ type PackageConfig struct {
mountPaths []string
spec *cluster.Spec
bundlesOverride string
cluster *anywherev1.Cluster
}

func New(options ...PackageOpt) *PackageConfig {
Expand Down Expand Up @@ -118,3 +126,10 @@ func WithBundlesOverride(bundlesOverride string) func(*PackageConfig) {
config.bundlesOverride = bundlesOverride
}
}

// WithCluster sets cluster in the config with incoming value.
func WithCluster(cluster *anywherev1.Cluster) func(config *PackageConfig) {
return func(config *PackageConfig) {
config.cluster = cluster
}
}
10 changes: 6 additions & 4 deletions cmd/eksctl-anywhere/cmd/createcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ func (cc *createClusterOptions) createCluster(cmd *cobra.Command, _ []string) er
WithGitOpsFlux(clusterSpec.Cluster, clusterSpec.FluxConfig, cliConfig).
WithWriter().
WithEksdInstaller().
WithPackageInstaller(clusterSpec, cc.installPackages, cc.managementKubeconfig).
WithPackageManager(clusterSpec, cc.installPackages, cc.managementKubeconfig).
WithValidatorClients().
WithCreateClusterDefaulter(createCLIConfig).
WithClusterApplier().
WithKubeconfigWriter(clusterSpec.Cluster).
WithClusterCreator(clusterSpec.Cluster)
WithClusterCreator(clusterSpec.Cluster).
WithClusterMover()

if cc.timeoutOptions.noTimeouts {
factory.WithNoTimeouts()
Expand Down Expand Up @@ -254,7 +255,7 @@ func (cc *createClusterOptions) createCluster(cmd *cobra.Command, _ []string) er
deps.GitOpsFlux,
deps.Writer,
deps.EksdInstaller,
deps.PackageInstaller,
deps.PackageManager,
deps.ClusterCreator,
deps.UnAuthKubectlClient,
)
Expand All @@ -271,9 +272,10 @@ func (cc *createClusterOptions) createCluster(cmd *cobra.Command, _ []string) er
deps.GitOpsFlux,
deps.Writer,
deps.EksdInstaller,
deps.PackageInstaller,
deps.PackageManager,
deps.ClusterCreator,
deps.EksaInstaller,
deps.ClusterMover,
)

err = createMgmtCluster.Run(ctx, clusterSpec, createValidations)
Expand Down
3 changes: 2 additions & 1 deletion cmd/eksctl-anywhere/cmd/deletecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (dc *deleteClusterOptions) deleteCluster(ctx context.Context) error {
WithEksdInstaller().
WithEKSAInstaller().
WithUnAuthKubeClient().
WithClusterMover().
Build(ctx)
if err != nil {
return err
Expand Down Expand Up @@ -154,7 +155,7 @@ func (dc *deleteClusterOptions) deleteCluster(ctx context.Context) error {
deleteWorkload := workload.NewDelete(deps.Provider, deps.Writer, deps.ClusterManager, deps.ClusterDeleter, deps.GitOpsFlux)
err = deleteWorkload.Run(ctx, cluster, clusterSpec)
} else {
deleteManagement := management.NewDelete(deps.Bootstrapper, deps.Provider, deps.Writer, deps.ClusterManager, deps.GitOpsFlux, deps.ClusterDeleter, deps.EksdInstaller, deps.EksaInstaller, deps.UnAuthKubeClient)
deleteManagement := management.NewDelete(deps.Bootstrapper, deps.Provider, deps.Writer, deps.ClusterManager, deps.GitOpsFlux, deps.ClusterDeleter, deps.EksdInstaller, deps.EksaInstaller, deps.UnAuthKubeClient, deps.ClusterMover)
err = deleteManagement.Run(ctx, cluster, clusterSpec)
}
cleanup(deps, &err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/eksctl-anywhere/cmd/generateclusterconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func preRunGenerateClusterConfig(cmd *cobra.Command, args []string) {

func init() {
generateCmd.AddCommand(generateClusterConfigCmd)
generateClusterConfigCmd.Flags().StringP("provider", "p", "", "Provider to use (vsphere or tinkerbell or docker)")
generateClusterConfigCmd.Flags().StringP("provider", "p", "", fmt.Sprintf("Provider to use (%s)", strings.Join(constants.SupportedProviders, " or ")))
err := generateClusterConfigCmd.MarkFlagRequired("provider")
if err != nil {
log.Fatalf("marking flag as required: %v", err)
Expand Down
21 changes: 20 additions & 1 deletion cmd/eksctl-anywhere/cmd/generatepackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import (
"log"

"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types"

anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anywhere/pkg/kubeconfig"
)
Expand Down Expand Up @@ -70,7 +74,22 @@ func generatePackages(ctx context.Context, args []string) error {
return err
}

deps, err := NewDependenciesForPackages(ctx, WithRegistryName(gpOptions.registry), WithKubeVersion(gpOptions.kubeVersion), WithMountPaths(kubeConfig), WithBundlesOverride(gpOptions.bundlesOverride))
k8sClient, err := kubernetes.NewRuntimeClientFromFileName(kubeConfig)
if err != nil {
return fmt.Errorf("unable to initalize k8s client: %v", err)
}

cluster := &anywherev1.Cluster{}
if err := k8sClient.Get(ctx, types.NamespacedName{Name: gpOptions.clusterName, Namespace: constants.DefaultNamespace}, cluster); err != nil {
return fmt.Errorf("unable to get cluster %s: %v", gpOptions.clusterName, err)
}

deps, err := NewDependenciesForPackages(ctx,
WithRegistryName(gpOptions.registry),
WithKubeVersion(gpOptions.kubeVersion),
WithMountPaths(kubeConfig),
WithBundlesOverride(gpOptions.bundlesOverride),
WithCluster(cluster))
if err != nil {
return fmt.Errorf("unable to initialize executables: %v", err)
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/eksctl-anywhere/cmd/installpackagecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ func installPackageController(ctx context.Context) error {
return fmt.Errorf("the cluster config file provided is invalid: %v", err)
}

deps, err := NewDependenciesForPackages(ctx, WithMountPaths(kubeConfig), WithClusterSpec(clusterSpec), WithKubeConfig(ico.kubeConfig), WithBundlesOverride(ico.bundlesOverride))
deps, err := NewDependenciesForPackages(ctx,
WithMountPaths(kubeConfig),
WithClusterSpec(clusterSpec),
WithKubeConfig(ico.kubeConfig),
WithBundlesOverride(ico.bundlesOverride),
WithCluster(clusterSpec.Cluster))
if err != nil {
return fmt.Errorf("unable to initialize executables: %v", err)
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/eksctl-anywhere/cmd/upgradecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (uc *upgradeClusterOptions) upgradeCluster(cmd *cobra.Command, args []strin
WithEksdInstaller().
WithKubectl().
WithValidatorClients().
WithPackageManagerWithoutWait(clusterSpec, "", uc.managementKubeconfig).
WithUpgradeClusterDefaulter(upgradeCLIConfig)

if uc.timeoutOptions.noTimeouts {
Expand Down Expand Up @@ -212,6 +213,7 @@ func (uc *upgradeClusterOptions) upgradeCluster(cmd *cobra.Command, args []strin
deps.EksdUpgrader,
deps.EksdInstaller,
deps.ClusterApplier,
deps.PackageManager,
)

err = upgrade.Run(ctx, clusterSpec, managementCluster, upgradeValidations)
Expand All @@ -225,7 +227,7 @@ func (uc *upgradeClusterOptions) upgradeCluster(cmd *cobra.Command, args []strin
deps.Writer,
deps.ClusterApplier,
deps.EksdInstaller,
deps.PackageInstaller,
deps.PackageManager,
)
err = upgradeWorkloadCluster.Run(ctx, workloadCluster, clusterSpec, upgradeValidations)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ env:
T_IRSA_S3_BUCKET: "etcd-encryption:irsa_s3_bucket"
T_KMS_IAM_ROLE: "etcd-encryption:kms_iam_role_arn"
T_KMS_IMAGE: "etcd-encryption:kms_image"
T_POD_IDENTITY_WEBHOOK_IMAGE: "etcd-encryption:pod_identity_webhook_image"
T_KMS_KEY_ARN: "etcd-encryption:kms_key_arn"
T_KMS_KEY_REGION: "etcd-encryption:region"
T_KMS_SOCKET: "etcd-encryption:socket"
Expand All @@ -82,7 +83,8 @@ phases:
- >
./bin/test e2e cleanup cloudstack
-n ${CLUSTER_NAME_PREFIX}
-v 4
--delete-duplicate-networks
-v 6
build:
commands:
- export JOB_ID=$CODEBUILD_BUILD_ID
Expand All @@ -105,7 +107,7 @@ phases:
-v 4
--skip ${SKIPPED_TESTS}
--bundles-override=${BUNDLES_OVERRIDE}
--cleanup-vms=true
--cleanup-resources=true
--test-report-folder=reports
--branch-name=${BRANCH_NAME}
--baremetal-branch=${BAREMETAL_BRANCH}
Expand Down
Loading

0 comments on commit 1c9b3fb

Please sign in to comment.