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-packages
aws
Go
package filewriter import ( "errors" "fmt" "io" "io/fs" "io/ioutil" "os" "path/filepath" ) type writer struct { dir string tempDir string } func NewWriter(dir string) (FileWriter, error) { newFolder := filepath.Join(dir, DefaultTmpFolder) if _, err := os.Stat(newFolder); errors.Is(err, os.ErrNotExist)...
100
eks-anywhere-packages
aws
Go
package filewriter_test import ( "fmt" "os" "path/filepath" "strings" "testing" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/internal/test" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/filewriter" ) func TestWriterWriteValid(t *testing.T) { folder := "tmp_folder" fo...
204
eks-anywhere-packages
aws
Go
package log import ( "log" "os" ) var ( InfoLogger *log.Logger WarningLogger *log.Logger ErrorLogger *log.Logger ) func init() { InfoLogger = log.New(os.Stdout, "INFO: ", log.Lshortfile) WarningLogger = log.New(os.Stderr, "WARNING: ", log.Lshortfile) ErrorLogger = log.New(os.Stderr, "ERROR: ", log.Lshor...
19
eks-anywhere-packages
aws
Go
package templater import ( "reflect" "sigs.k8s.io/yaml" ) type PartialYaml map[string]interface{} func (p PartialYaml) AddIfNotZero(k string, v interface{}) { if !isZeroVal(v) { p[k] = v } } func isZeroVal(x interface{}) bool { return x == nil || reflect.DeepEqual(x, reflect.Zero(reflect.TypeOf(x)).Interfac...
30
eks-anywhere-packages
aws
Go
package templater_test import ( "reflect" "testing" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/internal/test" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/templater" ) func TestPartialYamlAddIfNotZero(t *testing.T) { tests := []struct { testName string p ...
132
eks-anywhere-packages
aws
Go
package templater import ( "bytes" "fmt" "strings" "text/template" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/filewriter" ) type Templater struct { writer filewriter.FileWriter } func New(writer filewriter.FileWriter) *Templater { return &Templater{ writer: writer, } } func (t *T...
67
eks-anywhere-packages
aws
Go
package templater_test import ( "os" "strings" "testing" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/internal/test" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/filewriter" "github.com/aws/eks-anywhere-packages/credentialproviderpackage/pkg/templater" ) func TestTempl...
144
eks-anywhere-packages
aws
Go
package templater import ( "fmt" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/yaml" ) const objectSeparator string = "\n---\n" func AppendYamlResources(resources ...[]byte) []byte { separator := []byte(objectSeparator) size := 0 for _, resource := range resources { size += len(resource) + len(separator) ...
40
eks-anywhere-packages
aws
Go
package main import ( "fmt" "os" "time" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/constants" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/secrets" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/secrets/aws" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pk...
66
eks-anywhere-packages
aws
Go
package constants const ( ConfigMapName = "ns-secret-map" EksaSystemNamespace = "eksa-system" PackagesNamespace = "eksa-packages" NamespacePrefix = PackagesNamespace + "-" DefaultClusterNameKey = "CLUSTER_NAME" )
10
eks-anywhere-packages
aws
Go
package k8s import ( "context" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/constants" ) func GetSecret(clientSet kubernetes.Interface, name, namespace string) (*corev1.Secret, error) { secre...
58
eks-anywhere-packages
aws
Go
package secrets import "k8s.io/client-go/kubernetes" type Credential struct { Registry string Username string Password string CA string Insecure string } type ( ClusterClientSet map[string]kubernetes.Interface ClusterCredential map[string][]*Credential ) type Secret interface { Init(mgmtClusterName s...
25
eks-anywhere-packages
aws
Go
package aws import ( "encoding/base64" "encoding/json" "fmt" "os" "path/filepath" "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecr" "github.com/aws/aws-sdk-go/service/sts" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/se...
212
eks-anywhere-packages
aws
Go
package common import ( "encoding/base64" "fmt" "os" "path/filepath" "strings" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/constants" k8s "github.com/aws/eks-anywhere-packag...
162
eks-anywhere-packages
aws
Go
package common import ( "encoding/base64" "encoding/json" "testing" "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/constants" k8s "github.com/aws/eks-any...
120
eks-anywhere-packages
aws
Go
package registrymirror import ( "encoding/json" corev1 "k8s.io/api/core/v1" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/constants" k8s "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/kubernetes" "github.com/aws/eks-anywhere-packages/ecrtokenrefresher/pkg/secrets" "github.com/aws/eks...
124
eks-anywhere-packages
aws
Go
package utils import ( "log" "os" ) var ( InfoLogger *log.Logger WarningLogger *log.Logger ErrorLogger *log.Logger ) func init() { InfoLogger = log.New(os.Stdout, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile) WarningLogger = log.New(os.Stderr, "WARNING: ", log.Ldate|log.Ltime|log.Lshortfile) ErrorLogger...
19
eks-anywhere-packages
aws
Go
package main import ( "context" "encoding/base64" "encoding/json" "fmt" "os" "path" "strings" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/kms" "github.com/aws/aws-sdk-go-v2/service/kms/types" "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" api "github.com...
201
eks-anywhere-packages
aws
Go
package main import ( "context" "reflect" "testing" "time" "github.com/aws/aws-sdk-go-v2/service/ecrpublic" ecrpublictypes "github.com/aws/aws-sdk-go-v2/service/ecrpublic/types" "github.com/aws/aws-sdk-go-v2/service/sts" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" api "github.com/aws/eks-anywhere-packages...
378
eks-anywhere-packages
aws
Go
package main import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) // BundleGenerate same as Bundle except stripped down for generation of yaml file during generate bundleconfig // +kubebuilder:object:generate=false type BundleGenerate struct { // TypeMet...
140
eks-anywhere-packages
aws
Go
package main import ( "context" "encoding/json" "fmt" "os" "regexp" "strings" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecr" ecrtypes "github.com/aws/aws-sdk-go-v2/service/ecr/types" "github.com/pkg/errors" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) const ( ...
329
eks-anywhere-packages
aws
Go
package main import ( "fmt" "os/exec" "reflect" "strings" "time" ecrtypes "github.com/aws/aws-sdk-go-v2/service/ecr/types" ecrpublictypes "github.com/aws/aws-sdk-go-v2/service/ecrpublic/types" "github.com/go-logr/logr" "github.com/jinzhu/copier" "github.com/pkg/errors" api "github.com/aws/eks-anywhere-pac...
214
eks-anywhere-packages
aws
Go
package main import ( "context" "fmt" "regexp" "strings" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ecrpublic" ecrpublictypes "github.com/aws/aws-sdk-go-v2/service/ecrpublic/types" "github.com/pkg/errors" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) type ecrPublic...
254
eks-anywhere-packages
aws
Go
package main import ( "archive/tar" "compress/gzip" "context" "io" "os" "testing" "github.com/aws/aws-sdk-go-v2/service/ecr" ecrtypes "github.com/aws/aws-sdk-go-v2/service/ecr/types" "github.com/aws/aws-sdk-go-v2/service/ecrpublic" ecrpublictypes "github.com/aws/aws-sdk-go-v2/service/ecrpublic/types" ) fun...
379
eks-anywhere-packages
aws
Go
package main import ( "errors" "fmt" "io/ioutil" "os" "path/filepath" ) const ( DefaultTmpFolder = "generated" objectSeparator string = "---\n" ) func defaultFileOptions() *FileOptions { return &FileOptions{os.ModePerm} } func PersistentFile(op *FileOptions) { op.Permissions = os.ModePerm } type w...
96
eks-anywhere-packages
aws
Go
package main import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" "github.com/go-logr/logr" "github.com/pkg/errors" "helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/registry" "sigs.k8s.io/yaml" ) // helmDriver implements PackageDriver to ins...
169
eks-anywhere-packages
aws
Go
package main import ( "bytes" "fmt" "io/ioutil" "os" "path/filepath" "strings" "sigs.k8s.io/yaml" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) const ( YamlSeparator = "\n---\n" ) func ValidateInputConfig(fileName string) (*Input, error) { inputconfig := &Input{} err := ParseInputConfig(file...
170
eks-anywhere-packages
aws
Go
package main import ( "context" "fmt" "io" "os" "path/filepath" "strings" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/cloudwatch" cloudwatchtypes "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" "github.com/aws/aws-sdk-go-v2/service/ecr" "github.com/aws/aws-sdk-go-v2/...
571
eks-anywhere-packages
aws
Go
package main import ( "flag" "fmt" "os" "path/filepath" "strings" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log/zap" ) // Options represents the flag for the current plugin type Options struct { inputFile string outputFolder string generateSample bool promote ...
95
eks-anywhere-packages
aws
Go
package main import ( "context" "fmt" "os" "path/filepath" "strings" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/ecr" "github.com/aws/aws-sdk-go-v2/service/ecrpublic" "github.com/aws/aws-sdk-go-v2/service/sts" ) type SDKClients struct { ecrClient *ecrClient ecr...
289
eks-anywhere-packages
aws
Go
package main import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/service/cloudwatch" cloudwatchtypes "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" ) var RegionList = []string{ "us-east-2", "us-east-1", "us-west-1", "us-west-2", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southe...
75
eks-anywhere-packages
aws
Go
package main import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/service/sts" ) type stsClient struct { stsClientInterface AccountID string } type stsClientInterface interface { GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityO...
34
eks-anywhere-packages
aws
Go
package artifacts import "context" //go:generate mockgen -source puller.go -destination=mocks/puller.go -package=mocks Client // Puller is an interface to abstract interaction with OCI registries or other // storage services. type Puller interface { // Pull the artifact at the given reference. Pull(ctx context.Con...
13
eks-anywhere-packages
aws
Go
package artifacts import ( "context" "github.com/go-logr/logr" "oras.land/oras-go/v2/registry/remote" "github.com/aws/eks-anywhere-packages/pkg/registry" ) // RegistryPuller handles pulling OCI artifacts from an OCI registry type RegistryPuller struct { log logr.Logger } var _ Puller = (*RegistryPuller)(nil) ...
54
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: puller.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockPuller is a mock of Puller interface. type MockPuller struct { ctrl *gomock.Controller r...
51
eks-anywhere-packages
aws
Go
package authenticator import "context" // DockerAuth Structure for the authentication file type DockerAuth struct { Auths map[string]DockerAuthRegistry `json:"auths,omitempty"` } type DockerAuthRegistry struct { Auth string `json:"auth"` } //go:generate mockgen -source authenticator.go -destination=mocks/authenti...
39
eks-anywhere-packages
aws
Go
package authenticator import ( "context" "os" "strconv" "time" batchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anyw...
167
eks-anywhere-packages
aws
Go
package authenticator import ( "context" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" batchv1 "k8s.io/api/batch/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/rest" api "github...
384
eks-anywhere-packages
aws
Go
package authenticator import ( "context" "fmt" "os" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/version" "k8s.io...
267
eks-anywhere-packages
aws
Go
package authenticator import ( "context" "fmt" "testing" "github.com/go-logr/logr/testr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/aws/eks-anywhere-packages/control...
101
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: authenticator.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockAuthenticator is a mock of Authenticator interface. type MockAuthenticator struct { ct...
121
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: target_cluster_client.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" v1 "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/api/meta" version "k8s.io/apimac...
172
eks-anywhere-packages
aws
Go
package bundle import ( "context" "fmt" "os" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" auth "github....
239
eks-anywhere-packages
aws
Go
package bundle import ( "context" "fmt" "testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k...
419
eks-anywhere-packages
aws
Go
package bundle import ( "context" "fmt" "os" "time" "github.com/go-logr/logr" "golang.org/x/mod/semver" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anywhere-packages/pkg/authenticator" "github.com/aws/eks-anywhere-packages/pkg/config" ) //go:generate mockgen -source manager....
265
eks-anywhere-packages
aws
Go
package bundle import ( "context" "fmt" "os" "testing" "github.com/go-logr/logr/testr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/rest" api "github.com/a...
694
eks-anywhere-packages
aws
Go
package bundle import ( "bytes" "context" "fmt" "sigs.k8s.io/yaml" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anywhere-packages/pkg/artifacts" ) //go:generate mockgen -source registry_client.go -destination=mocks/registry_client.go -package=mocks RegistryClient type RegistryC...
66
eks-anywhere-packages
aws
Go
package bundle import ( "context" "fmt" "os" "testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/pkg/artifacts/mocks" ) func TestDownloadBundle(t *testing.T) { t.Parallel() baseRef := "example.com/org" t.Run("golden path", func(t *testing....
112
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: client.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" v1alpha1 "github.com/aws/eks-anywhere-packages/api/v1alpha1" gomock "github.com/golang/mock/gomock" v1 "k8s.io/api/core/v1" client "sigs.k8s...
199
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: manager.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" v1alpha1 "github.com/aws/eks-anywhere-packages/api/v1alpha1" gomock "github.com/golang/mock/gomock" ) // MockManager is a mock of Manager in...
66
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: registry_client.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" v1alpha1 "github.com/aws/eks-anywhere-packages/api/v1alpha1" gomock "github.com/golang/mock/gomock" ) // MockRegistryClient is a moc...
67
eks-anywhere-packages
aws
Go
package config import ( "strconv" "time" ) const ( DEVELOPMENT = "development" HEAD = "HEAD" EPOCH = "0" ) var config Config var version = DEVELOPMENT var gitHash = HEAD var buildTime = EPOCH type Config struct { BuildInfo BuildInfo Env BuildInfo } type BuildInfo struct { Version stri...
53
eks-anywhere-packages
aws
Go
package csset import ( "strings" "sync" ) // CSSet is a comma-separated set of strings. type CSSet struct { mu sync.Mutex set map[string]struct{} } func NewCSSet(s string) *CSSet { c := &CSSet{ set: make(map[string]struct{}), } if s == "" { return c } for _, value := range strings.Split(s, ",") { c....
62
eks-anywhere-packages
aws
Go
package csset import ( "strings" "testing" "github.com/stretchr/testify/assert" ) func TestCSSetEmptyInit(t *testing.T) { set := NewCSSet("") assert.Equal(t, "", set.String()) } func TestCSSetContentsInit(t *testing.T) { set := NewCSSet("one,three,two") n := struct{}{} assert.ObjectsAreEqual(map[string]stru...
65
eks-anywhere-packages
aws
Go
package driver import ( "context" "errors" "fmt" "os" "reflect" "strings" "github.com/go-logr/logr" "helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/registry" "helm.sh/helm/v3/pkg/storage/driver" api "github.com/a...
291
eks-anywhere-packages
aws
Go
package driver import ( "context" "fmt" "testing" "github.com/go-logr/logr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "helm.sh/helm/v3/pkg/kube" "helm.sh/helm/v3/pkg/release" "github.com/aws/eks-anywhere-packages/pkg/authenticator/mocks" ) v...
231
eks-anywhere-packages
aws
Go
package driver import ( "context" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" ) //go:generate mockgen -source packagedriver.go -destination=mocks/packagedriver.go -package=mocks PackageDriver // PackageDriver is an interface for converting a CRD to a series of Kubernetes // objects. // // Its first im...
31
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: packagedriver.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" v1alpha1 "github.com/aws/eks-anywhere-packages/api/v1alpha1" gomock "github.com/golang/mock/gomock" ) // MockPackageDriver is a mock o...
94
eks-anywhere-packages
aws
Go
package file import ( "bytes" "fmt" "os" "sigs.k8s.io/yaml" ) const ( yamlSeparator = "\n---\n" ) // KindAccessor exposes the Kind field for Cluster type. // // The FileReader will compare the Kind field (accessed via MetaKind()) with the // result of ExpectedKind() to ensure that the data we unmarshaled was m...
75
eks-anywhere-packages
aws
Go
package file import ( "testing" "github.com/stretchr/testify/assert" ) type testObject struct { Kind string `json:"kind"` Foo int `json:"foo"` } func (o *testObject) ExpectedKind() string { return "testObject" } func (o *testObject) MetaKind() string { return o.Kind } func TestFileReaderInitializeEnoent...
67
eks-anywhere-packages
aws
Go
package packages import ( "context" "fmt" "os" "strings" "sync" "time" "github.com/go-logr/logr" "sigs.k8s.io/yaml" api "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anywhere-packages/pkg/bundle" "github.com/aws/eks-anywhere-packages/pkg/driver" "github.com/aws/eks-anywhere-pack...
322
eks-anywhere-packages
aws
Go
package packages 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" "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/aws/eks-anywhere-packages/api/v1alpha...
492
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: manager.go // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" packages "github.com/aws/eks-anywhere-packages/pkg/packages" gomock "github.com/golang/mock/gomock" ) // MockManager is a mock of Manager interface. type MockM...
50
eks-anywhere-packages
aws
Go
package registry import ( "fmt" "strings" ) // Artifact to head release dependency. type Artifact struct { Registry string Repository string Tag string Digest string } // NewArtifact creates a new artifact object. func NewArtifact(registry, repository, tag, digest string) Artifact { return Artifa...
69
eks-anywhere-packages
aws
Go
package registry_test import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/aws/eks-anywhere-packages/pkg/registry" ) func TestArtifact_VersionTag(t *testing.T) { artifact := registry.NewArtifact("localhost:8443", "owner/repo", "latest", "") assert.Equal(t, ...
33
eks-anywhere-packages
aws
Go
package registry import ( "crypto/x509" "fmt" "os" "path" "path/filepath" ) const ( registryConfigPath = "/tmp/config/registry" certFile = "ca.crt" insecureFile = "insecure" ) func GetRegistryInsecure(clusterName string) bool { caFile := path.Join(registryConfigPath, clusterName+"_"+insecure...
55
eks-anywhere-packages
aws
Go
package registry_test import ( "testing" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/pkg/registry" ) func TestGetCertificatesSuccess(t *testing.T) { result, err := registry.GetCertificates("testdata/harbor.eksa.demo.crt") assert.NotNil(t, result) assert.NoError(t, err) } func T...
28
eks-anywhere-packages
aws
Go
package registry import ( "context" "crypto/tls" "fmt" "net/http" "path" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "oras.land/oras-go/v2" "oras.land/oras-go/v2/content" orasregistry "oras.land/oras-go/v2/registry" "oras.land/oras-go/v2/registry/remote" "oras.land/oras-go/v2/registry/remote...
102
eks-anywhere-packages
aws
Go
package registry_test import ( "context" "crypto/x509" "testing" "github.com/docker/cli/cli/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "oras.land/oras-go/v2/registry/remote" "github.com/aws/eks-anywhere-packages/pkg/registry" ) var ( ctx = context.Background() ima...
65
eks-anywhere-packages
aws
Go
package registry import ( "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/credentials" "oras.land/oras-go/v2/registry/remote/auth" ) // DockerCredentialStore for Docker registry credentials, like ~/.docker/config.json. type DockerCredentialStore s...
44
eks-anywhere-packages
aws
Go
package registry_test import ( "testing" "github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config/configfile" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "oras.land/oras-go/v2/registry/remote/auth" "github.com/aws/eks-anywhere-packages/pkg/registry" ) func TestDocke...
57
eks-anywhere-packages
aws
Go
package registry import ( "context" "encoding/json" "fmt" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) // PullBytes a resource from the registry. func PullBytes(ctx context.Context, sc StorageClient, artifact Artifact) (data []byte, err error) { srcStorage, err := sc.GetStorage(ctx, artifact) i...
37
eks-anywhere-packages
aws
Go
package registry_test import ( _ "embed" "fmt" "testing" "github.com/golang/mock/gomock" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/pkg/registry" "github.com/aws/eks-anywhere-packages/pkg/registry/mocks" ) //go:embed ...
122
eks-anywhere-packages
aws
Go
package registry import ( "context" "crypto/x509" ocispec "github.com/opencontainers/image-spec/specs-go/v1" orasregistry "oras.land/oras-go/v2/registry" ) // StorageContext describes aspects of a registry. type StorageContext struct { host string project string credentialStore *DockerCrede...
40
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: oras.land/oras-go/v2/registry (interfaces: Repository) // Package mocks is a generated GoMock package. package mocks import ( context "context" io "io" reflect "reflect" gomock "github.com/golang/mock/gomock" v1 "github.com/opencontainers/image-spec/specs-go...
212
eks-anywhere-packages
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: storage.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" registry "github.com/aws/eks-anywhere-packages/pkg/registry" gomock "github.com/golang/mock/gomock" v1 "github.com/opencontainers/image-spec...
140
eks-anywhere-packages
aws
Go
package signature type Domain struct { Name string Pubkey string }
7
eks-anywhere-packages
aws
Go
package signature import ( "bytes" "crypto/ecdsa" "crypto/sha256" "crypto/x509" "encoding/base64" "encoding/json" "errors" "path" "strings" "text/template" "github.com/itchyny/gojq" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" ) const ( PublicKey = "MFkwEwYHKoZIzj0CAQYIKoZ...
172
eks-anywhere-packages
aws
Go
package signature_test import ( "crypto/sha256" "encoding/base64" "os" "path/filepath" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere-packages/pkg/signature" "github.com/aws/eks-anywhere-packages/pkg/testutil" ) const ( TestPublicKey = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQ...
233
eks-anywhere-packages
aws
Go
package testutil import ( "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anywhere-packages/pkg/file" ) func givenFile(filename string, config file.KindAccessor) error { reader := file.NewFileReader(filename) err := reader.Initialize(config) if err != nil { return err } return reader....
42
eks-anywhere-packages
aws
Go
package testutil import ( "os" "path/filepath" v1 "k8s.io/api/core/v1" "sigs.k8s.io/yaml" ) func GivenPod(filename string) (*v1.Pod, string, error) { content, err := os.ReadFile(filepath.Clean(filename) + ".signed") if err != nil { return nil, "", err } pod := &v1.Pod{} err = yaml.UnmarshalStrict(content,...
27
eks-anywhere-packages
aws
Go
package utils func Map[T, O any](in []T, mapper func(T) O) []O { out := make([]O, len(in)) for i, v := range in { out[i] = mapper(v) } return out }
10
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...
155
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...
196
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...
119
eks-anywhere-packages
aws
Go
package webhook import ( "testing" "github.com/go-logr/logr" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/aws/eks-anywhere-packages/api/v1alpha1" "github.com/aws/eks-anywhere-packages/contr...
70
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...
167
eks-anywhere-packages
aws
Go
package webhook import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/aws/eks-anywhere-packages/pkg/testutil" ) func TestPackageValidate(t *testing.T) { t.Run("valid package", func(t *testing.T) { activeBundle, err := testutil.GivenPackageBundle("../../api...
98
eks-anywhere-prow-jobs
aws
Go
package main import ( _ "embed" "fmt" "io/ioutil" "os" "os/exec" "path/filepath" "strings" "github.com/aws/eks-anywhere-prow-jobs/templater/jobs" "github.com/aws/eks-distro-prow-jobs/templater/jobs/types" "github.com/aws/eks-distro-prow-jobs/templater/jobs/utils" ) var ( jobsFolder = "jobs" orgsSuppor...
181
eks-anywhere-prow-jobs
aws
Go
package jobs import ( "fmt" "github.com/aws/eks-distro-prow-jobs/templater/jobs/types" "github.com/aws/eks-distro-prow-jobs/templater/jobs/utils" ) func GetJobList(jobType string) (map[string]map[string]types.JobConfig, error) { switch jobType { case "periodic": repos := []string{"eks-anywhere", "eks-anywhere...
37
eks-distro
aws
Go
package main import ( "flag" "fmt" "io" "log" "os" "os/exec" "path/filepath" "regexp" "strings" ) var ( outputStream io.Writer = os.Stdout errStream io.Writer = os.Stderr ) type Command struct { releaseBranch string releaseVariant string gitRoot string release string artifactBucket ...
164
eks-distro
aws
Go
package main import ( "fmt" "log" "github.com/aws/eks-distro/cmd/release/utils/projects" "github.com/aws/eks-distro/cmd/release/utils/values" ) // Prints GitTag and Golang versions for each project and release branch. // Uses local values, which may differ from what's in the upstream EKS-D repo // or the version...
38
eks-distro
aws
Go
package main import ( "flag" "log" "strconv" "github.com/aws/eks-distro/cmd/release/docs/existingdocs" "github.com/aws/eks-distro/cmd/release/docs/newdocs" "github.com/aws/eks-distro/cmd/release/utils/changetype" "github.com/aws/eks-distro/cmd/release/utils/git" "github.com/aws/eks-distro/cmd/release/utils/re...
186
eks-distro
aws
Go
package existingdocs import ( "bytes" "fmt" "os" "time" "github.com/aws/eks-distro/cmd/release/utils/release" "github.com/aws/eks-distro/cmd/release/utils/values" ) var linebreak = []byte("\n") // UpdateDocsIndex updates the doc's directory index.md file for the current release. func UpdateDocsIndex(r *releas...
69
eks-distro
aws
Go
package existingdocs import ( "bytes" "fmt" "os" "github.com/aws/eks-distro/cmd/release/utils/release" ) // UpdateREADME updates the README to replace release manifest from previous patch release with the new one. func UpdateREADME(release *release.Release, readmePath string) error { data, err := os.ReadFile(re...
37
eks-distro
aws
Go
package newdocs import ( "fmt" "io" "log" "os" "github.com/aws/eks-distro/cmd/release/utils/values" ) // GenerateNewDocs writes to each doc in provided docs. func GenerateNewDocs(newDocsInput []NewDocInput, docsDir values.NewDirectory) error { for _, doc := range newDocsInput { fullFilePath := fmt.Sprint(doc...
57
eks-distro
aws
Go
package newdocs import ( "bytes" "fmt" "strconv" "github.com/aws/eks-distro/cmd/release/utils/values" ) type NewDocInput struct { FileName string TemplateWriter bytes.Buffer AppendToEnd func() (string, error) } type releaseInfo interface { Tag() string ManifestURL() string KubernetesMinorVersion(...
80
eks-distro
aws
Go
package newdocs import ( "bytes" "path/filepath" "text/template" "github.com/aws/eks-distro/cmd/release/utils/values" ) // RELEASE ANNOUNCEMENT var releaseAnnouncementTemplateInput = templateInput{ templateName: "releaseAnnouncementTemplate", funcMap: template.FuncMap{}, docTemplate: `Amazon EKS Distro {...
66
eks-distro
aws
Go
package main import ( "flag" "fmt" "io" "log" "os" "os/exec" "path/filepath" "strconv" "github.com/aws/eks-distro/cmd/release/utils/changetype" "github.com/aws/eks-distro/cmd/release/utils/release" "github.com/aws/eks-distro/cmd/release/utils/values" ) var ( outputStream io.Writer = os.Stdout errStream ...
72
eks-distro
aws
Go
package main import ( "fmt" "log" "os" "path/filepath" "github.com/aws/eks-distro/cmd/release/minor/projects" "github.com/aws/eks-distro/cmd/release/utils/changetype" "github.com/aws/eks-distro/cmd/release/utils/values" ) func main() { latestSupportedReleaseBranch, err := values.GetLatestSupportedReleaseBran...
61