util

package
v0.1.45 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AutoInfraLabelName = "hypershift.openshift.io/auto-created-for-infra"
	// DeleteWithClusterLabelName marks CLI created secrets, to be safely removed on hosted cluster deletion
	DeleteWithClusterLabelName = "hypershift.openshift.io/safe-to-delete-with-cluster"
)

Variables

This section is empty.

Functions

func GetClient

func GetClient() (crclient.Client, error)

GetClient creates a controller-runtime client for Kubernetes

func GetConfig

func GetConfig() (*rest.Config, error)

GetConfig creates a REST config from current context

func GetImpersonatedClient added in v0.1.9

func GetImpersonatedClient(userName string) (crclient.Client, error)

GetImpersonatedClient creates a controller-runtime client for Kubernetes

func GetSecret

func GetSecret(name string, namespace string) (*corev1.Secret, error)

func GetSecretWithClient

func GetSecretWithClient(client client.Client, name string, namespace string) (*corev1.Secret, error)

func ParseAWSTags

func ParseAWSTags(tags []string) (map[string]string, error)

ParseAWSTags does exactly that

func SetupAzureCredentials added in v0.1.18

func SetupAzureCredentials(l logr.Logger, credentials *AzureCreds, credentialsFile string) (string, *azidentity.DefaultAzureCredential, error)

SetupAzureCredentials creates the Azure credentials needed to create Azure resources from credentials passed in from the user or from a credentials file

func ValidateMarketplaceFlags added in v0.1.43

func ValidateMarketplaceFlags(marketplaceFlags map[string]*string) error

ValidateMarketplaceFlags validates if any marketplace flag was used, all were set to a non-empty value

func ValidateRequiredOption added in v0.1.32

func ValidateRequiredOption(flag string, value string) error

ValidateRequiredOption returns a cobra style error message when the flag value is empty

Types

type AzureCreds added in v0.1.18

type AzureCreds struct {
	SubscriptionID string `json:"subscriptionId,omitempty"`
	ClientID       string `json:"clientId,omitempty"`
	ClientSecret   string `json:"clientSecret,omitempty"`
	TenantID       string `json:"tenantId,omitempty"`
}

AzureCreds is the file format we expect for credentials. It is copied from the installer to allow using the same credentials file for both: https://github.com/openshift/installer/blob/8fca1ade5b096d9b2cd312c4599881d099439288/pkg/asset/installconfig/azure/session.go#L36

func ReadCredentials added in v0.1.18

func ReadCredentials(path string) (*AzureCreds, error)

ReadCredentials reads a file with azure credentials and returns it as a struct

type CredentialsSecretData added in v0.1.32

type CredentialsSecretData struct {
	AWSAccessKeyID     string
	AWSSecretAccessKey string
	AWSSessionToken    string

	BaseDomain string
}

func ExtractOptionsFromSecret

func ExtractOptionsFromSecret(client client.Client, name string, namespace string, baseDomain string) (*CredentialsSecretData, error)

ExtractOptionsFromSecret Returns baseDomain, awsAccessKeyID & awsSecretAccessKey If len(baseDomain) > 0 we override the value found in the secret

Jump to

Keyboard shortcuts

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