handler

package
v1.2.48-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetYAMLProfilesDir

func GetYAMLProfilesDir() string

func ParseProfiles

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

func ParseProfilesByFile

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

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"`
	NameLength                    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"`
	ManualCreationMode            bool   `yaml:"manual_creation_mode" json:"manual_creation_mode,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 ParseClusterDetail

func ParseClusterDetail() (*ClusterDetail, error)

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

type ClusterHandler

type ClusterHandler interface {
	GenerateClusterCreateFlags() ([]string, error)
	CreateCluster(waitForClusterReady bool) error
	WaitForClusterReady(timeoutMin int) error
	Destroy() []error
	GetClusterDetail() *ClusterDetail
	GetResourcesHandler() ResourcesHandler
}

func NewClusterHandler

func NewClusterHandler(client *rosacli.Client, profile *Profile) (ClusterHandler, error)

NewClusterHandler create a new cluster handler with data persisted to Filesystem Need to call `saveToFile` method to make sure it persists all information

func NewClusterHandlerFromFilesystem

func NewClusterHandlerFromFilesystem(client *rosacli.Client, profile *Profile) (ClusterHandler, error)

NewClusterHandlerFromFilesystem create a new cluster handler from data saved on Filesystem

func NewTempClusterHandler

func NewTempClusterHandler(client *rosacli.Client, profile *Profile) (ClusterHandler, error)

NewTempClusterHandler create a new cluster handler WITHOUT data persisted to Filesystem Useful for test cases needed resources. Do not forget to delete the resources afterwards

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

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

type Resources

type Resources 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"`
	OIDCConfigID         string `json:"oidc_config_id,omitempty"`
	OIDCProviderID       string `json:"oidc_provider_id,omitempty"`
	OperatorRolesPrefix  string `json:"operator_roles_prefix,omitempty"`
	Region               string `json:"region,omitempty"`
	ResourceShareArn     string `json:"resource_share,omitempty"`
	SharedVPCRole        string `json:"shared_vpc_role,omitempty"`
	VpcID                string `json:"vpc_id,omitempty"`
}

Resources will record the resources prepared

type ResourcesHandler

type ResourcesHandler interface {
	DestroyResources() (errors []error)

	GetAccountRolesPrefix() string
	GetAdditionalPrincipals() string
	GetAuditLogArn() string
	GetDNSDomain() string
	GetEtcdKMSKey() string
	GetHostedZoneID() string
	GetKMSKey() string
	GetOIDCConfigID() string
	GetOperatorRolesPrefix() string
	GetResourceShareArn() string
	GetSharedVPCRole() string
	GetVpcID() string

	GetVPC() *vpc_client.VPC
	GetAWSClient(useSharedVPCIfAvailable bool) (*aws_client.AWSClient, error)

	PrepareVersion(versionRequirement string, channelGroup string, hcp bool) (*rosacli.OpenShiftVersionTableOutput, error)
	PreparePrefix(profilePrefix string, nameLength int) string
	PrepareVPC(vpcName string, cidrValue string, useExisting bool) (*vpc_client.VPC, error)
	PrepareSubnets(zones []string, multiZone bool) (map[string][]string, error)
	PrepareProxy(zone string, sshPemFileName string, sshPemFileRecordDir string, caFile string) (*ProxyDetail, error)
	PrepareKMSKey(multiRegion bool, testClient string, hcp bool, etcdKMS bool) (string, error)
	PrepareAdditionalSecurityGroups(securityGroupCount int, namePrefix string) ([]string, error)
	PrepareAccountRoles(namePrefix string, hcp bool, openshiftVersion string,
		channelGroup string, path string, permissionsBoundary string) (accRoles *rosacli.AccountRolesUnit, err error)
	PrepareOperatorRolesByOIDCConfig(namePrefix string, oidcConfigID string, roleArn string,
		sharedVPCRoleArn string, hcp bool, channelGroup string) error
	PrepareAdminUser() (string, string)
	PrepareAuditlogRoleArnByOIDCConfig(auditLogRoleName string, oidcConfigID string) (string, error)
	PrepareAuditlogRoleArnByIssuer(auditLogRoleName string, oidcIssuerURL string) (string, error)
	PrepareOperatorRolesByCluster(clusterID string) error
	PrepareOIDCConfig(oidcConfigType string, roleArn string, prefix string) (string, error)
	PrepareOIDCProvider(oidcConfigID string) error
	PrepareOIDCProviderByCluster(clusterID string) error
	PrepareSharedVPCRole(sharedVPCRolePrefix string, installerRoleArn string,
		ingressOperatorRoleArn string) (string, string, error)
	PrepareAdditionalPrincipalsRole(roleName string, installerRoleArn string) (string, error)
	PrepareDNSDomain() (string, error)
	PrepareHostedZone(clusterName string, dnsDomain string, vpcID string, private bool) (string, error)
	PrepareSubnetArns(subnetIDs string) ([]string, error)
	PrepareResourceShare(resourceShareName string, resourceArns []string) (string, error)

	DeleteVPCChain() error
	DeleteKMSKey(etcdKMS bool) error
	DeleteAuditLogRoleArn() error
	DeleteHostedZone() error
	DeleteDNSDomain() error
	DeleteSharedVPCRole(managedPolicy bool) error
	DeleteAdditionalPrincipalsRole(managedPolicy bool) error
	DeleteResourceShare() error
	DeleteOperatorRoles() error
	DeleteOIDCConfig() error
	DeleteAccountRoles() error
}

func NewResourcesHandler

func NewResourcesHandler(client *rosacli.Client, region string,
	awsSharedCredentialsFile string) (ResourcesHandler, error)

NewResourcesHandler create a new resources handler with data persisted to Filesystem

func NewResourcesHandlerFromFilesystem

func NewResourcesHandlerFromFilesystem(client *rosacli.Client,
	awsSharedCredentialsFile string) (ResourcesHandler, error)

NewResourcesHandlerFromFilesystem create a new resources handler from data saved on Filesystem

func NewTempResourcesHandler

func NewTempResourcesHandler(client *rosacli.Client, region string,
	awsSharedCredentialsFile string) (ResourcesHandler, error)

NewTempResourcesHandler create a new resources handler WITHOUT data written to Filesystem Useful for test cases needed resources. Do not forget to delete the resources afterwards

Jump to

Keyboard shortcuts

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