broker

package
v0.0.0-...-f7d1ac2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KymaServiceID   = "47c9dcbf-ff30-448e-ab36-d3bad66ba281"
	KymaServiceName = "kymaruntime"
)
View Source
const (
	AllPlansSelector = "all_plans"

	GCPPlanID          = "ca6e5357-707f-4565-bbbd-b3ab732597c6"
	GCPPlanName        = "gcp"
	AWSPlanID          = "361c511f-f939-4621-b228-d0fb79a1fe15"
	AWSPlanName        = "aws"
	AzurePlanID        = "4deee563-e5ec-4731-b9b1-53b42d855f0c"
	AzurePlanName      = "azure"
	AzureLitePlanID    = "8cb22518-aa26-44c5-91a0-e669ec9bf443"
	AzureLitePlanName  = "azure_lite"
	TrialPlanID        = "7d55d31d-35ae-4438-bf13-6ffdfa107d9f"
	TrialPlanName      = "trial"
	OpenStackPlanID    = "03b812ac-c991-4528-b5bd-08b303523a63"
	OpenStackPlanName  = "openstack"
	FreemiumPlanID     = "b1a5764e-2ea1-4f95-94c0-2b4538b37b55"
	FreemiumPlanName   = "free"
	OwnClusterPlanID   = "03e3cb66-a4c6-4c6a-b4b0-5d42224debea"
	OwnClusterPlanName = "own_cluster"
	PreviewPlanID      = "5cb3d976-b85c-42ea-a636-79cadda109a9"
	PreviewPlanName    = "preview"
)
View Source
const (
	ControlsOrderKey = "_controlsOrder"
	PropertiesKey    = "properties"
)
View Source
const (
	AccountCleanupJob = "accountcleanup-job"
)

Variables

Functions

func AWSRegions

func AWSRegions(euRestrictedAccess bool) []string

func AWSSchema

func AWSSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{}

func AttachRoutes

func AttachRoutes(router *mux.Router, serviceBroker domain.ServiceBroker, logger lager.Logger) *mux.Router

copied from github.com/pivotal-cf/brokerapi/api.go

func AzureLiteSchema

func AzureLiteSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{}

func AzureRegions

func AzureRegions(euRestrictedAccess bool) []string

func AzureSchema

func AzureSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{}

func DefaultControlsOrder

func DefaultControlsOrder() []string

func FreemiumSchema

func FreemiumSchema(provider internal.CloudProvider, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{}

func GCPRegions

func GCPRegions() []string

func GCPSchema

func GCPSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool) *map[string]interface{}

func IsAzurePlan

func IsAzurePlan(planID string) bool

func IsFreemiumPlan

func IsFreemiumPlan(planID string) bool

func IsOwnClusterPlan

func IsOwnClusterPlan(planID string) bool

func IsPreviewPlan

func IsPreviewPlan(planID string) bool

func IsTrialPlan

func IsTrialPlan(planID string) bool

func Marshal

func Marshal(obj interface{}) []byte

func OpenStackRegions

func OpenStackRegions() []string

func OpenStackSchema

func OpenStackSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool) *map[string]interface{}

func OwnClusterSchema

func OwnClusterSchema(update bool) *map[string]interface{}

func Plans

func Plans(plans PlansConfig, provider internal.CloudProvider, includeAdditionalParamsInSchema bool, euAccessRestricted bool) map[string]domain.ServicePlan

Plans is designed to hold plan defaulting logic keep internal/hyperscaler/azure/config.go in sync with any changes to available zones

func PreviewSchema

func PreviewSchema(machineTypesDisplay map[string]string, machineTypes []string, additionalParams, update bool, euAccessRestricted bool) *map[string]interface{}

func ResponseLabels

func ResponseLabels(op internal.ProvisioningOperation, instance internal.Instance, brokerURL string, enableKubeconfigLabel bool) map[string]string

func ResponseLabelsWithExpirationInfo

func ResponseLabelsWithExpirationInfo(op internal.ProvisioningOperation, instance internal.Instance, brokerURL string, trialDocsURL string, enableKubeconfigLabel bool) map[string]string

func ToInterfaceSlice

func ToInterfaceSlice(input []string) []interface{}

func TrialSchema

func TrialSchema(additionalParams, update bool) *map[string]interface{}

Types

type BTPdefaultTemplate

type BTPdefaultTemplate struct {
	Elements  []string `json:"elements,omitempty"`
	Separator string   `json:"separator,omitempty"`
}

type BindEndpoint

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

func NewBind

func NewBind(log logrus.FieldLogger) *BindEndpoint

func (*BindEndpoint) Bind

func (b *BindEndpoint) Bind(ctx context.Context, instanceID, bindingID string, details domain.BindDetails, asyncAllowed bool) (domain.Binding, error)

Bind creates a new service binding

PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type Client

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

func NewClient

func NewClient(ctx context.Context, config ClientConfig) *Client

func NewClientWithPoller

func NewClientWithPoller(ctx context.Context, config ClientConfig, poller Poller) *Client

func (*Client) Deprovision

func (c *Client) Deprovision(instance internal.Instance) (string, error)

Deprovision requests Runtime deprovisioning in KEB with given details

func (*Client) GetInstanceRequest

func (c *Client) GetInstanceRequest(instanceID string) (response *http.Response, err error)

func (*Client) SendExpirationRequest

func (c *Client) SendExpirationRequest(instance internal.Instance) (suspensionUnderWay bool, err error)

SendExpirationRequest requests Runtime suspension due to expiration

type ClientConfig

type ClientConfig struct {
	URL          string
	TokenURL     string `envconfig:"optional"`
	ClientID     string `envconfig:"optional"`
	ClientSecret string `envconfig:"optional"`
	Scope        string `envconfig:"optional"`
}

func NewClientConfig

func NewClientConfig(URL string) *ClientConfig

type Config

type Config struct {
	EnablePlans                             EnablePlans `envconfig:"default=azure"`
	OnlySingleTrialPerGA                    bool        `envconfig:"default=true"`
	URL                                     string
	EnableKubeconfigURLLabel                bool   `envconfig:"default=false"`
	IncludeAdditionalParamsInSchema         bool   `envconfig:"default=false"`
	ShowTrialExpirationInfo                 bool   `envconfig:"default=false"`
	SubaccountsIdsToShowTrialExpirationInfo string `envconfig:"default="`
	TrialDocsURL                            string `envconfig:"default="`

	AllowNetworkingParameters bool `envconfig:"default=false"`
}

Config represents configuration for broker

type ContextUpdateHandler

type ContextUpdateHandler interface {
	Handle(instance *internal.Instance, newCtx internal.ERSContext) (bool, error)
}

type DefaultPoller

type DefaultPoller struct {
	PollInterval time.Duration
	PollTimeout  time.Duration
}

func (*DefaultPoller) Invoke

func (p *DefaultPoller) Invoke(logic func() (bool, error)) error

type DeprovisionEndpoint

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

func NewDeprovision

func NewDeprovision(instancesStorage storage.Instances, operationsStorage storage.Operations, q Queue, log logrus.FieldLogger) *DeprovisionEndpoint

func (*DeprovisionEndpoint) Deprovision

func (b *DeprovisionEndpoint) Deprovision(ctx context.Context, instanceID string, details domain.DeprovisionDetails, asyncAllowed bool) (domain.DeprovisionServiceSpec, error)

Deprovision deletes an existing service instance

DELETE /v2/service_instances/{instance_id}

type EnablePlans

type EnablePlans []string

EnablePlans defines the plans that should be available for provisioning

func (*EnablePlans) Unmarshal

func (m *EnablePlans) Unmarshal(in string) error

Unmarshal provides custom parsing of enabled plans. Implements envconfig.Unmarshal interface.

type GetBindingEndpoint

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

func NewGetBinding

func NewGetBinding(log logrus.FieldLogger) *GetBindingEndpoint

func (*GetBindingEndpoint) GetBinding

func (b *GetBindingEndpoint) GetBinding(_ context.Context, instanceID, bindingID string, _ domain.FetchBindingDetails) (domain.GetBindingSpec, error)

GetBinding fetches an existing service binding

GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type GetInstanceEndpoint

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

func NewGetInstance

func NewGetInstance(cfg Config,
	instancesStorage storage.Instances,
	operationsStorage storage.Provisioning,
	log logrus.FieldLogger,
) *GetInstanceEndpoint

func (*GetInstanceEndpoint) GetInstance

GetInstance fetches information about a service instance GET /v2/service_instances/{instance_id}

type JSONSchemaValidator

type JSONSchemaValidator interface {
	ValidateString(json string) (jsonschema.ValidationResult, error)
}

type LastBindingOperationEndpoint

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

func (*LastBindingOperationEndpoint) LastBindingOperation

func (b *LastBindingOperationEndpoint) LastBindingOperation(ctx context.Context, instanceID, bindingID string, details domain.PollDetails) (domain.LastOperation, error)

LastBindingOperation fetches last operation state for a service binding

GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation

type LastOperationEndpoint

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

func (*LastOperationEndpoint) LastOperation

func (b *LastOperationEndpoint) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (domain.LastOperation, error)

LastOperation fetches last operation state for a service instance

GET /v2/service_instances/{instance_id}/last_operation

type NameType

type NameType struct {
	Type
	BTPdefaultTemplate BTPdefaultTemplate `json:"_BTPdefaultTemplate,omitempty"`
}

func NameProperty

func NameProperty() NameType

type NetworkingProperties

type NetworkingProperties struct {
	Nodes Type `json:"nodes"`
}

type NetworkingType

type NetworkingType struct {
	Type
	Properties NetworkingProperties `json:"properties"`
	Required   []string             `json:"required"`
}

func NewNetworkingSchema

func NewNetworkingSchema() *NetworkingType

type OIDCProperties

type OIDCProperties struct {
	ClientID       Type `json:"clientID"`
	GroupsClaim    Type `json:"groupsClaim"`
	IssuerURL      Type `json:"issuerURL"`
	SigningAlgs    Type `json:"signingAlgs"`
	UsernameClaim  Type `json:"usernameClaim"`
	UsernamePrefix Type `json:"usernamePrefix"`
}

type OIDCType

type OIDCType struct {
	Type
	Properties OIDCProperties `json:"properties"`
	Required   []string       `json:"required"`
}

func NewOIDCSchema

func NewOIDCSchema() *OIDCType

type PassthroughPoller

type PassthroughPoller struct {
}

func (*PassthroughPoller) Invoke

func (p *PassthroughPoller) Invoke(logic func() (bool, error)) error

type PlanData

type PlanData struct {
	Description string       `yaml:"description"`
	Metadata    PlanMetadata `yaml:"metadata"`
}

type PlanDefaults

type PlanDefaults func(planID string, platformProvider internal.CloudProvider, parametersProvider *internal.CloudProvider) (*gqlschema.ClusterConfigInput, error)

type PlanMetadata

type PlanMetadata struct {
	DisplayName string `yaml:"displayName"`
}

type PlanValidator

type PlanValidator interface {
	IsPlanSupport(planID string) bool
}

type PlansConfig

type PlansConfig map[string]PlanData

type Poller

type Poller interface {
	Invoke(logic func() (bool, error)) error
}

func NewDefaultPoller

func NewDefaultPoller() Poller

func NewPassthroughPoller

func NewPassthroughPoller() Poller

type ProvisionEndpoint

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

func NewProvision

func NewProvision(cfg Config,
	gardenerConfig gardener.Config,
	operationsStorage storage.Operations,
	instanceStorage storage.Instances,
	queue Queue,
	builderFactory PlanValidator,
	plansConfig PlansConfig,
	kvod bool,
	planDefaults PlanDefaults,
	euAccessWhitelist euaccess.WhitelistSet,
	euRejectMessage string,
	log logrus.FieldLogger,
	dashboardConfig dashboard.Config,
) *ProvisionEndpoint

func (*ProvisionEndpoint) Provision

func (b *ProvisionEndpoint) Provision(ctx context.Context, instanceID string, details domain.ProvisionDetails, asyncAllowed bool) (domain.ProvisionedServiceSpec, error)

Provision creates a new service instance

PUT /v2/service_instances/{instance_id}

type ProvisioningProperties

type ProvisioningProperties struct {
	UpdateProperties

	Name        NameType        `json:"name"`
	ShootName   *Type           `json:"shootName,omitempty"`
	ShootDomain *Type           `json:"shootDomain,omitempty"`
	Region      *Type           `json:"region,omitempty"`
	Networking  *NetworkingType `json:"networking,omitempty"`
}

func NewProvisioningProperties

func NewProvisioningProperties(machineTypesDisplay map[string]string, machineTypes, regions []string, update bool) ProvisioningProperties

NewProvisioningProperties creates a new properties for different plans Note that the order of properties will be the same in the form on the website

type Queue

type Queue interface {
	Add(operationId string)
}

type RootSchema

type RootSchema struct {
	Schema string `json:"$schema"`
	Type
	Properties interface{} `json:"properties"`
	Required   []string    `json:"required"`

	// Specified to true enables form view on website
	ShowFormView bool `json:"_show_form_view"`
	// Specifies in what order properties will be displayed on the form
	ControlsOrder []string `json:"_controlsOrder"`
}

func NewSchemaForOwnCluster

func NewSchemaForOwnCluster(properties interface{}, update bool, required []string) *RootSchema

func NewSchemaWithOnlyNameRequired

func NewSchemaWithOnlyNameRequired(properties interface{}, update bool) *RootSchema

type Service

type Service struct {
	Description string          `yaml:"description"`
	Metadata    ServiceMetadata `yaml:"metadata"`
	Plans       PlansConfig     `yaml:"plans"`
}

type ServiceMetadata

type ServiceMetadata struct {
	DisplayName         string `yaml:"displayName"`
	ImageUrl            string `yaml:"imageUrl"`
	LongDescription     string `yaml:"longDescription"`
	ProviderDisplayName string `yaml:"providerDisplayName"`
	DocumentationUrl    string `yaml:"documentationUrl"`
	SupportUrl          string `yaml:"supportUrl"`
}

type ServicesConfig

type ServicesConfig map[string]Service

func NewServicesConfigFromFile

func NewServicesConfigFromFile(path string) (ServicesConfig, error)

func (ServicesConfig) DefaultPlansConfig

func (s ServicesConfig) DefaultPlansConfig() (PlansConfig, error)

type ServicesEndpoint

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

func NewServices

func NewServices(cfg Config, servicesConfig ServicesConfig, log logrus.FieldLogger) *ServicesEndpoint

func (*ServicesEndpoint) Services

func (b *ServicesEndpoint) Services(ctx context.Context) ([]domain.Service, error)

Services gets the catalog of services offered by the service broker

GET /v2/catalog

type TrialCloudRegion

type TrialCloudRegion string
const (
	Europe TrialCloudRegion = "europe"
	Us     TrialCloudRegion = "us"
	Asia   TrialCloudRegion = "asia"
)

type Type

type Type struct {
	Type        string `json:"type"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Minimum     int    `json:"minimum,omitempty"`
	Maximum     int    `json:"maximum,omitempty"`
	MinLength   int    `json:"minLength,omitempty"`
	MaxLength   int    `json:"maxLength,omitempty"`

	// Regex pattern to match against string type of fields.
	// If not specified for strings user can pass empty string with whitespaces only.
	Pattern         string            `json:"pattern,omitempty"`
	Default         interface{}       `json:"default,omitempty"`
	Example         interface{}       `json:"example,omitempty"`
	Enum            []interface{}     `json:"enum,omitempty"`
	EnumDisplayName map[string]string `json:"_enumDisplayName,omitempty"`
	Items           *Type             `json:"items,omitempty"`
	AdditionalItems *bool             `json:"additionalItems,omitempty"`
	UniqueItems     *bool             `json:"uniqueItems,omitempty"`
}

func AdministratorsProperty

func AdministratorsProperty() *Type

func KubeconfigProperty

func KubeconfigProperty() *Type

func ShootDomainProperty

func ShootDomainProperty() *Type

func ShootNameProperty

func ShootNameProperty() *Type

type UnbindEndpoint

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

func NewUnbind

func NewUnbind(log logrus.FieldLogger) *UnbindEndpoint

func (*UnbindEndpoint) Unbind

func (b *UnbindEndpoint) Unbind(ctx context.Context, instanceID, bindingID string, details domain.UnbindDetails, asyncAllowed bool) (domain.UnbindSpec, error)

Unbind deletes an existing service binding

DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}

type UpdateEndpoint

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

func NewUpdate

func NewUpdate(cfg Config,
	instanceStorage storage.Instances,
	runtimeStates storage.RuntimeStates,
	operationStorage storage.Operations,
	ctxUpdateHandler ContextUpdateHandler,
	processingEnabled bool,
	subAccountMovementEnabled bool,
	queue Queue,
	plansConfig PlansConfig,
	planDefaults PlanDefaults,
	log logrus.FieldLogger,
	dashboardConfig dashboard.Config,
) *UpdateEndpoint

func (*UpdateEndpoint) Update

func (b *UpdateEndpoint) Update(_ context.Context, instanceID string, details domain.UpdateDetails, asyncAllowed bool) (domain.UpdateServiceSpec, error)

Update modifies an existing service instance

PATCH /v2/service_instances/{instance_id}

type UpdateProperties

type UpdateProperties struct {
	Kubeconfig     *Type     `json:"kubeconfig,omitempty"`
	AutoScalerMin  *Type     `json:"autoScalerMin,omitempty"`
	AutoScalerMax  *Type     `json:"autoScalerMax,omitempty"`
	OIDC           *OIDCType `json:"oidc,omitempty"`
	Administrators *Type     `json:"administrators,omitempty"`
	MachineType    *Type     `json:"machineType,omitempty"`
}

func (*UpdateProperties) IncludeAdditional

func (up *UpdateProperties) IncludeAdditional()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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