profilehandler

package
v1.2.42-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 22 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 DeleteAuditLogRoleArn added in v1.2.40

func DeleteAuditLogRoleArn(arn string, region 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,
	oidcConfig string) []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 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 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 con.DefaultLongClusterNamelength

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) (*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"`
	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"`
}

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"`
}

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"`
	AuditLogArn         string `json:"audit_log,omitempty"`
	EtcdKMSKey          string `json:"etcd_kms_key,omitempty"`
	KMSKey              string `json:"kms_key,omitempty"`
	OperatorRolesPrefix string `json:"operator_roles_prefix,omitempty"`
	OIDCConfigID        string `json:"oidc_config_id,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