Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyMigrations(ctx context.Context, targetVersion int, latest, waitForCompletion bool) error
- func CreateOrUpdateAppByUri(ctx context.Context, cred azcore.TokenCredential, app aadApp) (objectId string, err error)
- func CreateServicePrincipal(ctx context.Context, cred azcore.TokenCredential, appId string) (string, error)
- func CreateStorageAccount(ctx context.Context, storageAccountConfig *StorageAccountConfig, ...) (any, error)
- func GetAppByUri(ctx context.Context, cred azcore.TokenCredential, uri string) (aadApp, error)
- func GetAzureCredentialFromContext(ctx context.Context) azcore.TokenCredential
- func GetChartSpec(helmChartConfig *HelmChartConfig, helmClient helmclient.Client, ...) (helmclient.ChartSpec, error)
- func GetDefaultApiVersionForResource(ctx context.Context, resourceId string, ...) (string, error)
- func GetDomainNameRegex(location string) *regexp.Regexp
- func GetDomainNameSuffix(location string) string
- func GetGraphToken(ctx context.Context, cred azcore.TokenCredential) (azcore.AccessToken, error)
- func GetMigrationLogs(ctx context.Context, id int, destination io.Writer) error
- func GetServicePrincipalByAppId(ctx context.Context, cred azcore.TokenCredential, appId string) (string, error)
- func GetServicePrincipalDisplayName(ctx context.Context, cred azcore.TokenCredential, objectId string) (string, error)
- func GetSubscriptionId(ctx context.Context, subName string, cred azcore.TokenCredential) (string, error)
- func GetUserPrincipalName(ctx context.Context, cred azcore.TokenCredential, objectId string) (string, error)
- func GetUserRESTConfig(ctx context.Context) (*rest.Config, error)
- func InstallCloud(ctx context.Context) (err error)
- func InstallIdentities(ctx context.Context, cred azcore.TokenCredential) error
- func InstallTyger(ctx context.Context) error
- func InstallTygerHelmChart(ctx context.Context, restConfig *rest.Config, dryRun bool) (manifest string, valuesYaml string, err error)
- func NewMiAwareAzureCLICredential(options *azidentity.AzureCLICredentialOptions) (azcore.TokenCredential, error)
- func PodExec(ctx context.Context, podName string, command ...string) (stdout *bytes.Buffer, stderr *bytes.Buffer, err error)
- func Ptr[T any](t T) *T
- func QuickValidateEnvironmentConfig(config *EnvironmentConfig) bool
- func RandomAlphanumString(n int) string
- func RenderConfig(templateValues ConfigTemplateValues, writer io.Writer) error
- func SetAzureCredentialOnContext(ctx context.Context, cred azcore.TokenCredential) context.Context
- func SetConfigOnContext(ctx context.Context, config *EnvironmentConfig) context.Context
- func UninstallCloud(ctx context.Context) (err error)
- func UninstallTyger(ctx context.Context) error
- func WaitForPoller[T any](ctx context.Context, promise *Promise[*runtime.Poller[T]]) (T, error)
- type AksPrincipal
- type ApiConfig
- type AuthConfig
- type CloudConfig
- type ClusterConfig
- type ComputeConfig
- type ConfigTemplateValues
- type DatabaseConfig
- type DatabaseVersion
- type EnvironmentConfig
- type FirewallRule
- type HelmChartConfig
- type HelmConfig
- type NamedAzureResource
- type NodePoolConfig
- type Principal
- type PrincipalKind
- type Promise
- type PromiseGroup
- type StorageAccountConfig
- type StorageConfig
- type UntypedPromise
Constants ¶
View Source
const ( DefaultDatabaseComputeTier = armpostgresqlflexibleservers.SKUTierBurstable DefaultDatabaseVMSize = "Standard_B1ms" DefaultPostgresMajorVersion = 16 DefaultInitialDatabaseSizeGb = 32 DefaultBackupRetentionDays = 7 )
View Source
const ( TygerNamespace = "tyger" DefaultTygerReleaseName = TygerNamespace )
View Source
const DefaultKubernetesVersion = "1.27" // LTS
View Source
const (
TagKey = "tyger-environment"
)
Variables ¶
View Source
var ( ResourceNameRegex = regexp.MustCompile(`^[a-z][a-z\-0-9]{1,23}$`) StorageAccountNameRegex = regexp.MustCompile(`^[a-z0-9]{3,24}$`) SubdomainRegex = regexp.MustCompile(`^[a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$`) DatabaseServerNameRegex = regexp.MustCompile(`^([a-z0-9](?:[a-z0-9\-]{1,61}[a-z0-9])?)?$`) )
View Source
var (
ErrAlreadyLoggedError = errors.New("already logged error")
)
View Source
var (
ErrNotLoggedIn = errors.New("You must run `az login` before running this command")
)
Functions ¶
func ApplyMigrations ¶
func CreateOrUpdateAppByUri ¶
func CreateServicePrincipal ¶
func CreateStorageAccount ¶
func GetAppByUri ¶
func GetAzureCredentialFromContext ¶
func GetAzureCredentialFromContext(ctx context.Context) azcore.TokenCredential
func GetChartSpec ¶
func GetChartSpec( helmChartConfig *HelmChartConfig, helmClient helmclient.Client, overrideHelmChartConfig *HelmChartConfig, customizeSpec ...func(*helmclient.ChartSpec, helmclient.Client) error, ) (helmclient.ChartSpec, error)
func GetDefaultApiVersionForResource ¶
func GetDefaultApiVersionForResource(ctx context.Context, resourceId string, providersClient *armresources.ProvidersClient) (string, error)
func GetDomainNameRegex ¶
func GetDomainNameSuffix ¶
func GetGraphToken ¶
func GetGraphToken(ctx context.Context, cred azcore.TokenCredential) (azcore.AccessToken, error)
func GetMigrationLogs ¶
func GetSubscriptionId ¶
func GetUserPrincipalName ¶
func InstallCloud ¶
func InstallIdentities ¶
func InstallIdentities(ctx context.Context, cred azcore.TokenCredential) error
func InstallTyger ¶
func InstallTygerHelmChart ¶
func NewMiAwareAzureCLICredential ¶
func NewMiAwareAzureCLICredential(options *azidentity.AzureCLICredentialOptions) (azcore.TokenCredential, error)
az account get-access-token fails if --tenant is provided and the user is logged in with a managed identity This creates a TokenProvider that works around this case
func QuickValidateEnvironmentConfig ¶
func QuickValidateEnvironmentConfig(config *EnvironmentConfig) bool
func RandomAlphanumString ¶
func RenderConfig ¶
func RenderConfig(templateValues ConfigTemplateValues, writer io.Writer) error
func SetConfigOnContext ¶
func SetConfigOnContext(ctx context.Context, config *EnvironmentConfig) context.Context
func UninstallCloud ¶
func UninstallTyger ¶
Types ¶
type AksPrincipal ¶
type AksPrincipal struct { Kind PrincipalKind `json:"kind"` Id string `json:"id"` }
type ApiConfig ¶
type ApiConfig struct { DomainName string `json:"domainName"` Auth *AuthConfig `json:"auth"` Helm *HelmConfig `json:"helm"` }
type AuthConfig ¶
type CloudConfig ¶
type CloudConfig struct { TenantID string `json:"tenantId"` SubscriptionID string `json:"subscriptionId"` DefaultLocation string `json:"defaultLocation"` ResourceGroup string `json:"resourceGroup"` Compute *ComputeConfig `json:"compute"` Storage *StorageConfig `json:"storage"` DatabaseConfig *DatabaseConfig `json:"database"` LogAnalyticsWorkspace *NamedAzureResource `json:"logAnalyticsWorkspace"` }
type ClusterConfig ¶
type ClusterConfig struct { Name string `json:"name"` ApiHost bool `json:"apiHost"` Location string `json:"location"` KubernetesVersion string `json:"kubernetesVersion,omitempty"` UserNodePools []*NodePoolConfig `json:"userNodePools"` LocalDevelopmentIdentityId string `json:"localDevelopmentIdentityId"` // undocumented - for local development only }
type ComputeConfig ¶
type ComputeConfig struct { Clusters []*ClusterConfig `json:"clusters"` ManagementPrincipals []AksPrincipal `apjson:"managementPrincipals"` PrivateContainerRegistries []string `json:"privateContainerRegistries"` }
func (*ComputeConfig) GetApiHostCluster ¶
func (c *ComputeConfig) GetApiHostCluster() *ClusterConfig
type ConfigTemplateValues ¶
type ConfigTemplateValues struct { EnvironmentName string ResourceGroup string TenantId string SubscriptionId string DefaultLocation string KubernetesVersion string PrincipalId string PrincipalDisplay string PrincipalKind PrincipalKind DatabaseServerName string PostgresMajorVersion int BufferStorageAccountName string LogsStorageAccountName string DomainName string ApiTenantId string CurrentIpAddress string CpuNodePoolMinCount int GpuNodePoolMinCount int }
type DatabaseConfig ¶
type DatabaseConfig struct { ServerName string `json:"serverName"` Location string `json:"location"` ComputeTier string `json:"computeTier"` VMSize string `json:"vmSize"` FirewallRules []*FirewallRule `json:"firewallRules,omitempty"` PostgresMajorVersion int `json:"postgresMajorVersion"` StorageSizeGB int `json:"storageSizeGB"` BackupRetentionDays int `json:"backupRetentionDays"` BackupGeoRedundancy bool `json:"backupGeoRedundancy"` }
type DatabaseVersion ¶
type DatabaseVersion struct { Id int `json:"id"` Description string `json:"description"` State string `json:"state"` }
func ListDatabaseVersions ¶
func ListDatabaseVersions(ctx context.Context, allVersions bool) ([]DatabaseVersion, error)
type EnvironmentConfig ¶
type EnvironmentConfig struct { EnvironmentName string `json:"environmentName"` Cloud *CloudConfig `json:"cloud"` Api *ApiConfig `json:"api"` }
func GetConfigFromContext ¶
func GetConfigFromContext(ctx context.Context) *EnvironmentConfig
type FirewallRule ¶
type HelmChartConfig ¶
type HelmConfig ¶
type HelmConfig struct { Tyger *HelmChartConfig `json:"tyger"` Traefik *HelmChartConfig `json:"traefik"` CertManager *HelmChartConfig `json:"certManager"` NvidiaDevicePlugin *HelmChartConfig `json:"nvidiaDevicePlugin"` }
type NamedAzureResource ¶
type NodePoolConfig ¶
type Principal ¶
type Principal struct { ObjectId string `json:"objectId"` Kind PrincipalKind `json:"kind"` }
func ObjectsIdToPrincipals ¶
type PrincipalKind ¶
type PrincipalKind string
const ( PrincipalKindUser PrincipalKind = "User" PrincipalKindGroup PrincipalKind = "Group" PrincipalKindServicePrincipal PrincipalKind = "ServicePrincipal" )
type Promise ¶
type Promise[T any] struct { // contains filtered or unexported fields }
func NewPromise ¶
func NewPromiseAfter ¶
func NewPromiseAfter[T any](ctx context.Context, group *PromiseGroup, function func(context.Context) (T, error), dependencies ...UntypedPromise) *Promise[T]
type PromiseGroup ¶
type PromiseGroup []UntypedPromise
type StorageAccountConfig ¶
type StorageConfig ¶
type StorageConfig struct { Buffers []*StorageAccountConfig `json:"buffers"` Logs *StorageAccountConfig `json:"logs"` }
type UntypedPromise ¶
type UntypedPromise interface {
AwaitErr() error
}
Click to show internal directories.
Click to hide internal directories.