Documentation
¶
Index ¶
- Constants
- func BuildAWSCredentialKindList() []string
- func BuildAWSRegionsList(listRegionsOutput *ec2.DescribeRegionsOutput) []string
- func BuildAzureCredentialKindList() []string
- func BuildAzureResourceGroupList(groups []armresources.ResourceGroup) []string
- func BuildAzureResourceGroupLocationListAndMap(locations []armsubscriptions.Location) ([]string, map[string]armsubscriptions.Location)
- func BuildAzureSubscriptionListAndMap(subscriptions *azure.SubscriptionResult) ([]string, map[string]azure.Subscription)
- func BuildClusterList(config *api.Config) []string
- func ConfirmOptions(ctx context.Context, prompter prompt.Interface, options DisplayOptions) (bool, error)
- func EnterAWSCloudProvider(ctx context.Context, prompter prompt.Interface, out output.Interface, ...) (*aws.Provider, error)
- func EnterApplicationName(prompter prompt.Interface, chooseDefault func() (string, error)) (string, error)
- func EnterApplicationOptions(prompter prompt.Interface) (scaffold bool, name string, err error)
- func EnterAzureCloudProvider(ctx context.Context, prompter prompt.Interface, out output.Interface, ...) (*azure.Provider, error)
- func EnterAzureResourceGroupName(prompter prompt.Interface) (string, error)
- func GetAWSAccountID(ctx context.Context, prompter prompt.Interface, awsClient aws.Client) (string, error)
- func NewProgressModel(options DisplayOptions) tea.Model
- func NewSummaryModel(options DisplayOptions) tea.Model
- func SelectAWSCredentialKind(prompter prompt.Interface) (string, error)
- func SelectAWSRegion(ctx context.Context, prompter prompt.Interface, awsClient aws.Client) (string, error)
- func SelectAzureCredentialKind(prompter prompt.Interface) (string, error)
- func SelectAzureResourceGroup(ctx context.Context, prompter prompt.Interface, out output.Interface, ...) (string, error)
- func SelectAzureResourceGroupLocation(ctx context.Context, prompter prompt.Interface, azureClient azure.Client, ...) (*armsubscriptions.Location, error)
- func SelectAzureSubscription(ctx context.Context, prompter prompt.Interface, azureClient azure.Client) (*azure.Subscription, error)
- func SelectCluster(k8s kubernetes.Interface, prompter prompt.Interface, full bool) (string, error)
- func SelectExistingAzureResourceGroup(ctx context.Context, prompter prompt.Interface, azureClient azure.Client, ...) (string, error)
- func ShowProgress(ctx context.Context, prompter prompt.Interface, options DisplayOptions, ...) error
- type AWSProviderFunc
- type ApplicationDisplay
- type AzureProviderFunc
- type CloudProviderResult
- type CloudProvidersDisplay
- type ClusterDisplay
- type ClusterResult
- type DisplayOptions
- type EnvironmentDisplay
- type ProgressModel
- type ProgressMsg
- type SummaryModel
- type SummaryResult
Constants ¶
const ( ConfirmSetupApplicationPrompt = "Setup application in the current directory?" EnterApplicationNamePrompt = "Enter an application name" )
const ( SelectAWSRegionPrompt = "Select the region you would like to deploy AWS resources to:" SelectAWSCredentialKindPrompt = "Select a credential kind for the AWS credential:" EnterAWSIAMAcessKeyIDPrompt = "Enter the IAM access key id:" EnterAWSRoleARNPrompt = "Enter the role ARN:" EnterAWSRoleARNPlaceholder = "Enter IAM role ARN..." EnterAWSIAMAcessKeyIDPlaceholder = "Enter IAM access key id..." EnterAWSIAMSecretAccessKeyPrompt = "Enter your IAM Secret Access Key:" EnterAWSIAMSecretAccessKeyPlaceholder = "Enter IAM secret access key..." ErrNotEmptyTemplate = "%s cannot be empty" ConfirmAWSAccountIDPromptFmt = "Use account id '%v'?" EnterAWSAccountIDPrompt = "Enter the account ID:" EnterAWSAccountIDPlaceholder = "Enter the account ID you want to use..." AWSAccessKeysCreateInstructionFmt = "" /* 333-byte string literal not displayed */ AWSIRSACredentialKind = "IRSA" AWSAccessKeyCredentialKind = "Access Key" )
const ( ConfirmAzureSubscriptionPromptFmt = "Use subscription '%v'?" SelectAzureSubscriptionPrompt = "Select a subscription:" ConfirmAzureCreateResourceGroupPrompt = "Create a new resource group?" EnterAzureResourceGroupNamePrompt = "Enter a resource group name" EnterAzureResourceGroupNamePlaceholder = "Enter resource group name" SelectAzureResourceGroupLocationPrompt = "Select a location for the resource group:" SelectAzureResourceGroupPrompt = "Select a resource group:" SelectAzureCredentialKindPrompt = "Select a credential kind for the Azure credential:" EnterAzureServicePrincipalAppIDPrompt = "Enter the `appId` of the service principal used to create Azure resources" EnterAzureServicePrincipalAppIDPlaceholder = "Enter appId..." EnterAzureServicePrincipalPasswordPrompt = "Enter the `password` of the service principal used to create Azure resources" EnterAzureServicePrincipalPasswordPlaceholder = "Enter password..." EnterAzureServicePrincipalTenantIDPrompt = "Enter the `tenantId` of the service principal used to create Azure resources" EnterAzureServicePrincipalTenantIDPlaceholder = "Enter tenantId..." EnterAzureWorkloadIdentityAppIDPrompt = "Enter the `appId` of the Entra ID Application" EnterAzureWorkloadIdentityAppIDPlaceholder = "Enter appId..." EnterAzureWorkloadIdentityTenantIDPrompt = "Enter the `tenantId` of the Entra ID Application" EnterAzureWorkloadIdentityTenantIDPlaceholder = "Enter tenantId..." AzureWorkloadIdentityCreateInstructionsFmt = "" /* 184-byte string literal not displayed */ AzureServicePrincipalCreateInstructionsFmt = "" /* 447-byte string literal not displayed */ AzureServicePrincipalCredentialKind = "Service Principal" AzureWorkloadIdenityCredentialKind = "Workload Identity" )
const ( ConfirmCloudProviderPrompt = "Add cloud providers for cloud resources?" ConfirmCloudProviderAdditionalPrompt = "Add additional cloud providers for cloud resources?" SelectCloudProviderPrompt = "Select your cloud provider" )
const ( SummaryIndent = " - " SummaryHeading = "You've selected the following:\n\n" SummaryKubernetesHeadingIcon = "🔧 " SummaryKubernetesInstallHeadingFmt = "Install Radius %s\n" + SummaryIndent + "Kubernetes cluster: %s\n" + SummaryIndent + "Kubernetes namespace: %s\n" SummaryKubernetesInstallAWSCloudProviderFmt = SummaryIndent + "AWS credential: %s\n" SummaryKubernetesInstallAzureCloudProviderFmt = SummaryIndent + "Azure credential: %s\n" SummaryKubernetesExistingHeadingFmt = "Use existing Radius %s install on %s\n" SummaryEnvironmentHeadingIcon = "🌏 " SummaryEnvironmentCreateHeadingFmt = "Create new environment %s\n" + SummaryIndent + "Kubernetes namespace: %s\n" SummaryEnvironmentCreateAWSCloudProviderFmt = SummaryIndent + "AWS: account %s and region %s\n" SummaryEnvironmentCreateAzureCloudProviderFmt = SummaryIndent + "Azure: subscription %s and resource group %s\n" SummaryEnvironmentCreateRecipePackyFmt = SummaryIndent + "Recipe pack: %s\n" SummaryEnvironmentExistingHeadingFmt = "Use existing environment %s\n" SummaryApplicationHeadingIcon = "🚧 " SummaryApplicationScaffoldHeadingFmt = "Scaffold application %s\n" SummaryApplicationScaffoldFile = SummaryIndent + "Create %s\n" SummaryConfigurationHeadingIcon = "📋 " SummaryConfigurationUpdateHeading = "Update local configuration\n" ProgressHeading = "Initializing Radius. This may take a minute or two...\n\n" ProgressStepCompleteIcon = "✅ " ProgressStepWaitingIcon = "⏳ " )
Display constants used to render the summary and progress views shown by `rad init` (and its preview variant).
const (
SelectClusterPrompt = "Select the kubeconfig context to install Radius into"
)
Variables ¶
This section is empty.
Functions ¶
func BuildAWSCredentialKindList ¶
func BuildAWSCredentialKindList() []string
BuildAWSCredentialKindList returns the list of supported AWS credential kinds.
func BuildAWSRegionsList ¶
func BuildAWSRegionsList(listRegionsOutput *ec2.DescribeRegionsOutput) []string
BuildAWSRegionsList extracts region names from the AWS DescribeRegions output.
func BuildAzureCredentialKindList ¶
func BuildAzureCredentialKindList() []string
BuildAzureCredentialKindList returns the list of supported Azure credential kinds.
func BuildAzureResourceGroupList ¶
func BuildAzureResourceGroupList(groups []armresources.ResourceGroup) []string
BuildAzureResourceGroupList builds a sorted list of resource group names.
func BuildAzureResourceGroupLocationListAndMap ¶
func BuildAzureResourceGroupLocationListAndMap(locations []armsubscriptions.Location) ([]string, map[string]armsubscriptions.Location)
BuildAzureResourceGroupLocationListAndMap builds a sorted list of location display names and a map of display name => location.
func BuildAzureSubscriptionListAndMap ¶
func BuildAzureSubscriptionListAndMap(subscriptions *azure.SubscriptionResult) ([]string, map[string]azure.Subscription)
BuildAzureSubscriptionListAndMap builds a list of subscription names and a map of name => subscription for use by the prompt.
func BuildClusterList ¶
BuildClusterList builds a sorted list of cluster contexts with the current context first.
func ConfirmOptions ¶
func ConfirmOptions(ctx context.Context, prompter prompt.Interface, options DisplayOptions) (bool, error)
ConfirmOptions shows a summary of the user's selections and prompts for confirmation.
func EnterAWSCloudProvider ¶
func EnterAWSCloudProvider(ctx context.Context, prompter prompt.Interface, out output.Interface, awsClient aws.Client) (*aws.Provider, error)
EnterAWSCloudProvider prompts the user for AWS cloud provider configuration. The caller is responsible for any post-processing such as enabling IRSA Helm values based on the returned provider's CredentialKind.
func EnterApplicationName ¶
func EnterApplicationName(prompter prompt.Interface, chooseDefault func() (string, error)) (string, error)
EnterApplicationName returns the application name based on the chooseDefault function. If the value returned by chooseDefault is not a valid application name, the user will be prompted.
func EnterApplicationOptions ¶
EnterApplicationOptions prompts the user to scaffold an application and returns the scaffold flag and app name.
func EnterAzureCloudProvider ¶
func EnterAzureCloudProvider(ctx context.Context, prompter prompt.Interface, out output.Interface, azureClient azure.Client) (*azure.Provider, error)
EnterAzureCloudProvider prompts the user for Azure cloud provider configuration. The caller is responsible for any post-processing such as enabling workload identity Helm values based on the returned provider's CredentialKind.
func EnterAzureResourceGroupName ¶
EnterAzureResourceGroupName prompts the user for a resource group name.
func GetAWSAccountID ¶
func GetAWSAccountID(ctx context.Context, prompter prompt.Interface, awsClient aws.Client) (string, error)
GetAWSAccountID retrieves the AWS account ID via the configured AWS client and optionally allows the user to override it.
func NewProgressModel ¶
func NewProgressModel(options DisplayOptions) tea.Model
NewProgressModel creates a new model for the initialization progress dialog shown during 'rad init'.
func NewSummaryModel ¶
func NewSummaryModel(options DisplayOptions) tea.Model
NewSummaryModel creates a new model for the options summary shown during 'rad init'.
func SelectAWSCredentialKind ¶
SelectAWSCredentialKind prompts the user to select an AWS credential kind.
func SelectAWSRegion ¶
func SelectAWSRegion(ctx context.Context, prompter prompt.Interface, awsClient aws.Client) (string, error)
SelectAWSRegion prompts the user to select an AWS region from the list of regions available to the configured AWS account.
func SelectAzureCredentialKind ¶
SelectAzureCredentialKind prompts the user to select an Azure credential kind.
func SelectAzureResourceGroup ¶
func SelectAzureResourceGroup(ctx context.Context, prompter prompt.Interface, out output.Interface, azureClient azure.Client, subscription azure.Subscription) (string, error)
SelectAzureResourceGroup either creates a new resource group or prompts the user to choose an existing one.
func SelectAzureResourceGroupLocation ¶
func SelectAzureResourceGroupLocation(ctx context.Context, prompter prompt.Interface, azureClient azure.Client, subscription azure.Subscription) (*armsubscriptions.Location, error)
SelectAzureResourceGroupLocation prompts the user to pick a location for a new resource group.
func SelectAzureSubscription ¶
func SelectAzureSubscription(ctx context.Context, prompter prompt.Interface, azureClient azure.Client) (*azure.Subscription, error)
SelectAzureSubscription prompts the user to select an Azure subscription. If a default subscription is configured the user is asked whether to use it.
func SelectCluster ¶
SelectCluster selects a kube context. If full is false, the current context is used automatically.
func SelectExistingAzureResourceGroup ¶
func SelectExistingAzureResourceGroup(ctx context.Context, prompter prompt.Interface, azureClient azure.Client, subscription azure.Subscription) (string, error)
SelectExistingAzureResourceGroup prompts the user to pick from existing resource groups in the given subscription.
func ShowProgress ¶
func ShowProgress(ctx context.Context, prompter prompt.Interface, options DisplayOptions, progressChan <-chan ProgressMsg) error
ShowProgress shows an updating progress display while the user's selections are being applied.
This function should be called from a goroutine while installation proceeds in the background. Progress updates are received on progressChan; the loop also exits when ctx is canceled.
Types ¶
type AWSProviderFunc ¶
AWSProviderFunc is a callback to gather AWS provider config.
type ApplicationDisplay ¶
type ApplicationDisplay struct {
Scaffold bool
Name string
// ScaffoldFiles are the files to list under the scaffold application heading.
ScaffoldFiles []string
}
ApplicationDisplay holds the application fields rendered by the summary and progress views.
type AzureProviderFunc ¶
AzureProviderFunc is a callback to gather Azure provider config.
type CloudProviderResult ¶
CloudProviderResult holds the results of gathering cloud provider options.
func EnterCloudProviderOptions ¶
func EnterCloudProviderOptions(prompter prompt.Interface, full bool, environmentCreate bool, enterAzure AzureProviderFunc, enterAWS AWSProviderFunc) (CloudProviderResult, error)
EnterCloudProviderOptions prompts the user to add cloud providers. If full is false or environmentCreate is false, it returns immediately with no providers.
type CloudProvidersDisplay ¶
CloudProvidersDisplay holds the cloud provider fields rendered by the summary and progress views.
type ClusterDisplay ¶
ClusterDisplay holds the cluster fields rendered by the summary and progress views.
type ClusterResult ¶
ClusterResult holds the results of gathering cluster options.
func EnterClusterOptions ¶
func EnterClusterOptions(k8s kubernetes.Interface, helmClient helm.Interface, prompter prompt.Interface, full bool) (ClusterResult, error)
EnterClusterOptions gathers cluster options by selecting a kube context and checking Radius install state.
type DisplayOptions ¶
type DisplayOptions struct {
Cluster ClusterDisplay
Environment EnvironmentDisplay
CloudProviders CloudProvidersDisplay
Application ApplicationDisplay
// RecipePackLabel is the label of the recipe pack to display in the summary.
// An empty value omits the recipe pack line entirely.
RecipePackLabel string
}
DisplayOptions is the data model rendered by the summary and progress views.
Callers convert their package-specific options struct into a DisplayOptions before invoking ConfirmOptions or ShowProgress.
type EnvironmentDisplay ¶
EnvironmentDisplay holds the environment fields rendered by the summary and progress views.
type ProgressModel ¶
type ProgressModel struct {
Options DisplayOptions
Progress ProgressMsg
// SuppressSpinner is used to suppress the ticking of the spinner for testing.
SuppressSpinner bool
// contains filtered or unexported fields
}
ProgressModel is the bubble tea model for the progress display shown during 'rad init'.
func (*ProgressModel) Update ¶
Update implements tea.Model. It updates the model state on progress updates and spinner ticks.
func (*ProgressModel) View ¶
func (m *ProgressModel) View() string
View implements tea.Model. It renders the progress of the initialization steps.
type ProgressMsg ¶
type ProgressMsg struct {
InstallComplete bool
EnvironmentComplete bool
ApplicationComplete bool
ConfigComplete bool
}
ProgressMsg is a message sent to the progress display to update the status of the installation.
type SummaryModel ¶
type SummaryModel struct {
Result SummaryResult
Options DisplayOptions
// contains filtered or unexported fields
}
SummaryModel is the bubble tea model for the options summary shown during 'rad init'.
func (*SummaryModel) Update ¶
Update implements tea.Model. Pressing Ctrl+C quits, Esc cancels, and Enter confirms.
func (*SummaryModel) View ¶
func (m *SummaryModel) View() string
View implements tea.Model. It renders the summary of selected options.
type SummaryResult ¶
type SummaryResult string
SummaryResult represents the user's choice on the summary screen.
const ( ResultConfirmed SummaryResult = "confirmed" ResultCanceled SummaryResult = "canceled" ResultQuit SummaryResult = "quit" )