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 | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Lis... | 113 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 116 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Lis... | 113 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Put... | 123 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Reb... | 107 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 117 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Shu... | 107 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 114 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Sto... | 111 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 129 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 127 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func (c *Client) Upd... | 109 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
"github.com/aws/smithy-go/middle... | 120 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
smithy "github.com/aws/smithy-go"
smithyio "github.... | 9,537 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package snowballdevice provides the API client, operations, and parameter types
// for AWS Snowball Device.
package snowballdevice
| 6 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
internalendpoints "github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/internal/endpoi... | 201 |
eks-anywhere | aws | Go | // Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
package snowballdevice
// goModuleVersion is the tagged release for this module.
const goModuleVersion = "tip"
| 7 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
| 4 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"bytes"
"context"
"fmt"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/encoding/httpbinding"
smithyjson "github.com/aws/smithy-go/en... | 3,046 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package snowballdevice
import (
"context"
"fmt"
"github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/service/snowballdevice/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpCreateAutoStartConfiguration struct {
}
... | 728 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"github.com/aws/aws-sdk-go-v2/aws"
endpoints "github.com/aws/eks-anywhere/internal/aws-sdk-go-v2/internal/endpoints/v2"
"github.com/aws/smithy-go/logging"
"regexp"
)
// Options is the endpoint resolver configuration options.
type Opti... | 251 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"testing"
)
func TestRegexCompile(t *testing.T) {
_ = defaultPartitions
}
| 12 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
type ClusterAssociationState string
// Enum values for ClusterAssociationState.
const (
ClusterAssociationStateAssociated ClusterAssociationState = "ASSOCIATED"
ClusterAssociationStateAssociating ClusterAssociationState = "ASSOCIATING"
Clust... | 278 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
"fmt"
smithy "github.com/aws/smithy-go"
)
type IncorrectDeviceStateException struct {
Message *string
noSmithyDocumentSerde
}
func (e *IncorrectDeviceStateException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorM... | 341 |
eks-anywhere | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
smithydocument "github.com/aws/smithy-go/document"
)
type AutoStartConfiguration struct {
AutoStartConfigurationArn *string
Enabled bool
IpAddressAssignment IpAddressAssignment
LaunchTemplateId *string
LaunchTemplateVersion *string
... | 283 |
eks-anywhere | aws | Go | package api
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type AWSIamConfigOpt func(c *v1alpha1.AWSIamConfig)
func NewAWSIamConfig(name string, opts ...AWSIamConfigOpt) *v1alpha1.AWSIamConfig {
config := &v1alpha1.AWSIamConfig{
TypeMeta: metav1.TypeMeta... | 73 |
eks-anywhere | aws | Go | package api
import (
"fmt"
"os"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
)
type CloudStackConfig struct {
datacenterConfig *anywherev1.CloudStackDatacenterConfig
machineConfigs map[string]*an... | 190 |
eks-anywhere | aws | Go | package api
import (
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type CloudStackMachineConfigFiller func(m *anywherev1.CloudStackMachineConfig)
func FillCloudStackMachineConfig(m *anywherev1.CloudStackMachineConfig, fillers ...CloudStackMachineConfigFi... | 37 |
eks-anywhere | aws | Go | package api
import (
_ "embed"
"testing"
. "github.com/onsi/gomega"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
)
const clusterConfigFile = "testdata/cloudstack-config.yaml"
func TestCloudStackMachineConfigFillers(t *testing.T) {
testOffering := "test-c... | 119 |
eks-anywhere | aws | Go | package api
import (
"fmt"
"strings"
corev1 "k8s.io/api/core/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/providers"
"github.com/aws/eks-anywhere/pkg/utils/ptr"
)
type Cluster... | 282 |
eks-anywhere | aws | Go | package api_test
import (
"testing"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/internal/pkg/api"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/utils/ptr"
)
func TestWithWorkerNodeCount(t *testing.T) {
tests := []struct {
name string
cluster *any... | 234 |
eks-anywhere | aws | Go | package api
import "github.com/aws/eks-anywhere/pkg/cluster"
// ClusterConfigFiller updates a cluster.Config.
type ClusterConfigFiller func(*cluster.Config)
// UpdateClusterConfig updates the given cluster.Config by applying the fillers.
func UpdateClusterConfig(config *cluster.Config, fillers ...ClusterConfigFiller... | 14 |
eks-anywhere | aws | Go | package api
import (
"os"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type FluxConfigOpt func(o *v1alpha1.FluxConfig)
func NewFluxConfig(name string, opts ...FluxConfigOpt) *v1alpha1.FluxConfig {
config := &v1alpha1.FluxConfig{
TypeMeta: metav1.TypeMeta{
... | 119 |
eks-anywhere | aws | Go | package api
import (
"os"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type GitOpsConfigOpt func(o *v1alpha1.GitOpsConfig)
func NewGitOpsConfig(name string, opts ...GitOpsConfigOpt) *v1alpha1.GitOpsConfig {
config := &v1alpha1.GitOpsConfig{
TypeMeta: metav1.T... | 75 |
eks-anywhere | aws | Go | package api
import (
"fmt"
"io"
"os"
"path/filepath"
"github.com/gocarina/gocsv"
"github.com/aws/eks-anywhere/pkg/providers/tinkerbell/hardware"
)
const (
HardwareVendorDell = "dell"
HardwareVendorHP = "hp"
HardwareVendorSuperMicro = "supermicro"
HardwareVendorUnspecified = "unspecified"
... | 118 |
eks-anywhere | aws | Go | package api
import (
corev1 "k8s.io/api/core/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type WorkerNodeGroupFiller func(w *anywherev1.WorkerNodeGroupConfiguration)
func FillWorkerNodeGroup(w *anywherev1.WorkerNodeGroupConfiguration, fillers ...WorkerNodeGroupFiller) {
for _, f := range fille... | 52 |
eks-anywhere | aws | Go | package api
import (
"encoding/base64"
"os"
"strconv"
"k8s.io/apimachinery/pkg/api/resource"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/logger"
)
// NutanixConfig is a wrapper for the Nutanix provider spec.
type Nutanix... | 208 |
eks-anywhere | aws | Go | package api
import (
"testing"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/api/resource"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
func TestNutanixDatacenterConfigFillers(t *testing.T) {
g := NewWithT(t)
conf := nutanixConfig()
WithNutanixAdditionalTrustBundle("dGVzdEJ1bmRsZQ==")(c... | 77 |
eks-anywhere | aws | Go | package api
import (
"os"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
)
// OIDCConfigOpt updates an OIDC config.
type OIDCConfigOpt func(o *anywherev1.OIDCConfig)
// WithOIDCConfig builds a ClusterConfigFiller... | 91 |
eks-anywhere | aws | Go | package api
import (
"os"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
)
type SnowConfig struct {
datacenterConfig *anywherev1.SnowDatacenterConfig
machineConfigs map[string]*anywherev1.SnowMachin... | 151 |
eks-anywhere | aws | Go | package api
import (
"strings"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
snowv1 "github.com/aws/eks-anywhere/pkg/providers/snow/api/v1beta1"
)
type SnowMachineConfigFiller func(m *anywherev1.SnowMachineConfig)
func FillSnowMachineConfig(m *anywherev1.SnowMachineConfig, fillers ...SnowMachineConfi... | 93 |
eks-anywhere | aws | Go | package api
import (
"fmt"
corev1 "k8s.io/api/core/v1"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
// MasterTaint will be deprecated from kubernetes version 1.25 onwards.
func MasterTaint() corev1.Taint {
return corev1.Taint{
Key: "node-role.kubernetes.io/master",
Effect: corev1.TaintEffectNoSchedul... | 86 |
eks-anywhere | aws | Go | package api
import (
"os"
metav1 "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/providers"
)
type TinkerbellConfig struct {
clusterName string
datacenterConfig *anywherev1.Tinkerb... | 199 |
eks-anywhere | aws | Go | package api
import (
"os"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
)
type VSphereConfig struct {
datacenterConfig *anywherev1.VSphereDatacenterConfig
machineConfigs map[string]*anywherev1.VSphereMachineC... | 230 |
eks-anywhere | aws | Go | package api
import (
"os"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
type VSphereMachineConfigFiller func(m *anywherev1.VSphereMachineConfig)
func FillVSphereMachineConfig(m *anywherev1.VSphereMachineConfig, fillers ...VSphereMachineConfigFiller) {
for _, f := range fillers {
f(m)
}
}
func W... | 78 |
eks-anywhere | aws | Go | package api
import (
"strings"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
)
func CleanupPathsFromYaml(yamlContent []byte, paths []string) ([]byte, error) {
m := make(map[string]interface{})
if err := yaml.Unmarshal(yamlContent, &m)... | 92 |
eks-anywhere | aws | Go | package api
import (
"testing"
. "github.com/onsi/gomega"
)
func TestDeletePaths(t *testing.T) {
tests := []struct {
name string
obj, wantObj map[string]interface{}
paths []string
}{
{
name: "delete nested paths, array and property from array of objects",
obj: map[string]interface{}{... | 73 |
eks-anywhere | aws | Go | package awsiam
import (
"fmt"
"runtime"
eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1"
"github.com/aws/eks-anywhere/internal/pkg/files"
)
const awsIamClientBinary = "aws-iam-authenticator"
func DownloadAwsIamAuthClient(eksdRelease *eksdv1alpha1.Release) error {
uri, err := getAwsI... | 42 |
eks-anywhere | aws | Go | package conformance
import (
"bytes"
"fmt"
"golang.org/x/sys/unix"
"github.com/aws/eks-anywhere/internal/pkg/files"
)
const (
destinationFile = "sonobuoy"
sonobuoyDarwin = "https://github.com/vmware-tanzu/sonobuoy/releases/download/v0.53.2/sonobuoy_0.53.2_darwin_amd64.tar.gz"
sonobuoyLinux = "https://gith... | 40 |
eks-anywhere | aws | Go | package conformance
import (
"context"
"github.com/aws/eks-anywhere/pkg/executables"
)
func RunTests(ctx context.Context, contextName string, args ...string) (string, error) {
sonobuoy := executables.BuildSonobuoyExecutable()
return sonobuoy.Run(ctx, contextName, args...)
}
func GetResults(ctx context.Context, ... | 18 |
eks-anywhere | aws | Go | package ec2
import (
"encoding/base64"
"fmt"
"math/rand"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/eks-anywhere/pkg/logger"
"github.com/aws/eks-anywhere/pkg/retrier"
)
var do... | 114 |
eks-anywhere | aws | Go | package ec2
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/eks-anywhere/pkg/logger"
)
func ListInstances(session *session.Session, key string, value string, maxAge float64) ([]*string, error) {
service := e... | 73 |
eks-anywhere | aws | Go | package ec2
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
func TagInstance(session *session.Session, instanceId, key, value string) error {
service := ec2.New(session)
_, err := service.CreateTags(&ec2.CreateTagsInput{
Resourc... | 28 |
eks-anywhere | aws | Go | package ec2
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
const defaultInstanceIDBlockSize = 500
// TerminateEc2Instances terminates EC2 instances by calling the AWS API.
func TerminateEc2Instances(session *session.Session, instanceIDs []*string) error {
servic... | 45 |
eks-anywhere | aws | Go | package ec2
import (
"testing"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/pkg/utils/ptr"
)
func TestMakeChunks(t *testing.T) {
tests := []struct {
name string
elements []*int
chunkSize int
want [][]*int
}{
{
name: "empty elements",
elements: []*int{},
chunkSize:... | 134 |
eks-anywhere | aws | Go | package files
import (
"archive/tar"
"compress/gzip"
"fmt"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/aws/eks-anywhere/pkg/logger"
untar "github.com/aws/eks-anywhere/pkg/tar"
)
// GzipFileDownloadExtract downloads and extracts a specific file to destination.
func GzipFileDownloadExtract(uri, file... | 56 |
eks-anywhere | aws | Go | package files_test
import (
"os"
"path/filepath"
"testing"
. "github.com/onsi/gomega"
"github.com/aws/eks-anywhere/internal/pkg/files"
"github.com/aws/eks-anywhere/internal/test"
)
func TestGzipFileDownloadExtract(t *testing.T) {
g := NewWithT(t)
server := test.NewHTTPServerForFile(t, "testdata/dummy1.tar.g... | 28 |
eks-anywhere | aws | Go | package nutanix
import (
"context"
"fmt"
"strings"
prismgoclient "github.com/nutanix-cloud-native/prism-go-client"
"github.com/nutanix-cloud-native/prism-go-client/utils"
v3 "github.com/nutanix-cloud-native/prism-go-client/v3"
"github.com/aws/eks-anywhere/pkg/providers/nutanix"
)
// PrismClient is a interfac... | 113 |
eks-anywhere | aws | Go | package oidc
import (
"encoding/json"
"fmt"
jose "gopkg.in/square/go-jose.v2"
)
type keyResponse struct {
Keys []jose.JSONWebKey `json:"keys"`
}
func GetKeyID(keysBytes []byte) (string, error) {
keys, err := parseKeys(keysBytes)
if err != nil {
return "", err
}
if len(keys.Keys) != 1 {
return "", fmt.E... | 36 |
eks-anywhere | aws | Go | package oidc
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/json"
"encoding/pem"
"fmt"
jose "gopkg.in/square/go-jose.v2"
)
type MinimalProvider struct {
Discovery, Keys, PrivateKey []byte
KeyID string
}
type discoveryResponse struct {
Issuer ... | 129 |
eks-anywhere | aws | Go | package oidc_test
import (
"crypto/x509"
"encoding/json"
"encoding/pem"
"testing"
"github.com/aws/eks-anywhere/internal/pkg/oidc"
"github.com/aws/eks-anywhere/internal/test"
)
func TestGenerateMinimalProvider(t *testing.T) {
tests := []struct {
testName string
issuerURL string
wantDisco... | 76 |
eks-anywhere | aws | Go | package oidc
import (
"crypto/x509"
"encoding/pem"
"fmt"
"os"
"time"
jose "gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
type oidcTokenClaim struct {
Issuer string `json:"iss,omitempty"`
Subject string `json:"sub,omitempty"`
kid string
keyFile stri... | 126 |
eks-anywhere | aws | Go | package s3
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
)
func GetBucketPublicURL(session *session.Session, bucket string) string {
return fmt.Sprintf("https://s3-%s.amazonaws.com/%s", *session.Config.Region, bucket)
}
| 12 |
eks-anywhere | aws | Go | package s3
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/eks-anywhere/pkg/logger"
)
func CleanUpS3Bucket(session *session.Session, bucket string, maxAge float64) error {
service := s3.New(session)
input :... | 57 |
eks-anywhere | aws | Go | package s3
import (
"fmt"
"io"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
func Download(session *session.Session, key, bucket string) ([]byte, error) {
b := aws.NewWriteAtBuffer([]byte{... | 49 |
eks-anywhere | aws | Go | package s3
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func ObjectPresent(session *session.Session, key, bucket string) (bool, error) {
s := s3.New(session)
_, err := s.HeadObject(&s3.Hea... | 27 |
eks-anywhere | aws | Go | package s3
import (
"bytes"
"fmt"
"io"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type UploadOpt func(*s3manager.UploadInput)
func WithPublicRead() UploadOpt {
return func(s *s3manager.UploadInput) {
s.ACL = aws.String("p... | 54 |
eks-anywhere | aws | Go | package ssm
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
type ActivationInfo struct {
ActivationCode string
ActivationID string
}
func CreateActivation(session *session.Session, instanceName, role string) (*ActivationInfo, error) {
s := ssm.New(session)
... | 46 |
eks-anywhere | aws | Go | package ssm
import (
"fmt"
"math"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/pkg/retrier"
)
const ssmLogGroup = "/eks-anywher... | 174 |
eks-anywhere | aws | Go | package ssm
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
func GetInstanceByActivationId(session *session.Session, id string) (*ssm.InstanceInformation, error) {
s := ssm.New(session)
instanceActivationIdKey := "ActivationIds"
input := ssm.DescribeInstanceInfo... | 46 |
eks-anywhere | aws | Go | package ssm
import "github.com/aws/aws-sdk-go/service/ssm"
type RunOutput struct {
commandOut *ssm.GetCommandInvocationOutput
CommandId string
StdOut, StdErr []byte
}
func buildRunOutput(commandOut *ssm.GetCommandInvocationOutput) *RunOutput {
return &RunOutput{
commandOut: commandOut,
CommandId: *... | 23 |
eks-anywhere | aws | Go | package vsphere
import (
"context"
"encoding/json"
"fmt"
"github.com/aws/eks-anywhere/pkg/executables"
"github.com/aws/eks-anywhere/pkg/filewriter"
)
type OVFDeployOptions struct {
Name string `json:"Name"`
PowerOn bool `json:"PowerOn"`
DiskProvisioning string ... | 75 |
eks-anywhere | aws | Go | package test
import (
"embed"
"fmt"
"path/filepath"
"runtime"
"testing"
eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/cluster"
"git... | 139 |
eks-anywhere | aws | Go | package test
import (
"bytes"
"flag"
"fmt"
"log"
"os"
"os/exec"
"regexp"
"testing"
"github.com/aws/eks-anywhere/pkg/files"
"github.com/aws/eks-anywhere/pkg/filewriter"
)
var UpdateGoldenFiles = flag.Bool("update", false, "update golden files")
func AssertFilesEquals(t *testing.T, gotPath, wantPath string)... | 145 |
eks-anywhere | aws | Go | package test
import (
"errors"
"io"
"io/fs"
"os"
"testing"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/envtest"
)
// WithFakeFile returns a throwaway file in a test-specific directory.
//
// The file is automatically closed and removed when the test ends.
func WithFakeFile(t *testing.T) (f *os... | 87 |
eks-anywhere | aws | Go | package test
import (
"net/http"
"net/http/httptest"
"os"
"testing"
)
func NewHTTPServerForFile(t *testing.T, filePath string) *httptest.Server {
fileContent, err := os.ReadFile(filePath)
if err != nil {
t.Fatalf("Failed reading file [%s] to serve from http: %s", filePath, err)
}
ts := httptest.NewServer(ht... | 39 |
eks-anywhere | aws | Go | package test
import (
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
_ "github.com/aws/eks-anywhere/internal/test/envtest"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/controller/clientutil"
... | 31 |
eks-anywhere | aws | Go | package test
// KubeVipTemplate is the default kube-vip pod template for internal testing.
const KubeVipTemplate = `apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- args:
- manager
env:
- name: vip_arp
value: "true"
- n... | 56 |
eks-anywhere | aws | Go | package test
import (
"github.com/go-logr/logr"
"sigs.k8s.io/controller-runtime/pkg/log"
)
func NewNullLogger() logr.Logger {
return logr.New(log.NullLogSink{})
}
| 11 |
eks-anywhere | aws | Go | package test
import (
"context"
"fmt"
"reflect"
"github.com/golang/mock/gomock"
)
type ofType struct{ t string }
func OfType(t string) gomock.Matcher {
return &ofType{t}
}
func (o *ofType) Matches(x interface{}) bool {
return reflect.TypeOf(x).String() == o.t
}
func (o *ofType) String() string {
return "is... | 71 |
eks-anywhere | aws | Go | package test
import "math/rand"
const alphanumeric = "abcdefghijklmnopqrstuvwxyz0123456789"
func RandString(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = alphanumeric[rand.Intn(len(alphanumeric))]
}
return string(b)
}
| 14 |
eks-anywhere | aws | Go | package test
// Reader is a commonly used interface in multiple packages
// We are replicating here just to create a single mock we can
// use in multiple test packages.
type Reader interface {
ReadFile(url string) ([]byte, error)
}
| 9 |
eks-anywhere | aws | Go | package test
import (
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
anywherev1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1"
)
// RegistryMirrorInsecureSkipVerifyEnabled returns a test RegistryMirrorConfiguration with InsecureSkipVerify enabled.
func RegistryMirrorInsecureSkipVerifyEnabled()... | 99 |
eks-anywhere | aws | Go | package test
import (
"time"
eksdv1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1"
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/kubeadm/api/v1beta1"
anywherev1 "git... | 214 |
eks-anywhere | aws | Go | package test
import "time"
var (
defaultNow = time.Unix(0, 1234567890000*int64(time.Millisecond))
newNow = time.Unix(0, 987654321000*int64(time.Millisecond))
)
func FakeNow() time.Time {
return defaultNow
}
// NewFakeNow sets a dummy value for time.Now in unit tests.
// This is particularly useful when testi... | 19 |
eks-anywhere | aws | Go | package cleanup
import (
"context"
"fmt"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws/session"
prismgoclient "github.com/nutanix-cloud-native/prism-go-client"
v3 "github.com/nutanix-cloud-native/prism-go-client/v3"
"github.com/aws/eks-anywhere/internal/pkg/ec2"
"github.com/aws/eks-anywhere/internal/pkg/s... | 169 |
eks-anywhere | aws | Go | package e2e
import (
"fmt"
"path/filepath"
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/internal/pkg/s3"
"github.com/aws/eks-anywhere/internal/pkg/ssm"
)
const e2eHomeFolder = "/home/e2e/"
func (e *E2ESession) uploadGeneratedFilesFromInstance(testName string) {
e.logger.V(1).Info("Uploading log fil... | 76 |
eks-anywhere | aws | Go | package e2e
import (
"os"
"regexp"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
func (e *E2ESession) setupAwsIam(testRegex string) error {
re := regexp.MustCompile(`^.*AWSIamAuth.*$`)
if !re.MatchString(testRegex) {
return nil
}
requiredEnvVars := e2etests.RequiredAWSIamEnvVars()
for _, eVar :=... | 25 |
eks-anywhere | aws | Go | package e2e
import (
"os"
"regexp"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
const (
cloudstackRegex = `^.*CloudStack.*$`
)
func (e *E2ESession) setupCloudStackEnv(testRegex string) error {
re := regexp.MustCompile(cloudstackRegex)
if !re.MatchString(testRegex) {
return nil
}
requiredEnvVar... | 28 |
eks-anywhere | aws | Go | package e2e
import (
"fmt"
"strings"
)
type copyCommand string
func newCopyCommand() copyCommand {
return "aws s3 cp"
}
func (c copyCommand) String() string {
return string(c)
}
func (c copyCommand) addOption(opt string) copyCommand {
return copyCommand(fmt.Sprintf("%s %s", string(c), opt))
}
func (c copyCom... | 41 |
eks-anywhere | aws | Go | package e2e
import (
"testing"
. "github.com/onsi/gomega"
)
func TestCopyCommand(t *testing.T) {
tests := []struct {
name string
c copyCommand
want string
}{
{
name: "simple upload",
c: newCopyCommand().from(
"/home/path", "user",
).to("s3://bucket", "path"),
want: "aws s3 cp /home/pat... | 44 |
eks-anywhere | aws | Go | package e2e
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"encoding/pem"
"fmt"
"golang.org/x/crypto/ssh"
)
func generateKeyPairEcdsa() (*ecdsa.PrivateKey, error) {
k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
if err != nil {
return nil, fmt.Errorf("generating key pair:... | 43 |
eks-anywhere | aws | Go | package e2e
import (
"os"
"regexp"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
func (e *E2ESession) setupFluxEnv(testRegex string) error {
re := regexp.MustCompile(`^.*Flux.*$`)
if !re.MatchString(testRegex) {
return nil
}
requiredEnvVars := e2etests.RequiredFluxGithubEnvVars()
for _, eVar := ... | 24 |
eks-anywhere | aws | Go | package e2e
import (
"context"
"encoding/base64"
"fmt"
"log"
"os"
"regexp"
"strings"
"time"
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/internal/pkg/ssm"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/config"
"github.com/aws/eks-anywhere/pkg/git"
"github.com/... | 221 |
eks-anywhere | aws | Go | package e2e
import (
"context"
"fmt"
"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/git"
"github.com/aws/eks-anywhere/pkg/git/gogithub"
"github.com/aws/eks-anywhere/pkg/git/providers/github"
)
func (e *E2ESession) TestGithubClient(ctx context.Context, githubToken string, owner ... | 30 |
eks-anywhere | aws | Go | package e2e
import (
"os"
"regexp"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
func (e *E2ESession) setupNTPEnv(testRegex string) error {
re := regexp.MustCompile(`^.*NTP.*$`)
if !re.MatchString(testRegex) {
return nil
}
for _, eVar := range e2etests.RequiredNTPServersEnvVars() {
if val, ok :... | 37 |
eks-anywhere | aws | Go | package e2e
import (
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/pkg/networkutils"
)
type E2EIPManager struct {
networkCidr string
networkIPs map[string]bool
logger logr.Logger
}
func newE2EIPManager(logger logr.Logger, networkCidr string) *E2EIPManager {
return &E2EIPManager{
networkCidr: ... | 49 |
eks-anywhere | aws | Go | package e2e
import (
"bufio"
"context"
"fmt"
"path/filepath"
"strings"
"github.com/aws/eks-anywhere/pkg/executables"
"github.com/aws/eks-anywhere/pkg/types"
)
func listTests(regex string, testsToSkip []string) (tests, skippedTests []string, err error) {
e := executables.NewExecutable(filepath.Join("bin", e2e... | 42 |
eks-anywhere | aws | Go | package e2e
import (
"os"
"regexp"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
const (
nutanixCidrVar = "T_NUTANIX_CONTROL_PLANE_CIDR"
nutanixRegex = `^.*Nutanix.*$`
)
func (e *E2ESession) setupNutanixEnv(testRegex string) error {
re := regexp.MustCompile(nutanixRegex)
if !re.MatchString(testRe... | 30 |
eks-anywhere | aws | Go | package e2e
import (
"fmt"
"path/filepath"
"regexp"
"github.com/go-logr/logr"
"github.com/aws/eks-anywhere/internal/pkg/oidc"
"github.com/aws/eks-anywhere/internal/pkg/s3"
"github.com/aws/eks-anywhere/internal/pkg/ssm"
e2etests "github.com/aws/eks-anywhere/test/framework"
)
const (
openIDConfPath = "oidc/.... | 127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.