infra

package
v0.2.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NumGatewayZones is the number of managed identity zones to provision and test for gateway tests
	NumGatewayZones = 3

	// GatewayClusterNsPrefix is the prefix for cluster-scoped gateway test namespaces (one per zone)
	GatewayClusterNsPrefix = "gateway-cluster-ns"
	// GatewayClusterSaName is the service account name used in cluster-scoped gateway test namespaces
	GatewayClusterSaName = "gateway-cluster-sa"

	// GatewayNsPublic is the namespace for namespace-scoped gateway tests with public zones
	GatewayNsPublic = "gateway-wi-ns"
	// GatewayNsPrivate is the namespace for namespace-scoped gateway tests with private zones
	GatewayNsPrivate = "private-gateway-wi-ns"
	// GatewayNsSaName is the service account name used in namespace-scoped gateway test namespaces
	GatewayNsSaName = "gateway-wi-sa"

	// FilterClusterNsPrefix is the prefix for cluster-scoped filter test namespaces (one per zone)
	FilterClusterNsPrefix = "filter-cluster-ns"
	// FilterClusterSaName is the service account name used in cluster-scoped filter test namespaces
	FilterClusterSaName = "filter-cluster-sa"

	// FilterNs is the namespace for namespace-scoped filter tests
	FilterNs = "filter-ns"
	// FilterNsSaName is the service account name used in namespace-scoped filter test namespace
	FilterNsSaName = "filter-sa"
)

Variables

View Source
var Infras = infras{
	{
		Name:          "basic-cluster",
		ResourceGroup: uniqueResourceGroup(),
		Location:      getLocation(),
		Suffix:        uuid.New().String(),
	},
	{
		Name:          "private-cluster",
		ResourceGroup: uniqueResourceGroup(),
		Location:      getLocation(),
		Suffix:        uuid.New().String(),
		McOpts:        []clients.McOpt{clients.PrivateClusterOpt},
	},
	{
		Name:          "osm-cluster",
		ResourceGroup: uniqueResourceGroup(),
		Location:      getLocation(),
		Suffix:        uuid.New().String(),
		McOpts:        []clients.McOpt{clients.OsmClusterOpt, clients.VmCountOpt(8)},
	},
	{
		Name:                "gateway-full-mesh-cluster",
		ResourceGroup:       uniqueResourceGroup(),
		Location:            getLocation(),
		Suffix:              uuid.New().String()[:16],
		McOpts:              []clients.McOpt{clients.IstioServiceMeshOpt, clients.ManagedGatewayOpt},
		FederatedNamespaces: GenerateGatewayFederatedNamespaces(),
	},
	{
		Name:                "gateway-approuting-istio-cluster",
		ResourceGroup:       uniqueResourceGroup(),
		Location:            getLocation(),
		Suffix:              uuid.New().String()[:16],
		McOpts:              []clients.McOpt{clients.ManagedGatewayOpt, clients.AppRoutingIstioOpt},
		FederatedNamespaces: GenerateGatewayFederatedNamespaces(),
		PostCreate:          clients.EnableAppRoutingIstio,
	},
}

Infras is a list of infrastructure configurations the e2e tests will run against

Functions

func Deploy

func Deploy(p []Provisioned) error

func FilterClusterNsName added in v0.2.19

func FilterClusterNsName(zoneIndex int) string

FilterClusterNsName returns the namespace name for a cluster-scoped filter test at the given zone index

func GatewayClusterNsName added in v0.2.19

func GatewayClusterNsName(zoneIndex int) string

GatewayClusterNsName returns the namespace name for a cluster-scoped gateway test at the given zone index

Types

type AuthType

type AuthType string
const (
	AuthTypeManagedIdentity  AuthType = "" // MSI is the default
	AuthTypeServicePrincipal AuthType = "servicePrincipal"
)

type FederatedNamespace added in v0.2.18

type FederatedNamespace struct {
	Namespace      string
	ServiceAccount string
}

FederatedNamespace represents a namespace and service account pair to federate with the managed identity

func GenerateGatewayFederatedNamespaces added in v0.2.19

func GenerateGatewayFederatedNamespaces() []FederatedNamespace

GenerateGatewayFederatedNamespaces generates all FederatedNamespace entries needed for gateway tests

type Identifier

type Identifier interface {
	GetId() string
}

type LoadableProvisioned

type LoadableProvisioned struct {
	Name                                                                                      string
	Cluster                                                                                   azure.Resource
	ClusterLocation, ClusterDnsServiceIp, ClusterPrincipalId, ClusterClientId, ClusterOidcUrl string
	ClusterOptions                                                                            map[string]struct{}
	ManagedIdentity                                                                           azure.Resource
	ManagedIdentityClientId                                                                   string
	ManagedIdentityPrincipalId                                                                string
	ManagedIdentityZones                                                                      []withLoadableCert[LoadableZone]
	ManagedIdentityPrivateZones                                                               []withLoadableCert[azure.Resource]
	ContainerRegistry                                                                         azure.Resource
	Zones                                                                                     []withLoadableCert[LoadableZone]
	PrivateZones                                                                              []withLoadableCert[azure.Resource]
	KeyVault                                                                                  azure.Resource
	ResourceGroup                                                                             arm.ResourceID // rg id is a little weird and can't be correctly parsed by azure.Resource so we have to use arm.ResourceID
	SubscriptionId                                                                            string
	TenantId                                                                                  string
	E2eImage                                                                                  string
	OperatorImage                                                                             string
}

LoadableProvisioned is a struct that can be used to load a Provisioned struct from a file. Ensure that all fields are exported so that they can properly be serialized/deserialized.

func ToLoadable

func ToLoadable(p []Provisioned) ([]LoadableProvisioned, error)

func (LoadableProvisioned) Provisioned

func (l LoadableProvisioned) Provisioned() (Provisioned, error)

type LoadableZone

type LoadableZone struct {
	ResourceId  azure.Resource
	Nameservers []string
}

type PrivateZone

type PrivateZone interface {
	GetDnsZone(ctx context.Context) (*armprivatedns.PrivateZone, error)
	LinkVnet(ctx context.Context, linkName, vnetId string) error
	GetName() string
	Identifier
}

type Provisioned

type Provisioned struct {
	Name                        string
	Cluster                     cluster
	ContainerRegistry           containerRegistry
	ManagedIdentity             managedIdentity
	ManagedIdentityZones        []WithCert[Zone]
	ManagedIdentityPrivateZones []WithCert[PrivateZone]
	Zones                       []WithCert[Zone]
	PrivateZones                []WithCert[PrivateZone]
	KeyVault                    keyVault
	ResourceGroup               resourceGroup
	SubscriptionId              string
	TenantId                    string
	E2eImage                    string
	OperatorImage               string
}

func ToProvisioned

func ToProvisioned(l []LoadableProvisioned) ([]Provisioned, error)

func (Provisioned) Cleanup

func (p Provisioned) Cleanup(ctx context.Context) error

func (Provisioned) Deploy

func (p Provisioned) Deploy(ctx context.Context) error

func (Provisioned) Loadable

func (p Provisioned) Loadable() (LoadableProvisioned, error)

type WithCert

type WithCert[T any] struct {
	Zone T
	Cert cert
}

WithCert is a resource with a tls certificate valid for that resource. This is used to bundle DNS Zones

type Zone

type Zone interface {
	GetDnsZone(ctx context.Context) (*armdns.Zone, error)
	GetName() string
	GetNameservers() []string
	Identifier
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL