profilehandler

package
v1.2.47-rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClusterByProfile

func CreateClusterByProfile(profile *Profile,
	client *rosacli.Client,
	waitForClusterReady bool) (*rosacli.ClusterDescription, error)

func CreateClusterByProfileWithoutWaiting added in v1.2.41

func CreateClusterByProfileWithoutWaiting(
	profile *Profile,
	client *rosacli.Client) (*rosacli.ClusterDescription, error)

func DeleteAdditionalPrincipalsRole added in v1.2.43

func DeleteAdditionalPrincipalsRole(additionalPrincipalRoleName string,
	managedPolicy bool, region string,
	awsSharedCredentialFile string) error

func DeleteAuditLogRoleArn added in v1.2.40

func DeleteAuditLogRoleArn(arn string, region string) error

func DeleteHostedZone added in v1.2.43

func DeleteHostedZone(hostedZoneID string, region string, awsSharedCredentialFile string) error

func DeleteResourceShare added in v1.2.43

func DeleteResourceShare(resourceShareArn string, region string, awsSharedCredentialFile string) error

func DeleteSharedVPCChain added in v1.2.43

func DeleteSharedVPCChain(vpcID string, region string, awsSharedCredentialFile string) error

func DeleteSharedVPCRole added in v1.2.43

func DeleteSharedVPCRole(sharedVPCRoleName string, managedPolicy bool, region string,
	awsSharedCredentialFile string) error

func DeleteVPCChain added in v1.2.40

func DeleteVPCChain(vpcID string, region string) error

func DestroyPreparedUserData added in v1.2.40

func DestroyPreparedUserData(client *rosacli.Client, clusterID string, region string, isSTS bool,
	isSharedVPC bool, isAdditionalPrincipalAllowed bool) []error

func DestroyResourceByProfile added in v1.2.40

func DestroyResourceByProfile(profile *Profile, client *rosacli.Client) (errors [][]error)

func ElaborateKMSKeyForSTSCluster added in v1.2.40

func ElaborateKMSKeyForSTSCluster(client *rosacli.Client, cluster string, etcdKMS bool) error

func GenerateAccountRoleCreationFlag

func GenerateAccountRoleCreationFlag(client *rosacli.Client,
	namePrefix string,
	hcp bool,
	openshiftVersion string,
	channelGroup string,
	path string,
	permissionsBoundary string) []string

GenerateAccountRoleCreationFlag will generate account role creation flags

func GenerateClusterCreateFlags

func GenerateClusterCreateFlags(profile *Profile, client *rosacli.Client) ([]string, error)

GenerateClusterCreateFlags will generate cluster creation flags

func GetYAMLProfilesDir

func GetYAMLProfilesDir() string

func ParseProfiles

func ParseProfiles(profilesDir string) map[string]*Profile

func ParseProfilesByFile added in v1.2.40

func ParseProfilesByFile(profileLocation string) map[string]*Profile

func PrepareAccountRoles

func PrepareAccountRoles(client *rosacli.Client,
	namePrefix string,
	hcp bool,
	openshiftVersion string,
	channelGroup string,
	path string,
	permissionsBoundary string) (
	accRoles *rosacli.AccountRolesUnit, err error)

PrepareAccountRoles will prepare account roles according to the parameters openshiftVersion must follow 4.15.2-x format

func PrepareAdditionalPrincipalsRole added in v1.2.43

func PrepareAdditionalPrincipalsRole(roleName string, installerRoleArn string,
	region string, awsSharedCredentialFile string) (string, error)

func PrepareAdditionalSecurityGroups added in v1.2.40

func PrepareAdditionalSecurityGroups(vpcClient *vpc_client.VPC,
	securityGroupCount int,
	namePrefix string) ([]string, error)

func PrepareAdminUser

func PrepareAdminUser() (string, string)

func PrepareAuditlogRoleArnByIssuer added in v1.2.40

func PrepareAuditlogRoleArnByIssuer(auditLogRoleName string, oidcIssuerURL string, region string) (string, error)

func PrepareAuditlogRoleArnByOIDCConfig added in v1.2.40

func PrepareAuditlogRoleArnByOIDCConfig(client *rosacli.Client,
	auditLogRoleName string,
	oidcConfigID string,
	region string) (string, error)

func PrepareDNSDomain added in v1.2.43

func PrepareDNSDomain(client *rosacli.Client) (string, error)

func PrepareHostedZone added in v1.2.43

func PrepareHostedZone(clusterName string, dnsDomain string, vpcID string, region string, private bool,
	awsSharedCredentialFile string) (string, error)

func PrepareKMSKey added in v1.2.40

func PrepareKMSKey(region string, multiRegion bool, testClient string, hcp bool, etcdKMS bool) (string, error)

func PrepareOIDCConfig

func PrepareOIDCConfig(client *rosacli.Client,
	oidcConfigType string,
	region string,
	roleArn string,
	prefix string) (string, error)

PrepareOIDCConfig will prepare the oidc config for the cluster, if the oidcConfigType="managed", roleArn and prefix won't be set

func PrepareOIDCProvider

func PrepareOIDCProvider(client *rosacli.Client, oidcConfigID string) error

func PrepareOIDCProviderByCluster

func PrepareOIDCProviderByCluster(client *rosacli.Client, cluster string) error

func PrepareOperatorRolesByCluster

func PrepareOperatorRolesByCluster(client *rosacli.Client, cluster string) error

func PrepareOperatorRolesByOIDCConfig

func PrepareOperatorRolesByOIDCConfig(client *rosacli.Client,
	namePrefix string,
	oidcConfigID string,
	roleArn string,
	sharedVPCRoleArn string,
	hcp bool, channelGroup string) error

PrepareOperatorRolesByOIDCConfig will prepare operator roles with OIDC config ID When sharedVPCRoleArn is not empty it will be set to the flag

func PreparePrefix

func PreparePrefix(profilePrefix string, nameLength int) string

PrepareNames will generate the name for cluster creation if longname is set, it will generate the long name with constants.DefaultLongClusterNamelength

func PrepareResourceShare added in v1.2.43

func PrepareResourceShare(resourceShareName string, resourceArns []string, region string,
	awsSharedCredentialFile string) (string, error)

func PrepareSharedVPCRole added in v1.2.43

func PrepareSharedVPCRole(sharedVPCRolePrefix string, installerRoleArn string, ingressOperatorRoleArn string,
	region string, awsSharedCredentialFile string) (string, string, error)

func PrepareSubnetArns added in v1.2.43

func PrepareSubnetArns(subnetIDs string, region string, awsSharedCredentialFile string) ([]string, error)

func PrepareSubnets added in v1.2.40

func PrepareSubnets(vpcClient *vpc_client.VPC, region string,
	zones []string, multiZone bool) (map[string][]string, error)

PrepareSubnets will prepare pair of subnets according to the vpcID and zones if zones are empty list it will list the zones and pick according to multi-zone parameter. when multi-zone=true, 3 zones will be pickup

func PrepareVPC added in v1.2.40

func PrepareVPC(region string, vpcName string, cidrValue string,
	awsSharedCredentialFile string) (*vpc_client.VPC, error)

PrepareVPC will prepare a single vpc

func PrepareVersion

func PrepareVersion(client *rosacli.Client, versionRequirement string, channelGroup string, hcp bool) (
	*rosacli.OpenShiftVersionTableOutput, error)

func RecordClusterInstallationLog

func RecordClusterInstallationLog(client *rosacli.Client, cluster string) error

func RecordUserDataInfo added in v1.2.41

func RecordUserDataInfo(filePath string, key string, value string) error

func ReverifyClusterNetwork

func ReverifyClusterNetwork(client *rosacli.Client, clusterID string) error

func ScheduleKMSDesiable added in v1.2.40

func ScheduleKMSDesiable(kmsKey string, region string) error

func WaitForClusterPassWaiting added in v1.2.41

func WaitForClusterPassWaiting(client *rosacli.Client, cluster string, timeoutMin int) error

func WaitForClusterReady

func WaitForClusterReady(client *rosacli.Client, cluster string, timeoutMin int) error

func WaitForClusterUninstalled added in v1.2.40

func WaitForClusterUninstalled(client *rosacli.Client, cluster string, timeoutMin int) error

Types

type AccountRoleConfig

type AccountRoleConfig struct {
	Path               string `yaml:"path,omitempty"`
	PermissionBoundary string `yaml:"permission_boundary,omitempty"`
}

AccountRoleConfig will map the configuration of account roles from profile settings

type ClusterConfig

type ClusterConfig struct {
	BillingAccount                string `yaml:"billing_account,omitempty" json:"billing_account,omitempty"`
	Ec2MetadataHttpTokens         string `yaml:"imdsv2,omitempty" json:"imdsv2,omitempty"`
	InstanceType                  string `yaml:"instance_type,omitempty" json:"instance_type,omitempty"`
	Name                          string `yaml:"name,omitempty" json:"name,omitempty"`
	OIDCConfig                    string `yaml:"oidc_config,omitempty" json:"oidc_config,omitempty"`
	ProvisionShard                string `yaml:"provision_shard,omitempty" json:"provision_shard,omitempty"`
	Zones                         string `yaml:"zones,omitempty" json:"zones,omitempty"`
	AdditionalSGNumber            int    `yaml:"additional_sg_number,omitempty" json:"additional_sg_number,omitempty"`
	ExpirationTime                int    `yaml:"expiration_time,omitempty" json:"expiration_time,omitempty"`
	NameLegnth                    int    `default:"15" yaml:"name_length,omitempty" json:"name_length,omitempty"`
	VolumeSize                    int    `yaml:"volume_size,omitempty" json:"volume_size,omitempty"`
	WorkerPoolReplicas            int    `yaml:"replicas,omitempty" json:"replicas,omitempty"`
	AdditionalPrincipals          bool   `yaml:"additional_principals,omitempty" json:"additional_principals,omitempty"`
	AdminEnabled                  bool   `yaml:"admin_enabled,omitempty" json:"admin_enabled,omitempty"`
	AuditLogForward               bool   `yaml:"auditlog_forward,omitempty" json:"auditlog_forward,omitempty"`
	Autoscale                     bool   `yaml:"autoscale,omitempty" json:"autoscale,omitempty"`
	AutoscalerEnabled             bool   `yaml:"autoscaler_enabled,omitempty" json:"autoscaler_enabled,omitempty"`
	BYOVPC                        bool   `yaml:"byo_vpc,omitempty" json:"byo_vpc,omitempty"`
	DomainPrefixEnabled           bool   `yaml:"domain_prefix_enabled,omitempty" json:"domain_prefix_enabled,omitempty"`
	DisableUserWorKloadMonitoring bool   `yaml:"disable_uwm,omitempty" json:"disable_uwm,omitempty"`
	DisableSCPChecks              bool   `yaml:"disable_scp_checks,omitempty" json:"disable_scp_checks,omitempty"`
	ExternalAuthConfig            bool   `yaml:"external_auth_config,omitempty" json:"external_auth_config,omitempty"`
	EtcdEncryption                bool   `yaml:"etcd_encryption,omitempty" json:"etcd_encryption,omitempty"`
	EtcdKMS                       bool   `yaml:"etcd_kms,omitempty" json:"etcd_kms,omitempty"`
	FIPS                          bool   `yaml:"fips,omitempty" json:"fips,omitempty"`
	HCP                           bool   `yaml:"hcp,omitempty" json:"hypershift,omitempty"`
	IngressCustomized             bool   `yaml:"ingress_customized,omitempty" json:"ingress_customized,omitempty"`
	KMSKey                        bool   `yaml:"kms_key,omitempty" json:"kms_key,omitempty"`
	LabelEnabled                  bool   `yaml:"label_enabled,omitempty" json:"label_enabled,omitempty"`
	MultiAZ                       bool   `yaml:"multi_az,omitempty" json:"multi_az,omitempty"`
	NetworkingSet                 bool   `yaml:"networking,omitempty" json:"networking,omitempty"`
	PrivateLink                   bool   `yaml:"private_link,omitempty" json:"private_link,omitempty"`
	Private                       bool   `yaml:"private,omitempty" json:"private,omitempty"`
	ProxyEnabled                  bool   `yaml:"proxy_enabled,omitempty" json:"proxy_enabled,omitempty"`
	STS                           bool   `yaml:"sts,omitempty" json:"sts,omitempty"`
	SharedVPC                     bool   `yaml:"shared_vpc,omitempty" json:"shared_vpc,omitempty"`
	TagEnabled                    bool   `yaml:"tag_enabled,omitempty" json:"tag_enabled,omitempty"`
	NetworkType                   string `yaml:"network_type,omitempty" json:"network_type,omitempty"`
	RegistriesConfig              bool   `yaml:"registries_config" json:"registries_config,omitempty"`
	AllowedRegistries             bool   `yaml:"allowed_registries" json:"allowed_registries,omitempty"`
	BlockedRegistries             bool   `yaml:"blocked_registries" json:"blocked_registries,omitempty"`
}

ClusterConfig will map the clsuter configuration from profile settings

type ClusterDetail

type ClusterDetail struct {
	APIURL           string   `json:"api_url,omitempty"`
	ClusterID        string   `json:"cluster_id,omitempty"`
	ClusterName      string   `json:"cluster_name,omitempty"`
	ClusterType      string   `json:"cluster_type,omitempty"`
	ConsoleURL       string   `json:"console_url,omitempty"`
	InfraID          string   `json:"infra_id,omitempty"`
	OIDCEndpointURL  string   `json:"oidc_endpoint_url,omitempty"`
	OperatorRoleArns []string `json:"operator_role_arn,omitempty"`
}

ClusterDetail will record basic cluster info to support other team's testing

func DestroyCluster added in v1.2.40

func DestroyCluster(client *rosacli.Client) (*ClusterDetail, []error)

func ParserClusterDetail added in v1.2.40

func ParserClusterDetail() (*ClusterDetail, error)

ParserClusterDetail Get the cluster info from cluster-detail.json file

type Profile

type Profile struct {
	ChannelGroup      string             `yaml:"channel_group,omitempty"`
	Name              string             `yaml:"as,omitempty"`
	NamePrefix        string             `yaml:"name_prefix,omitempty"`
	Region            string             `yaml:"region,omitempty"`
	Version           string             `yaml:"version,omitempty"`
	AccountRoleConfig *AccountRoleConfig `yaml:"account-role,omitempty"`
	ClusterConfig     *ClusterConfig     `yaml:"cluster,omitempty"`
}

Profile will map the profile settings from the profile yaml file

func GetProfile

func GetProfile(profileName string, profilesDir string) *Profile

func LoadProfileYamlFile

func LoadProfileYamlFile(profileName string) *Profile

func LoadProfileYamlFileByENV

func LoadProfileYamlFileByENV() *Profile

type ProxyDetail added in v1.2.40

type ProxyDetail struct {
	HTTPsProxy       string
	HTTPProxy        string
	CABundleFilePath string
	NoProxy          string
}

func PrepareProxy added in v1.2.40

func PrepareProxy(vpcClient *vpc_client.VPC,
	zone string,
	sshPemFileName string,
	sshPemFileRecordDir string,
	caFile string) (*ProxyDetail, error)

type UserData

type UserData struct {
	AccountRolesPrefix   string `json:"account_roles_prefix,omitempty"`
	AdditionalPrincipals string `json:"additional_principals,omitempty"`
	AuditLogArn          string `json:"audit_log,omitempty"`
	DNSDomain            string `json:"dns_domain,omitempty"`
	EtcdKMSKey           string `json:"etcd_kms_key,omitempty"`
	HostedZoneID         string `json:"hosted_zone_id,omitempty"`
	KMSKey               string `json:"kms_key,omitempty"`
	OperatorRolesPrefix  string `json:"operator_roles_prefix,omitempty"`
	OIDCConfigID         string `json:"oidc_config_id,omitempty"`
	ResourceShareArn     string `json:"resource_share,omitempty"`
	SharedVPCRole        string `json:"shared_vpc_role,omitempty"`
	VpcID                string `json:"vpc_id,omitempty"`
}

UserData will record the user data prepared for resource clean up

func ParseUserData added in v1.2.40

func ParseUserData() (*UserData, error)

ParseUserData Get user data from resources.json file

Jump to

Keyboard shortcuts

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