cls

package
v0.0.0-...-34ee2f8 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegionEurope = "eu"
	RegionUS     = "us"
)

Supported SAP Cloud Platform regions, where a CLS instance can be provisioned

Variables

This section is empty.

Functions

func DetermineServiceManagerRegion

func DetermineServiceManagerRegion(skrRegion *string, log logrus.FieldLogger) string

DetermineServiceManagerRegion maps a hyperscaler-specific region (currently, Azure only) to a region where a CLS instance is to be provisioned. Returns eu as a fallback regions.

func EncryptOverrides

func EncryptOverrides(secretKey string, overrides *OverrideParams) (string, error)

func FindCredentials

func FindCredentials(config *ServiceManagerConfig, region string) (*servicemanager.Credentials, error)

FindCredentials searches for Service Manager credentials for a given region

func GetExtraConfTemplate

func GetExtraConfTemplate() (*template.Template, error)

func IsKymaVersionAtLeast_1_20

func IsKymaVersionAtLeast_1_20(runTimeVersion string) (bool, error)

func IsKymaVersionAtLeast_1_21

func IsKymaVersionAtLeast_1_21(runTimeVersion string) (bool, error)

func NewProvisioner

func NewProvisioner(storage ProvisionerStorage, creator InstanceCreator) *provisioner

func NewStatusChecker

func NewStatusChecker(storage ProvisionerStorage) *checker

func RenderOverrides

func RenderOverrides(data interface{}, tmp *template.Template) (string, error)

Types

type BindingRequest

type BindingRequest struct {
	InstanceKey servicemanager.InstanceKey
	BindingID   string
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps a generic servicemanager.Client an performs CLS specific calls

func NewClient

func NewClient(config *Config) *Client

NewClient creates a new Client instance

func (*Client) CreateBinding

func (c *Client) CreateBinding(smClient servicemanager.Client, request *BindingRequest) (*OverrideParams, error)

func (*Client) CreateInstance

func (c *Client) CreateInstance(smClient servicemanager.Client, instance servicemanager.InstanceKey) error

CreateInstance sends a request to Service Manager to create a CLS Instance

func (*Client) RemoveInstance

func (c *Client) RemoveInstance(smClient servicemanager.Client, instance servicemanager.InstanceKey) error

RemoveInstance sends a request to Service Manager to remove a CLS Instance

type Config

type Config struct {
	//Log retention period specified in days
	RetentionPeriod int `yaml:"retentionPeriod"`

	//Number of Elasticsearch data nodes to be provisioned
	MaxDataInstances int `yaml:"maxDataInstances"`

	//Number of FluentD instances to be provisioned
	MaxIngestInstances int `yaml:"maxIngestInstances"`

	SAML *SAMLConfig `yaml:"saml"`

	ServiceManager *ServiceManagerConfig `yaml:"serviceManager"`
}

Config is the top-level CLS provisioning configuration

func Load

func Load(s string) (*Config, error)

Load parses the YAML input s into a Config

type DeprovisionRequest

type DeprovisionRequest struct {
	SKRInstanceID string
	Instance      servicemanager.InstanceKey
}

type DeprovisionResult

type DeprovisionResult struct {
	IsLastReference bool
}

type Deprovisioner

type Deprovisioner struct {
	// contains filtered or unexported fields
}

func NewDeprovisioner

func NewDeprovisioner(storage DeprovisionerStorage, remover InstanceRemover) *Deprovisioner

func (*Deprovisioner) Deprovision

func (d *Deprovisioner) Deprovision(smClient servicemanager.Client, request *DeprovisionRequest, log logrus.FieldLogger) (*DeprovisionResult, error)

type DeprovisionerStorage

type DeprovisionerStorage interface {
	FindByID(clsInstanceID string) (*internal.CLSInstance, bool, error)
	Update(instance internal.CLSInstance) error
	Delete(clsInstanceID string) error
}

type InstanceCreator

type InstanceCreator interface {
	CreateInstance(smClient servicemanager.Client, instance servicemanager.InstanceKey) error
}

type InstanceRemover

type InstanceRemover interface {
	RemoveInstance(smClient servicemanager.Client, instance servicemanager.InstanceKey) error
}

type OverrideParams

type OverrideParams struct {
	FluentdEndPoint string `json:"Fluentd-endpoint"`
	FluentdPassword string `json:"Fluentd-password"`
	FluentdUsername string `json:"Fluentd-username"`
	KibanaURL       string `json:"Kibana-endpoint"`
}

func DecryptOverrides

func DecryptOverrides(secretKey string, encryptedOverrides string) (*OverrideParams, error)

type ProvisionRequest

type ProvisionRequest struct {
	GlobalAccountID string
	Region          string
	SKRInstanceID   string
	Instance        servicemanager.InstanceKey
}

type ProvisionResult

type ProvisionResult struct {
	InstanceID string
	Region     string
}

type ProvisionStatus

type ProvisionStatus string
const (
	InProgress ProvisionStatus = "in progress"
	Succeeded  ProvisionStatus = "succeeded"
	Retry      ProvisionStatus = "retry"
	Failed     ProvisionStatus = "failed"
)

type ProvisionerStorage

type ProvisionerStorage interface {
	FindActiveByGlobalAccountID(globalAccountID string) (*internal.CLSInstance, bool, error)
	Insert(instance internal.CLSInstance) error
	Update(instance internal.CLSInstance) error
	Delete(clsInstanceID string) error
}

type SAMLConfig

type SAMLConfig struct {
	//New admin backend role that maps to any of your SAML group. It will have the right to modify the security module
	AdminGroup string `yaml:"admin_group"`

	//Set to true to use IdP-initiated SSO
	Initiated bool `yaml:"initiated"`

	//The key to sign tokens
	ExchangeKey string `yaml:"exchange_key"`

	//The list of backend_roles will be read from this attribute
	RolesKey string `yaml:"roles_key"`

	Idp *SAMLIdpConfig `yaml:"idp"`

	Sp *SAMLSpConfig `yaml:"sp"`
}

SAMLConfig to be used by Kibana

type SAMLIdpConfig

type SAMLIdpConfig struct {
	//URL to get the SAML metadata
	MetadataURL string `yaml:"metadata_url"`

	//SAML entity id
	EntityID string `yaml:"entity_id"`
}

SAMLIdpConfig contains SAML identity provider configuration

type SAMLSpConfig

type SAMLSpConfig struct {
	//Entity ID of the service provider
	EntityID string `yaml:"entity_id"`

	//The private key used to sign the requests (base64 encoded)
	SignaturePrivateKey string `yaml:"signature_private_key"`
}

SAMLSpConfig contains SAML service provider configuration

type ServiceManagerConfig

type ServiceManagerConfig struct {
	Credentials []*ServiceManagerCredentials `yaml:"credentials"`
}

ServiceManagerConfig contains service manager credentials per region

type ServiceManagerCredentials

type ServiceManagerCredentials struct {
	Region   string `yaml:"region"`
	URL      string `yaml:"url"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

ServiceManagerCredentials contains basic auth credentials for a ServiceManager tenant in a particular region

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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