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 config_test
import (
"testing"
"github.com/aws/eks-anywhere/pkg/config"
)
func TestNewVsphereUserConfig(t *testing.T) {
wantUsername := "FOO"
wantPassword := "BAR"
wantEnv := map[string]string{
config.EksavSphereUsernameKey: wantUsername,
config.EksavSpherePasswordKey: wantPassword,
config.E... | 37 |
eks-anywhere | aws | Go | package constants
// Namespace constants.
const (
EksaSystemNamespace = "eksa-system"
EksaDiagnosticsNamespace = "eksa-diagnostics"
EksaControllerManagerDeployment = "eksa-controller-manager"
CapdSystemNamespace = "capd-system"
CapcSystemNamespace ... | 89 |
eks-anywhere | aws | Go | package controller
import (
"context"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
anywherev1 "github.com/aws/... | 105 |
eks-anywhere | aws | Go | package controller_test
import (
"context"
"testing"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1bet... | 223 |
eks-anywhere | aws | Go | package controller
import (
"time"
ctrl "sigs.k8s.io/controller-runtime"
)
// Result represents the result of a reconciliation
// It allows to express intent for a reconciliation interruption
// without necessarily requeueing the request.
type Result struct {
Result *ctrl.Result
}
// ToCtrlResult converts Result... | 42 |
eks-anywhere | aws | Go | package controller_test
import (
"testing"
"time"
. "github.com/onsi/gomega"
ctrl "sigs.k8s.io/controller-runtime"
"github.com/aws/eks-anywhere/pkg/controller"
)
func TestResultToCtrlResult(t *testing.T) {
tests := []struct {
name string
in controller.Result
want ctrl.Result
}{
{
name: "no resul... | 86 |
eks-anywhere | aws | Go | package controller
import (
"context"
"github.com/go-logr/logr"
)
// Phase represents a generic reconciliation phase for a cluster spec.
type Phase[O any] func(ctx context.Context, log logr.Logger, obj O) (Result, error)
// PhaseRunner allows to execute Phases in order.
type PhaseRunner[O any] struct {
phases []... | 41 |
eks-anywhere | aws | Go | package controller_test
import (
"context"
"errors"
"testing"
"time"
"github.com/go-logr/logr"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/internal/test"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/controller"
)
func TestPhaseRunnerRunError(t *testing.T) {
g := N... | 92 |
eks-anywhere | aws | Go | package clientutil
import "sigs.k8s.io/controller-runtime/pkg/client"
// AddAnnotation adds an annotation to the given object.
// If the annotation already exists, it overwrites its value.
func AddAnnotation(o client.Object, key, value string) {
a := o.GetAnnotations()
if a == nil {
a = make(map[string]string, 1)... | 26 |
eks-anywhere | aws | Go | package clientutil_test
import (
"testing"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
)
func TestAddAnnotation(t *testing.T) {
tests := []struct {
na... | 129 |
eks-anywhere | aws | Go | package clientutil
import (
"context"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
)
func DeleteYaml(ctx context.Context, c client.Client, yaml []byte) error {
objs, err := YamlToClientObjects(yaml)
if err != nil {
return err
}
return deleteObjects(ctx, c, objs)
}
func deleteObjects... | 36 |
eks-anywhere | aws | Go | package clientutil_test
import (
"context"
"testing"
. "github.com/onsi/gomega"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterapiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client... | 131 |
eks-anywhere | aws | Go | package clientutil
import (
"context"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
)
// Kubeclient implements kubernetes.Client interface using a
// client.Client as the underlying implementation.
type KubeClient struct {
clie... | 63 |
eks-anywhere | aws | Go | package clientutil_test
import (
"context"
"testing"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/aws/eks-anywhere/internal/test/envtest"
_ "github.com/aws/eks-anywhere/internal/test/envtest"
anywherev1 "github.com/aws/e... | 194 |
eks-anywhere | aws | Go | package clientutil
import (
"sigs.k8s.io/controller-runtime/pkg/client"
)
func ObjectsToClientObjects[T client.Object](objs []T) []client.Object {
runtimeObjs := make([]client.Object, 0, len(objs))
for _, o := range objs {
runtimeObjs = append(runtimeObjs, o)
}
return runtimeObjs
}
| 15 |
eks-anywhere | aws | Go | package clientutil_test
import (
"testing"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
)
func TestO... | 48 |
eks-anywhere | aws | Go | package clientutil
import (
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/utils/unstructured"
)
func YamlToClientObjects(yamlObjects []byte) ([]client.Object, error) {
unstructuredObjs, err := unstructured.YamlToUnstructured(yamlObjects)
if err != nil {
return nil, err
}
objs ... | 23 |
eks-anywhere | aws | Go | package clientutil_test
import (
"testing"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
)
func TestYamlToClientObjects(t *testing.T) {
t... | 84 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"time"
"github.com/go-logr/logr"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/controller-runtime/pkg/client"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/clusterapi"
"github.com/aws/eks-anywhere/pkg/controller"
)
// ... | 40 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"testing"
"time"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controllerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/con... | 117 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"reflect"
etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/api/equality"
apierrors "k8s.io/apimachinery/pkg/api/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplan... | 114 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"testing"
etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/ku... | 283 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"github.com/go-logr/logr"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/controller"
"github.com/aws/eks-anywhere/pkg/u... | 54 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"errors"
"testing"
"github.com/go-logr/logr"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/aws/eks... | 104 |
eks-anywhere | aws | Go | package clusters_test
import (
"os"
"testing"
"github.com/aws/eks-anywhere/internal/test/envtest"
)
var env *envtest.Environment
func TestMain(m *testing.M) {
os.Exit(envtest.RunWithEnvironment(m, envtest.WithAssignment(&env)))
}
| 15 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"github.com/go-logr/logr"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/controller"
)
// ProviderClusterReconciler reconciles a provider specific eks-a cluster.
type ProviderClusterReconciler interface {
// Reconcile handles the f... | 65 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"testing"
"github.com/go-logr/logr"
. "github.com/onsi/gomega"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/controller"
"github.com/aws/eks-anywhere/pkg/controller/clusters"
)
fun... | 67 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"github.com/pkg/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/controller-runtime/pkg/client"
anywherev1 "github.com/aws/eks-anywhere/pk... | 213 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"testing"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/runtime"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/controller-runtime/pk... | 781 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"fmt"
"github.com/go-logr/logr"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/controller"
)
//... | 57 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"errors"
"testing"
"github.com/go-logr/logr"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/aws/eks-anywhere/internal/test"
anywherev1 "github.co... | 101 |
eks-anywhere | aws | Go | package clusters
import (
"context"
"reflect"
"time"
"github.com/go-logr/logr"
"github.com/pkg/errors"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"... | 131 |
eks-anywhere | aws | Go | package clusters_test
import (
"context"
"testing"
"time"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
dockerv1 "sigs.k8s.io/cluste... | 272 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/controller/clusters/ipvalidator.go
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
v1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
gomock "github.com/golang/mock/gomock"
)
// MockIPUniquenessValidator is a ... | 50 |
eks-anywhere | aws | Go | package handlers
import (
"fmt"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/aws/eks-anywhere/pkg/clusterapi"
)
// CAPIObjectToCluster returns a req... | 42 |
eks-anywhere | aws | Go | package handlers_test
import (
"testing"
"github.com/go-logr/logr"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
... | 71 |
eks-anywhere | aws | Go | package handlers
import (
"github.com/go-logr/logr"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
anywherev1 "github.com/aws/eks-anywhere/pkg/a... | 39 |
eks-anywhere | aws | Go | package handlers_test
import (
"testing"
"github.com/go-logr/logr"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
... | 87 |
eks-anywhere | aws | Go | package serverside
import (
"context"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/controller"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
)
type ObjectGenerator func() ([]kubernetes.Object, error)
// ObjectApplie... | 47 |
eks-anywhere | aws | Go | package serverside_test
import (
"context"
"errors"
"testing"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/controller"
"github.com/aws/eks-anywhere/pkg/controller/ser... | 78 |
eks-anywhere | aws | Go | package serverside_test
import (
"os"
"testing"
"github.com/aws/eks-anywhere/internal/test/envtest"
)
var env *envtest.Environment
func TestMain(m *testing.M) {
os.Exit(envtest.RunWithEnvironment(m, envtest.WithAssignment(&env)))
}
| 15 |
eks-anywhere | aws | Go | package serverside
import (
"context"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
)
const fieldManager = "eks-a-controller"
func ReconcileYaml(ctx context.Context, c client.Client, yaml []byte) error {
objs, err := clientutil.Yaml... | 42 |
eks-anywhere | aws | Go | package serverside_test
import (
"context"
"strings"
"testing"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterapiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/aws/eks-anywhere/pkg/contr... | 150 |
eks-anywhere | aws | Go | package crypto
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
"net"
"time"
)
type certificategenerator struct{}
type CertificateGenerator interface {
GenerateIamAuthSelfSignCertKeyPair() ([]byte, []byte, error)
}
func NewCertificateGenerator() Certific... | 124 |
eks-anywhere | aws | Go | package crypto_test
import (
"testing"
"github.com/aws/eks-anywhere/pkg/crypto"
)
func TestGenerateIamAuthSelfSignCertKeyPairSuccess(t *testing.T) {
certGen := crypto.NewCertificateGenerator()
_, _, err := certGen.GenerateIamAuthSelfSignCertKeyPair()
if err != nil {
t.Fatalf("certificategenerator.GenerateIamA... | 16 |
eks-anywhere | aws | Go | package crypto
import (
"bytes"
cryptorand "crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io"
"golang.org/x/crypto/ssh"
"github.com/aws/eks-anywhere/pkg/filewriter"
)
// SshKeysize is the key size used when calling NewSshKeyPair().
const SshKeySize = 4096
// NewSshKeyPair creates an RSA pu... | 75 |
eks-anywhere | aws | Go | package crypto_test
import (
"bytes"
"crypto/x509"
"encoding/pem"
"testing"
"github.com/onsi/gomega"
"golang.org/x/crypto/ssh"
"github.com/aws/eks-anywhere/pkg/crypto"
)
func TestNewSshKeyPair(t *testing.T) {
g := gomega.NewWithT(t)
var priv, pub bytes.Buffer
err := crypto.NewSshKeyPair(&priv, &pub)
g.... | 33 |
eks-anywhere | aws | Go | package crypto
import (
"strings"
)
// This is what we currently support as the default. In the future,
// we can make this customizable and return a wider range of
// supported names.
func secureCipherSuiteNames() []string {
return []string{"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"}
}
func SecureCipherSuitesString(... | 17 |
eks-anywhere | aws | Go | package crypto_test
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/eks-anywhere/pkg/crypto"
)
var validCipherSuitesString = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
func TestSecureCipherSuiteNames(t *testing.T) {
string := crypto.SecureCipherSuitesString()
if !reflect.DeepEq... | 20 |
eks-anywhere | aws | Go | package crypto
import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"net"
)
type DefaultTlsValidator struct{}
type TlsValidator interface {
ValidateCert(host, port, caCertContent string) error
IsSignedByUnknownAuthority(host, port string) (bool, error)
}
func NewTlsValidator() TlsValidator {
return &Def... | 67 |
eks-anywhere | aws | Go | package crypto_test
import (
"crypto/tls"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/aws/eks-anywhere/pkg/crypto"
)
const (
endpoint = "127.0.0.1"
invalidEndpoint = "invalid-endpoint.local"
/*
This certificate was generated using the following commands and is valid only f... | 253 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/crypto/certificategen.go
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockCertificateGenerator is a mock of CertificateGenerator interface.
type MockCertificateGenerato... | 51 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/crypto/validator.go
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockTlsValidator is a mock of TlsValidator interface.
type MockTlsValidator struct {
ctrl *gomock.... | 64 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
"encoding/json"
"fmt"
"strings"
"sigs.k8s.io/yaml"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/semver"
releasev1 "github.com/aw... | 140 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
)
type Manager interface {
LatestBundle(ctx context.Context, baseRef string, kubeMajor string, kubeMinor string, clusterName string) (*packagesv1.PackageBundle, error)
}
| 12 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"bytes"
"context"
"encoding/json"
"errors"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"sigs.k8s.io/yaml"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anyw... | 185 |
eks-anywhere | aws | Go | package curatedpackages
import (
"fmt"
"strconv"
"strings"
"sigs.k8s.io/yaml"
)
func GenerateAllValidConfigurations(configs map[string]string) (string, error) {
data := map[string]interface{}{}
for key, val := range configs {
if val != "" {
keySegments := strings.Split(key, ".")
parse(data, keySegments... | 60 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"fmt"
"testing"
. "github.com/onsi/gomega"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
)
type configurationTest struct {
*WithT
invalidbp *packagesv1.BundlePackage
configs map[string]string
}
func n... | 75 |
eks-anywhere | aws | Go | package curatedpackages
import (
"fmt"
"io"
"strings"
"text/tabwriter"
)
// cpTabwriter is a modified tabwriter for curated packages CLI duty.
type cpTabwriter struct {
*tabwriter.Writer
}
// newCPTabwriter instantiates a curated packages custom tabwriter.
//
// If customParams is nil, cpTabwriterDefaultParams ... | 77 |
eks-anywhere | aws | Go | package curatedpackages
import (
"bytes"
"fmt"
"testing"
)
func TestCPTabwriterDefaultParams(t *testing.T) {
buf := &bytes.Buffer{}
w := newCPTabwriter(buf, nil)
baseBuf := &bytes.Buffer{}
baseline := newCPTabwriter(baseBuf, nil)
fmt.Fprint(baseline, "one\ta\t\ntwo\tb\t\nthree\tc\t\n")
baseline.Flush()
er... | 50 |
eks-anywhere | aws | Go | package curatedpackages
import (
"bytes"
"context"
"fmt"
"strings"
"github.com/go-logr/logr"
"oras.land/oras-go/pkg/content"
"oras.land/oras-go/pkg/oras"
"github.com/aws/eks-anywhere-packages/pkg/artifacts"
"github.com/aws/eks-anywhere-packages/pkg/bundle"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"g... | 121 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
_ "embed"
"errors"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/internal/test"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anywhere/pkg/curatedp... | 125 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
"fmt"
"github.com/aws/eks-anywhere/pkg/executables"
)
type CustomRegistry struct {
*executables.Helm
registry string
}
func NewCustomRegistry(helm *executables.Helm, registry string) *CustomRegistry {
return &CustomRegistry{
Helm: helm,
registry: registry,
}... | 25 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
"fmt"
"github.com/aws/eks-anywhere/pkg/manifests/bundles"
"github.com/aws/eks-anywhere/pkg/version"
)
type DefaultRegistry struct {
releaseManifestReader Reader
kubeVersion string
cliVersion version.Info
}
func NewDefaultRegistry(rmr Reader, kv ... | 42 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"context"
"errors"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anywhere/pkg/curatedpackages/mocks"
"github.com/aws/eks-anywhere/pkg/version"
releasev1 "github.com/aws/eks-anyw... | 88 |
eks-anywhere | aws | Go | package curatedpackages
import (
"k8s.io/apimachinery/pkg/version"
)
// Discovery
/**
Implements ServerVersionInterface to provide the Kubernetes client version to be used.
*/
type Discovery struct {
kubeVersion *KubeVersion
}
type KubeVersion struct {
major string
minor string
}
func NewDiscovery(kubeVersion *... | 40 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"testing"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
)
func TestServerVersionSucceeds(t *testing.T) {
kubeVersion := curatedpackages.NewKubeVersion("1", "21")
discovery := curatedpackages.NewDiscovery(kubeVersion)
_, err := discovery.ServerVersion()
if err != nil {... | 18 |
eks-anywhere | aws | Go | package curatedpackages
import (
"bytes"
"context"
"k8s.io/apimachinery/pkg/runtime"
)
type KubectlRunner interface {
ExecuteCommand(ctx context.Context, opts ...string) (bytes.Buffer, error)
ExecuteFromYaml(ctx context.Context, yaml []byte, opts ...string) (bytes.Buffer, error)
// GetObject performs a GET cal... | 20 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
"errors"
"fmt"
"io"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/templater"
)
const (
Custom... | 233 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"bytes"
"context"
"errors"
"fmt"
"os"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"gi... | 273 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
_ "embed"
"encoding/base64"
"fmt"
"strconv"
"strings"
"sync"
"time"
"github.com/go-logr/logr"
corev1 "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/c... | 596 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"context"
_ "embed"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"testing"
"time"
"github.com/go-logr/logr/testr"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/a... | 1,384 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/logger"
)
type PackageController interface {
// Enable curated packages support.
Enable(ctx context.Context) error
IsInstalled(ctx con... | 89 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"context"
"errors"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/curated... | 131 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"context"
_ "embed"
"fmt"
"testing"
"github.com/golang/mock/gomock"
. "github.com/onsi/gomega"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/stretchr/testify/assert"
"oras.land/oras-go/v2/registry/remote"
"github.com/aws/eks-anywhere/pkg/curate... | 198 |
eks-anywhere | aws | Go | package curatedpackages
import (
api "github.com/aws/eks-anywhere-packages/api/v1alpha1"
)
// DisplayablePackage wraps Package to omit undesired members (like Status).
//
// This is necessary in part because of https://github.com/golang/go/issues/11939
// but also because we just don't want to generate a Status sect... | 20 |
eks-anywhere | aws | Go | package curatedpackages
import (
"context"
"fmt"
"sort"
"strings"
"sigs.k8s.io/yaml"
packagesv1 "github.com/aws/eks-anywhere-packages/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/registry"
releasev1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
)
// Temporary... | 161 |
eks-anywhere | aws | Go | package curatedpackages
import (
"fmt"
"strings"
)
func ValidateKubeVersion(kubeVersion string, clusterName string) error {
if len(clusterName) > 0 {
if len(kubeVersion) > 0 {
return fmt.Errorf("please specify either kube-version or cluster name not both")
}
return nil
}
if len(kubeVersion) > 0 {
ver... | 25 |
eks-anywhere | aws | Go | package curatedpackages_test
import (
"testing"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
)
func TestValidateNoKubeVersionWhenClusterSucceeds(t *testing.T) {
err := curatedpackages.ValidateKubeVersion("", "morby")
if err != nil {
t.Errorf("empty kubeVersion allowed when cluster specified")
}
}
func T... | 45 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/curatedpackages/bundlemanager.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"
)
// MockManag... | 52 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/curatedpackages/packagecontrollerclient.go
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
types "k8s.io/apimachinery/pkg/types"
client "sigs.k8s.io/control... | 220 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/curatedpackages/kubectlrunner.go
// Package mocks is a generated GoMock package.
package mocks
import (
bytes "bytes"
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// MockKubectlRu... | 107 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: sigs.k8s.io/controller-runtime/pkg/client (interfaces: Client)
// 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/meta"
runtime "... | 229 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/curatedpackages/packageinstaller.go
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockPackageController is a mock of PackageController interface.
type... | 101 |
eks-anywhere | aws | Go | // Code generated by MockGen. DO NOT EDIT.
// Source: pkg/curatedpackages/bundle.go
// Package mocks is a generated GoMock package.
package mocks
import (
context "context"
reflect "reflect"
v1alpha1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
gomock "github.com/golang/mock/gomock"
)
// MockReader is a m... | 90 |
eks-anywhere | aws | Go | package oras
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anywhere/pkg/logger"
releasev1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
)
type BundleDownloader struct {
dstFolder string
log ... | 82 |
eks-anywhere | aws | Go | package oras
import (
"context"
"os"
"path/filepath"
"strings"
"github.com/aws/eks-anywhere/pkg/curatedpackages"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/utils/urls"
releasev1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
)
type FileRegistryImporter struct {
registry ... | 51 |
eks-anywhere | aws | Go | /*
Package defaulting implements tools to perform defaulting in data objects.
These might be used from the CLI and/or the controller.
This package shoul not, under any circumtance, include specific defaulting logic.
Only the tools to operate that logic should live here.
*/
package defaulting
| 10 |
eks-anywhere | aws | Go | package defaulting_test
import (
"context"
"fmt"
"github.com/aws/eks-anywhere/internal/test"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/defaulting"
eksaerrors "github.com/aws/eks-anywhere/pkg/errors"
)
func ExampleRunner... | 59 |
eks-anywhere | aws | Go | package defaulting
import (
"context"
"github.com/aws/eks-anywhere/pkg/errors"
)
// Default is the logic for a default for a type O. It should return a value of O
// wether it updates it or not. When there is an error, return the zero value of O
// and the error.
type Default[O any] func(ctx context.Context, obj O... | 59 |
eks-anywhere | aws | Go | package defaulting_test
import (
"context"
"errors"
"testing"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/pkg/defaulting"
eksaerrors "github.com/aws/eks-anywhere/pkg/errors"
)
func TestRunnerRunAll(t *testing.T) {
g := NewWithT(t)
r := defaulting.NewRunner[apiCluster]()
r.Register(
func(ctx ... | 70 |
eks-anywhere | aws | Go | package dependencies
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"time"
"github.com/go-logr/logr"
"github.com/google/uuid"
"golang.org/x/exp/maps"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/aws"
"github.com/aws/eks-anywhere/pkg/awsiamauth"
"github.com/aws/e... | 1,490 |
eks-anywhere | aws | Go | package dependencies_test
import (
"bytes"
"context"
"encoding/base64"
"testing"
"time"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/internal/test"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"gith... | 610 |
eks-anywhere | aws | Go | package diagnostics
import (
"fmt"
"path"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/constants"
)
const (
logAnalysisAnalyzerPrefix = "log analysis:"
)
type analyzerFactory struct{}
func NewAnalyzerFactory() *analyzerFactory {
return &analyzerFactory{}
}
func (a *analyze... | 453 |
eks-anywhere | aws | Go | package diagnostics_test
import (
"testing"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/internal/test"
eksav1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/diagnostics"
)
func TestManagementClusterAnalyzers(t *testing.T) {
g := NewGomegaWithT(t)
factory := ... | 102 |
eks-anywhere | aws | Go | package diagnostics
type Analyze struct {
CustomResourceDefinition *customResourceDefinition `json:"customResourceDefinition,omitempty"`
Secret *analyzeSecret `json:"secret,omitempty"`
ImagePullSecret *imagePullSecret `json:"imagePullSecret,omitempty"`
DeploymentStatu... | 51 |
eks-anywhere | aws | Go | package diagnostics
import (
"fmt"
"path/filepath"
"time"
v1 "k8s.io/api/core/v1"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/constants"
"github.com/aws/eks-anywhere/pkg/providers"
)
// FileReader reads files from local disk or ht... | 635 |
eks-anywhere | aws | Go | package diagnostics_test
import (
"fmt"
"path/filepath"
"testing"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/internal/test"
eksav1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"... | 149 |
eks-anywhere | aws | Go | package diagnostics
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Collect struct {
ClusterInfo *clusterInfo `json:"clusterInfo,omitempty"`
ClusterResources *clusterResources `json:"clusterResources,omitempty"`
Secret *secret `json:"secret,omit... | 97 |
eks-anywhere | aws | Go | package diagnostics_test
import (
"bytes"
"context"
"testing"
"time"
"github.com/golang/mock/gomock"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/internal/test"
eksav1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aw... | 549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.