config

package
v0.0.0-...-767ff25 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StorageArrayConfig     []StorageArrayConfig     `yaml:"storageArrays" mapstructure:"storageArrays"`
	ManagementServerConfig []ManagementServerConfig `yaml:"managementServers" mapstructure:"managementServers"`
}

Config - represents proxy configuration in the config file

type ManagementServer

type ManagementServer struct {
	URL                       url.URL
	StorageArrayIdentifiers   []string
	Credentials               common.Credentials
	CredentialSecret          string
	SkipCertificateValidation bool
	CertFile                  string
	CertSecret                string
	Limits                    common.Limits
}

ManagementServer - represents a Management Server (formed using ManagementServerConfig)

func (*ManagementServer) DeepCopy

func (ms *ManagementServer) DeepCopy() *ManagementServer

DeepCopy is used for creating a deep copy of Management Server

type ManagementServerConfig

type ManagementServerConfig struct {
	URL                       string        `yaml:"url"`
	ArrayCredentialSecret     string        `yaml:"arrayCredentialSecret,omitempty"`
	SkipCertificateValidation bool          `yaml:"skipCertificateValidation,omitempty"`
	CertSecret                string        `yaml:"certSecret,omitempty"`
	Limits                    common.Limits `yaml:"limits,omitempty" mapstructure:"limits"`
}

ManagementServerConfig - represents a management server configuration for the management server

type ProxyConfig

type ProxyConfig struct {
	Port string
	// contains filtered or unexported fields
}

ProxyConfig - represents Proxy Config (formed using ProxyConfigMap)

func NewProxyConfig

func NewProxyConfig(configMap *ProxyConfigMap, k8sUtils k8sutils.UtilsInterface) (*ProxyConfig, error)

NewProxyConfig - returns a new proxy config given a proxy config map

func (*ProxyConfig) DeepCopy

func (pc *ProxyConfig) DeepCopy() *ProxyConfig

DeepCopy is used to create a deep copy of ProxyConfig

func (*ProxyConfig) GetAuthorizedArrays

func (pc *ProxyConfig) GetAuthorizedArrays(username, password string) []string

GetAuthorizedArrays - Given a credential, returns the list of authorized storage arrays

func (*ProxyConfig) GetManagedArraysAndServers

func (pc *ProxyConfig) GetManagedArraysAndServers() map[string]StorageArrayServer

GetManagedArraysAndServers returns a list of arrays with their corresponding management servers

func (*ProxyConfig) GetManagementServer

func (pc *ProxyConfig) GetManagementServer(url url.URL) (ManagementServer, bool)

GetManagementServer returns a management server corresponding to a URL

func (*ProxyConfig) GetManagementServerCredentials

func (pc *ProxyConfig) GetManagementServerCredentials(mgmtURL url.URL) (common.Credentials, error)

GetManagementServerCredentials - Given a management server URL, returns the associated credentials

func (*ProxyConfig) GetManagementServers

func (pc *ProxyConfig) GetManagementServers() []ManagementServer

GetManagementServers - Returns the list of management servers present in ProxyConfig

func (*ProxyConfig) GetStorageArray

func (pc *ProxyConfig) GetStorageArray(storageArrayID string) []StorageArray

GetStorageArray - Returns a list of storage array given a storage array id

func (*ProxyConfig) IsSecretConfiguredForArrays

func (pc *ProxyConfig) IsSecretConfiguredForArrays(secretName string) bool

IsSecretConfiguredForArrays - returns true if a given secret name has been configured as credential secret for a storage array

func (*ProxyConfig) IsSecretConfiguredForCerts

func (pc *ProxyConfig) IsSecretConfiguredForCerts(secretName string) bool

IsSecretConfiguredForCerts - returns true if the given secret name is configured for certificates

func (*ProxyConfig) IsUserAuthorized

func (pc *ProxyConfig) IsUserAuthorized(username, password, storageArrayID string) (bool, error)

IsUserAuthorized - Returns if a given user is authorized to access a specific storage array

func (*ProxyConfig) Log

func (pc *ProxyConfig) Log()

Log - logs the Proxy Config

func (*ProxyConfig) ParseConfig

func (pc *ProxyConfig) ParseConfig(proxyConfigMap ProxyConfigMap, k8sUtils k8sutils.UtilsInterface) error

ParseConfig - Parses a given proxy config map

func (*ProxyConfig) UpdateCerts

func (pc *ProxyConfig) UpdateCerts(secretName, certFileName string) bool

UpdateCerts - Given a secret name and cert file name, updates the management server

func (*ProxyConfig) UpdateCertsAndCredentials

func (pc *ProxyConfig) UpdateCertsAndCredentials(k8sUtils k8sutils.UtilsInterface, secret *corev1.Secret) (bool, error)

UpdateCertsAndCredentials - Updates certs and credentials given a secret and returns a boolean to indicate if any updates was done

func (*ProxyConfig) UpdateCreds

func (pc *ProxyConfig) UpdateCreds(secretName string, credentials *common.Credentials) bool

UpdateCreds - Given a secret name and credentials, updates management servers and storage array proxy credentials

func (*ProxyConfig) UpdateManagedArrays

func (pc *ProxyConfig) UpdateManagedArrays(config *ProxyConfig)

UpdateManagedArrays - updates the set of managed arrays

func (*ProxyConfig) UpdateManagementServers

func (pc *ProxyConfig) UpdateManagementServers(config *ProxyConfig) ([]ManagementServer, []ManagementServer, error)

UpdateManagementServers - Updates the list of management servers

type ProxyConfigMap

type ProxyConfigMap struct {
	Port      string  `yaml:"port,omitempty"`
	LogLevel  string  `yaml:"logLevel,omitempty"`
	LogFormat string  `yaml:"logFormat,omitempty"`
	Config    *Config `yaml:"config,omitempty" mapstructure:"config"`
}

ProxyConfigMap - represents the configuration file

func ReadConfig

func ReadConfig(configFile, configPath string) (*ProxyConfigMap, error)

ReadConfig - uses viper to read the config from the config map

type ProxyCredentialSecret

type ProxyCredentialSecret struct {
	Credentials      common.Credentials
	CredentialSecret string
}

ProxyCredentialSecret is used for storing a credential for a secret

type ProxyUser

type ProxyUser struct {
	StorageArrayIdentifiers []string
	ProxyCredential         common.Credentials
}

ProxyUser - used for storing a proxy user and list of associated storage array identifiers

func (*ProxyUser) DeepClone

func (pu *ProxyUser) DeepClone() *ProxyUser

DeepClone is used to create a deep copy of Proxy User

type StorageArray

type StorageArray struct {
	StorageArrayIdentifier string
	PrimaryURL             url.URL
	SecondaryURL           url.URL
	ProxyCredentialSecrets map[string]ProxyCredentialSecret
}

StorageArray represents a StorageArray (formed using StorageArrayConfig)

func (*StorageArray) DeepCopy

func (sa *StorageArray) DeepCopy() *StorageArray

DeepCopy - used for deep copy of StorageArray

type StorageArrayConfig

type StorageArrayConfig struct {
	StorageArrayID         string   `yaml:"storageArrayId"`
	PrimaryURL             string   `yaml:"primaryURL"`
	BackupURL              string   `yaml:"backupURL,omitempty"`
	ProxyCredentialSecrets []string `yaml:"proxyCredentialSecrets"`
}

StorageArrayConfig represents the configuration of a storage array in the config file

type StorageArrayServer

type StorageArrayServer struct {
	Array         StorageArray
	PrimaryServer ManagementServer
	BackupServer  *ManagementServer
}

StorageArrayServer represents an array with its primary and backup management server

Jump to

Keyboard shortcuts

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