repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
eks-anywhere
aws
Go
package framework import "testing" // T defines test support functionality, ala the Go stdlib testing.T. // // Being able to change its implementation supports logging functionality for // test support methods that are executed outside of a test, such as when // bringing up or tearing down test clusters that will be ...
150
eks-anywhere
aws
Go
package framework import ( "os" "testing" "github.com/aws/eks-anywhere/internal/pkg/api" anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" clusterf "github.com/aws/eks-anywhere/test/framework/cluster" ) const ( TinkerbellProviderName = "tinkerbell" tinkerbellBootstrapIPEnvVar ...
312
eks-anywhere
aws
Go
package framework import ( "context" "fmt" "os" "path/filepath" "strings" "testing" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1" "github.com/aws/eks-anywhere/internal/pkg/api" "github.com/aws/eks-anywhere/internal/test/cleanup" anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.c...
751
eks-anywhere
aws
Go
package framework import ( "context" "time" "github.com/aws/eks-anywhere/pkg/retrier" ) func (e *ClusterE2ETest) WaitForControlPlaneReady() { e.T.Log("Waiting for control plane to be ready") err := retrier.New(5 * time.Minute).Retry(func() error { return e.KubectlClient.ValidateControlPlaneNodes(context.Backg...
19
eks-anywhere
aws
Go
package framework import "github.com/aws/eks-anywhere/internal/pkg/api" type WorkerNodeGroup struct { Name string Fillers []api.WorkerNodeGroupFiller MachineConfigKind, MachineConfigName string } func WithWorkerNodeGroup(name string, fillers ...api.Work...
25
eks-anywhere
aws
Go
package framework import ( "context" "fmt" corev1 "k8s.io/api/core/v1" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/executables" ) // WorkerNodeValidation should return an error if either an error is encountered during execution or...
65
eks-anywhere
aws
Go
package framework import ( "context" "errors" "fmt" "path/filepath" "time" "github.com/aws/eks-anywhere/internal/pkg/api" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/retrier" ) const ( kubectlDeleteTimeout = "20m" ) type Workloa...
170
eks-anywhere
aws
Go
package cluster_test import ( "context" "fmt" "testing" "time" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/retri...
111
eks-anywhere
aws
Go
package cluster import ( "context" "k8s.io/apimachinery/pkg/util/errors" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/retrier" ) // StateValidation defines a validation that can be registered to the StateValidator. type StateValidation =...
71
eks-anywhere
aws
Go
package validations import ( "context" "fmt" "k8s.io/apimachinery/pkg/types" cloudstackv1 "sigs.k8s.io/cluster-api-provider-cloudstack/api/v1beta2" "github.com/aws/eks-anywhere/pkg/constants" clusterf "github.com/aws/eks-anywhere/test/framework/cluster" ) // ValidateAvailabilityZones checks each availability ...
31
eks-anywhere
aws
Go
package validations_test import ( "context" "testing" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" cloudstackv1 "sigs.k8s.io/cluster-api-provider-cloudstack/api/v1beta2" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/aws/eks-anywhere/internal/t...
117
eks-anywhere
aws
Go
package validations import ( "context" "fmt" "strings" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" apierrors "k8s.io/apimachinery/pkg/util/errors" "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/c...
227
eks-anywhere
aws
Go
package validations_test import ( "context" "fmt" "testing" "time" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/contr...
586
eks-anywhere-build-tooling
aws
Go
package main import ( "flag" "fmt" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" ) func main() { logVerbosity := flag.String("v", "9", "Verbosity of logs") utils.LogVerbosity = fmt.Sprintf("-v%s", *logVerbosit...
16
eks-anywhere-build-tooling
aws
Go
package pkg import ( "fmt" "os" "strings" "time" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/etcdadm" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/kubeadm" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) ...
107
eks-anywhere-build-tooling
aws
Go
package etcdadm import ( "os" "strings" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) const ( CmdPrefix = "Etcdadm" manifestFileName = "etcd.manifest" rootfsEtcdBaseD...
97
eks-anywhere-build-tooling
aws
Go
package etcdadm func buildFlags(repository, version, cipherSuites string) []string { return []string{ "-l", "debug", "--version", version, "--init-system", "kubelet", "--image-repository", repository, "--certs-dir", certDir, "--data-dir", dataDir, "--kubelet-pod-manifest-path", podSpecDir, "--cipher-s...
15
eks-anywhere-build-tooling
aws
Go
package etcdadm import ( "fmt" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) var initPreKubeletPhases = []string{ "install", "certificates", "snapshot", "configure", "start", } var initPostKubeletPhases = []string{"health"} type initCommand struct { ...
51
eks-anywhere-build-tooling
aws
Go
package etcdadm import ( "fmt" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) var joinPreKubeletPhases = []string{ "stop", "certificates", "membership", "install", "configure", "start", } var joinPostKubeletPhases = []string{"health"} type joinComman...
53
eks-anywhere-build-tooling
aws
Go
package etcdadm import ( "fmt" "os/exec" "github.com/pkg/errors" ) func runPhases(command string, phases, flags []string, args ...string) error { for _, phase := range phases { fmt.Printf("Running etcdadm %s %s phase\n", command, phase) cmd := exec.Command(etcdadmBinary, buildPhaseCmd(command, phase, args......
37
eks-anywhere-build-tooling
aws
Go
package executables import ( "encoding/json" "fmt" "github.com/pkg/errors" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" ) type APIClient struct { Executable } type APISetting struct { Kernel *Kernel `json:"kernel,omitempty"` Kubernetes *Kubernetes `json:"kubernetes,om...
63
eks-anywhere-build-tooling
aws
Go
package executables_test import ( "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables/mocks" ) type apiClientTest struc...
273
eks-anywhere-build-tooling
aws
Go
//go:generate ../../hack/tools/bin/mockgen -destination ./mocks/executables_mock.go -package mocks . Executable package executables import ( "os/exec" "github.com/pkg/errors" ) type Executable interface { Execute(args ...string) (out []byte, err error) } type executable struct { binary string } func NewExecut...
33
eks-anywhere-build-tooling
aws
Go
package executables const ( mountBinary = "mount" mkfsExt4Binary = "mkfs.ext4" ) type FileSystem struct { Mount, Mkfs Executable } func NewFileSystem() *FileSystem { return &FileSystem{ Mount: NewExecutable(mountBinary), Mkfs: NewExecutable(mkfsExt4Binary), } } func (f *FileSystem) MountVolume(device, ...
28
eks-anywhere-build-tooling
aws
Go
package executables_test import ( "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables/mocks" ) type fileSystemTest stru...
117
eks-anywhere-build-tooling
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables (interfaces: Executable) // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockExecutable is a m...
54
eks-anywhere-build-tooling
aws
Go
package files import ( "fmt" "os" "os/exec" "github.com/pkg/errors" ) func CreateSymLink(from, to string) error { // Force symlink creation with cmd. sdk calls fail if the symlink dir exists cmd := exec.Command("bash", "-c", fmt.Sprintf("ln -sfn %s %s", from, to)) if err := cmd.Run(); err != nil { return er...
25
eks-anywhere-build-tooling
aws
Go
package files import ( "bytes" "text/template" "github.com/pkg/errors" ) func ExecuteTemplate(content string, data interface{}) ([]byte, error) { temp := template.New("tmpl") temp, err := temp.Parse(content) if err != nil { return nil, errors.Wrap(err, "Error parsing template") } var buf bytes.Buffer err...
24
eks-anywhere-build-tooling
aws
Go
package files import ( "io/fs" "io/ioutil" "os" "path/filepath" "github.com/pkg/errors" ) func Write(path string, content []byte, permission fs.FileMode) error { dir := filepath.Dir(path) if err := os.MkdirAll(dir, 0o640); err != nil { return errors.Wrap(err, "Error creating directory") } if err := ioutil...
22
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "fmt" "os/exec" "strings" "time" versionutil "k8s.io/apimachinery/pkg/util/version" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) const ( kubeadmFile = "/tmp/kubeadm.yaml" kubectl = "/opt/bin/kubectl" kubeadmBinary =...
188
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "fmt" "os" "os/exec" "time" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) const kubeconfigPath = "/etc/kubernetes/admin.conf" func controlPlaneJoin() error { err := setHostName(kubeadmJoinFile) if err != nil { return errors....
148
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "fmt" "os" "os/exec" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) type kubeadm struct { userData *utils.UserData } func New(userData *utils.UserData) *kubeadm { return &kubeadm{userData: userData} } func (k *kubeadm) Initiali...
60
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "context" "encoding/base64" "fmt" "io/fs" "io/ioutil" "os" "os/exec" "path/filepath" "strings" "time" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ...
317
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "os" "testing" "github.com/google/go-cmp/cmp" ) const localEtcdClusterConf = `'apiServer: certSANs: - localhost - 127.0.0.1 extraArgs: authorization-mode: Node,RBAC runtime-config: "" timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta2 certificatesDir: /etc/k...
218
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "fmt" "os/exec" "time" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) func waitForKubelet() error { err := utils.WaitForSystemdService(utils.KubeletService, 90*time.Second) if err != nil { return err } return nil } // waitFo...
63
eks-anywhere-build-tooling
aws
Go
package kubeadm import ( "fmt" "os" "os/exec" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" "github.com/pkg/errors" ) const ( kubeadmJoinFile = "/tmp/kubeadm-join-config.yaml" ) func workerJoin() error { err := setHostName(kubeadmJoinFile) if err != nil { return errors.Wrap(...
68
eks-anywhere-build-tooling
aws
Go
package main import ( "flag" "fmt" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/providers/snow/system" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/utils" ) func main() { utils.LogVerbosity = fmt.Sprintf("-v%s", *flag.String("v", "9", "Verbosity of logs")) syst...
15
eks-anywhere-build-tooling
aws
Go
//go:generate ../../../../hack/tools/bin/mockgen -destination ./mocks/apiclient_mock.go -package mocks . APIClient //go:generate ../../../../hack/tools/bin/mockgen -destination ./mocks/filesystem_mock.go -package mocks . FileSystem package system import ( "fmt" "os" "github.com/eks-anywhere-build-tooling/aws/bott...
67
eks-anywhere-build-tooling
aws
Go
package system import ( "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/executables" ) const ( // Temporary hardcoded kernel config values for beta. // In the future the kernel config will be exposed for eks-a users to customize. maxSocketBufferSize = "8388608" kernelCorePattern = "/var/c...
32
eks-anywhere-build-tooling
aws
Go
package system import ( "fmt" "os" "path/filepath" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/pkg/errors" ) func (s *Snow) configureKubernetesSettings() error { if err := s.setCloudProvider(); err != nil { return errors.Wrap(err, "Error setting K8s cloud provider...
78
eks-anywhere-build-tooling
aws
Go
package system import ( "bufio" _ "embed" "fmt" "io/ioutil" "net/http" "os" "path/filepath" "syscall" "github.com/pkg/errors" "github.com/vishvananda/netlink" "gopkg.in/yaml.v2" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/eks-anywhere-build-tooling/aws/bottle...
231
eks-anywhere-build-tooling
aws
Go
package system_test import ( "testing" . "github.com/onsi/gomega" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/providers/snow/system" ) var networkConfigTest = []struct { name string data map[string]interface{} wantConfig string }{ { name: "with static ip", data: map[...
120
eks-anywhere-build-tooling
aws
Go
package system import ( "os" "path/filepath" "github.com/pkg/errors" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" ) const ( bootstrapContainerPath = "/.bottlerocket/bootstrap-containers/current" ) var rebootedPath = filepath.Join(bootstrapContainerPath, "rebooted") func (s *Sn...
35
eks-anywhere-build-tooling
aws
Go
package system import ( "os" "path/filepath" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/pkg/errors" ) var device = filepath.Join(rootfs, "/dev/vda") func (s *Snow) mountContainerdVolume() error { if err := s.createPartition(); err != nil { return errors.Wrap(err,...
50
eks-anywhere-build-tooling
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/providers/snow/system (interfaces: APIClient) // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockAPIClien...
147
eks-anywhere-build-tooling
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/providers/snow/system (interfaces: FileSystem) // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockFileSys...
63
eks-anywhere-build-tooling
aws
Go
package service import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/feature/ec2/imds" "github.com/aws/aws-sdk-go-v2/service/secretsmanager" "github.com/pkg/errors" ) type SecretsManagerService interface { GetSecretValue(ctx context.Context,...
48
eks-anywhere-build-tooling
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./secretsmanager.go package service import ( context "context" reflect "reflect" secretsmanager "github.com/aws/aws-sdk-go-v2/service/secretsmanager" gomock "github.com/golang/mock/gomock" ) // MockSecretsManagerService is a mock of SecretsManagerService int...
66
eks-anywhere-build-tooling
aws
Go
package utils var LogVerbosity string
4
eks-anywhere-build-tooling
aws
Go
package utils import ( "fmt" "io/ioutil" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" kubecmd "k8s.io/client-go/tools/clientcmd" kubecmdapi "k8s.io/client-go/tools/clientcmd/api" "sigs.k8s.io/yaml" ) func getKubeConfigRaw(path string) (kubecmdapi.Config, error) { // Read the kubeconfig and create config u...
58
eks-anywhere-build-tooling
aws
Go
package utils import ( "encoding/base64" "fmt" "io/fs" "io/ioutil" "os/exec" "path/filepath" "strings" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" ) func EnableStaticPods(path string) ([]*v1.Pod, error) { var podDefinitions []*v1.Pod fmt.Println("Enabling static pods on host") files, err := ioutil.R...
65
eks-anywhere-build-tooling
aws
Go
package utils import ( "context" "encoding/base64" "fmt" "io/fs" "io/ioutil" "os" "os/user" "strconv" "strings" "syscall" "github.com/pkg/errors" "gopkg.in/yaml.v2" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/files" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-boots...
170
eks-anywhere-build-tooling
aws
Go
package utils import ( "encoding/base64" "fmt" "testing" "github.com/aws/aws-sdk-go-v2/service/secretsmanager" "github.com/eks-anywhere-build-tooling/aws/bottlerocket-bootstrap/pkg/service" "github.com/golang/mock/gomock" ) // Normal UserData const UserDataString = ` ## template: jinja #cloud-config write_fil...
69
eks-anywhere-build-tooling
aws
Go
package utils import ( "bytes" "compress/gzip" "io/ioutil" "os/exec" "github.com/pkg/errors" ) const ( ApiclientBinary = "apiclient" BootstrapContainerName = "kubeadm-bootstrap" ) func DisableBootstrapContainer() error { cmd := exec.Command(ApiclientBinary, "set", "host-containers."+BootstrapContaine...
54
eks-anywhere-build-tooling
aws
Go
package utils import ( "context" "crypto/tls" "fmt" "io/ioutil" "net/http" "os" "os/exec" "strconv" "strings" "time" systemd "github.com/coreos/go-systemd/v22/dbus" "github.com/godbus/dbus/v5" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" ) const ( KubeletService = "kubelet.service" MultiUserTarge...
214
eks-anywhere-build-tooling
aws
Go
package main import ( "os" "github.com/aws/eks-anywhere-build-tooling/image-builder/cmd" ) func main() { if cmd.Execute() == nil { os.Exit(0) } os.Exit(-1) }
15
eks-anywhere-build-tooling
aws
Go
package builder import ( "encoding/json" "fmt" "io/ioutil" "log" "os" "path/filepath" ) const ( buildToolingRepoUrl = "https://github.com/aws/eks-anywhere-build-tooling.git" ) var codebuild = os.Getenv("CODEBUILD_CI") func (b *BuildOptions) BuildImage() { // Clone build tooling repo cwd, err := os.Getwd() ...
252
eks-anywhere-build-tooling
aws
Go
package builder const ( DefaultUbuntu2004AMIFilterName string = "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*" DefaultUbuntu2204AMIFilterName string = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*" DefaultUbuntuAMIFilterOwners string = "679593333241" DefaultAMIBuildRegion string = "us-west-2...
15
eks-anywhere-build-tooling
aws
Go
package builder const ( Ubuntu string = "ubuntu" RedHat string = "redhat" VSphere string = "vsphere" Baremetal string = "baremetal" Nutanix string = "nutanix" CloudStack string = "cloudstack" AMI string = "ami" ) var SupportedHypervisors = []string{ VSphere, Baremetal, Nutanix, CloudS...
124
eks-anywhere-build-tooling
aws
Go
package builder import ( "fmt" "log" "os" "os/exec" "path/filepath" "strings" releasev1 "github.com/aws/eks-anywhere/release/api/v1alpha1" "sigs.k8s.io/yaml" ) func cloneRepo(cloneUrl, destination string) error { log.Println("Cloning eks-anywhere-build-tooling...") cloneRepoCommandSequence := fmt.Sprintf("...
128
eks-anywhere-build-tooling
aws
Go
package builder import ( "testing" ) func TestGetSupportedReleaseBranchesSuccess(t *testing.T) { b := BuildOptions{ ReleaseChannel: "1-24", } supportedReleaseBranches := GetSupportedReleaseBranches() if !SliceContains(supportedReleaseBranches, b.ReleaseChannel) { t.Fatalf("GetSupportedReleaseBranches error:...
30
eks-anywhere-build-tooling
aws
Go
package cmd import ( "encoding/json" "fmt" "io/ioutil" "log" "path/filepath" "strings" "github.com/spf13/cobra" "github.com/aws/eks-anywhere-build-tooling/image-builder/builder" ) var ( bo = &builder.BuildOptions{} vSphereConfigFile string baremetalConfigFile string nutanixConfigFi...
279
eks-anywhere-build-tooling
aws
Go
package cmd import ( "testing" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-build-tooling/image-builder/builder" ) func TestValidateSupportedHypervisor(t *testing.T) { testCases := []struct { testName string buildOptions builder.BuildOptions wantErr string }{ { testName...
165
eks-anywhere-build-tooling
aws
Go
package cmd import ( "log" "github.com/spf13/cobra" "github.com/spf13/viper" ) var rootCmd = &cobra.Command{ Use: "image-builder", Short: "Amazon EKS Anywhere Image Builder", Long: `Use image-builder to build your own EKS Anywhere node image`, } func init() { rootCmd.PersistentFlags().IntP("verbosity", "v...
26
eks-anywhere-build-tooling
aws
Go
package cmd import ( "fmt" "github.com/spf13/cobra" ) var version string var versionCmd = &cobra.Command{ Use: "version", Short: "Get the image-builder cli version", Long: "This command prints the version of image-builder cli", RunE: func(cmd *cobra.Command, args []string) error { return printVersion() ...
28
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required...
31
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
35
eks-anywhere-packages
aws
Go
package v1alpha1 import ( "os" "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" ) const ( PackageKind = "Package" PackageNamespace = "eksa-packages" namespacePrefix = PackageNamespace + "-" clusterNameEnvVar = "CLUSTER_NAME" ) func (config *Package) MetaKind() string { re...
78
eks-anywhere-packages
aws
Go
package v1alpha1 import ( "bytes" "compress/gzip" "encoding/base64" "fmt" "io" "path" "strconv" "strings" "k8s.io/apimachinery/pkg/version" ) const ( PackageBundleKind = "PackageBundle" Latest = "latest" ) func (config *PackageBundle) MetaKind() string { return config.TypeMeta.Kind } func (c...
226
eks-anywhere-packages
aws
Go
package v1alpha1 import "path" const PackageBundleControllerKind = "PackageBundleController" func (config *PackageBundleController) MetaKind() string { return config.TypeMeta.Kind } func (config *PackageBundleController) ExpectedKind() string { return PackageBundleControllerKind } func (config *PackageBundleCont...
40
eks-anywhere-packages
aws
Go
package v1alpha1_test import ( "testing" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) const TestBundleName = "v1-21-1003" func TestPackageBundleController_IsValid(t *testing.T) { givenBundleController := func(name ...
56
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
129
eks-anywhere-packages
aws
Go
package v1alpha1 import ( "sort" "testing" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/version" ) func TestPackageBundle_Find(t *testing.T) { var err error givenBundle := func(versions []SourceVersion) PackageBundle { return PackageBundle{ S...
514
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
135
eks-anywhere-packages
aws
Go
package v1alpha1_test import ( "testing" "github.com/stretchr/testify/assert" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) func givenPackage(config string) api.Package { return api.Package{ Spec: api.PackageSpec{Config: config}, } } func TestPackage_GetValues(t *testing.T) { provided := ` make...
87
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
133
eks-anywhere-packages
aws
Go
//go:build !ignore_autogenerated // +build !ignore_autogenerated // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // /...
444
eks-anywhere-packages
aws
Go
package cmd import ( "context" "log" "github.com/go-logr/logr" "github.com/go-logr/zapr" "github.com/spf13/cobra" "github.com/spf13/viper" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) var packageLog logr.Logger var rootCmd = &cobra.Command{ Use: "package-manager", Short: "Amazon E...
49
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
140
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
158
eks-anywhere-packages
aws
Go
package controllers import ( "context" "fmt" "testing" "github.com/go-logr/logr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" c...
218
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
151
eks-anywhere-packages
aws
Go
package controllers import ( "context" "fmt" "testing" "github.com/go-logr/logr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" c...
146
eks-anywhere-packages
aws
Go
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless req...
221
eks-anywhere-packages
aws
Go
package controllers import ( "context" "errors" "fmt" "testing" "time" "github.com/go-logr/logr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-...
400
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: sigs.k8s.io/controller-runtime/pkg/client (interfaces: Client,StatusWriter) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" meta "k8s.io/apimachinery/pkg/api/met...
309
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: sigs.k8s.io/controller-runtime/pkg/manager (interfaces: Manager) // Package mocks is a generated GoMock package. package mocks import ( context "context" http "net/http" reflect "reflect" logr "github.com/go-logr/logr" gomock "github.com/golang/mock/gomock" ...
300
eks-anywhere-packages
aws
Go
package main import ( _ "embed" "os" "strings" "github.com/fsnotify/fsnotify" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/awscred" cfg "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/configurator" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/c...
137
eks-anywhere-packages
aws
Go
package test import ( "bytes" "flag" "fmt" "io/ioutil" "log" "os" "os/exec" "regexp" "testing" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/filewriter" ) var UpdateGoldenFiles = flag.Bool("update", false, "update golden files") func AssertFilesEquals(t *testing.T, gotPath, wantPath ...
138
eks-anywhere-packages
aws
Go
package awscred import ( "errors" "fmt" "io/ioutil" "os" "strings" ) const ( configSecretPath = "/secrets/aws-creds/config" accessKeySecretPath = "/secrets/aws-creds/AWS_ACCESS_KEY_ID" secretAccessKeySecretPath = "/secrets/aws-creds/AWS_SECRET_ACCESS_KEY" regionSecretPath = "/secrets/...
58
eks-anywhere-packages
aws
Go
package awscred import ( "fmt" "io/ioutil" "testing" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/internal/test" ) func Test_generateAwsConfigSecret(t *testing.T) { testDir, _ := test.NewWriter(t) dir := testDir + "/" err := createTestFiles(dir) wantString := fmt.Sprintf( ` [default] aws...
117
eks-anywhere-packages
aws
Go
package configurator import "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/constants" type Configurator interface { // Initialize Handles node specific configuration depending on OS Initialize(config constants.CredentialProviderConfigOptions) // UpdateAWSCredentials Handles AWS Credential Set...
18
eks-anywhere-packages
aws
Go
package bottlerocket import ( "bytes" "context" "encoding/base64" "encoding/json" "fmt" "io/fs" "io/ioutil" "net" "net/http" "os" "strings" "golang.org/x/mod/semver" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/configurator" "github.com/aws/eks-anywhere-packages/credentialprovide...
252
eks-anywhere-packages
aws
Go
package bottlerocket import ( "bytes" "encoding/base64" "encoding/json" "fmt" "io" "io/ioutil" "net/http" "net/http/httptest" "os" "testing" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/constants" ) type response struct { statusCode int exp...
525
eks-anywhere-packages
aws
Go
package linux import ( _ "embed" "fmt" "io" "io/ioutil" "os" "strings" "syscall" ps "github.com/mitchellh/go-ps" "golang.org/x/mod/semver" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/configurator" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/constants" "gith...
243
eks-anywhere-packages
aws
Go
package linux import ( "fmt" "io/ioutil" "os" "testing" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/internal/test" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/constants" ) func Test_linuxOS_updateKubeletArguments(t *testing.T) {...
268
eks-anywhere-packages
aws
Go
package constants const ( // Credential Provider constants DefaultImagePattern = "*.dkr.ecr.*.amazonaws.com" DefaultCacheDuration = "30m" ) type CredentialProviderConfigOptions struct { ImagePatterns []string DefaultCacheDuration string }
13
eks-anywhere-packages
aws
Go
package filewriter import ( "io" "os" ) type FileWriter interface { Write(fileName string, content []byte, f ...FileOptionsFunc) (path string, err error) WithDir(dir string) (FileWriter, error) CleanUp() CleanUpTemp() Dir() string TempDir() string Create(name string, f ...FileOptionsFunc) (_ io.WriteCloser, ...
24
eks-anywhere-packages
aws
Go
package filewriter import ( "os" ) const DefaultTmpFolder = "generated" func defaultFileOptions() *FileOptions { return &FileOptions{true, os.ModePerm} } func Permission0600(op *FileOptions) { op.Permissions = 0o600 } func PersistentFile(op *FileOptions) { op.IsTemp = false }
20
eks-anywhere-packages
aws
Go
package filewriter_test import ( "io/ioutil" "os" "path" "path/filepath" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/filewriter" ) func TestTmpWriterWriteValid(t *testing.T) { folder := "tmp_folder" folder2 := "tmp_folder_2" err :...
160