Documentation ¶
Index ¶
- Constants
- type Client
- type GardenerRuntimeResolver
- type ListParameters
- type OperationDetailResponse
- type OperationResponse
- type OperationResponseList
- type ParallelStrategySpec
- type Parameters
- type Runtime
- type RuntimeLister
- type RuntimeListerMock
- type RuntimeOperation
- type RuntimeResolver
- type RuntimeTarget
- type ScheduleType
- type StatusResponse
- type StatusResponseList
- type Strategy
- type StrategySpec
- type StrategyType
- type TargetSpec
- type Type
- type UpgradeResponse
Constants ¶
const ( Pending = "pending" InProgress = "in progress" Canceling = "canceling" Canceled = "canceled" Succeeded = "succeeded" Failed = "failed" )
Orchestration states
const (
// StateParam parameter used in list orchestrations / operations queries to filter by state
StateParam = "state"
)
const TargetAll = "all"
TargetAll all SKRs provisioned successfully and not deprovisioning
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { ListOrchestrations(params ListParameters) (StatusResponseList, error) GetOrchestration(orchestrationID string) (StatusResponse, error) ListOperations(orchestrationID string, params ListParameters) (OperationResponseList, error) GetOperation(orchestrationID, operationID string) (OperationDetailResponse, error) UpgradeKyma(params Parameters) (UpgradeResponse, error) CancelOrchestration(orchestrationID string) error }
Client is the interface to interact with the KEB /orchestrations and /upgrade API as an HTTP client using OIDC ID token in JWT format.
func NewClient ¶
NewClient constructs and returns new Client for KEB /runtimes API It takes the following arguments:
- ctx : context in which the http request will be executed
- url : base url of all KEB APIs, e.g. https://kyma-env-broker.kyma.local
- auth : TokenSource object which provides the ID token for the HTTP request
type GardenerRuntimeResolver ¶
type GardenerRuntimeResolver struct {
// contains filtered or unexported fields
}
GardenerRuntimeResolver is the default resolver which implements the RuntimeResolver interface. This resolver uses the Shoot resources on the Gardener cluster to resolve the runtime targets.
Naive implementation, listing all the shoots and perfom filtering on the result. The logic could be optimized with k8s client cache using shoot lister / indexer. The implementation is thread safe, i.e. it is safe to call Resolve() from multiple threads concurrently.
func NewGardenerRuntimeResolver ¶
func NewGardenerRuntimeResolver(gardenerClient gardenerclient.CoreV1beta1Interface, gardenerNamespace string, lister RuntimeLister, logger logrus.FieldLogger) *GardenerRuntimeResolver
NewGardenerRuntimeResolver constructs a GardenerRuntimeResolver with the mandatory input parameters.
func (*GardenerRuntimeResolver) Resolve ¶
func (resolver *GardenerRuntimeResolver) Resolve(targets TargetSpec) ([]Runtime, error)
Resolve given an input slice of target specs to include and exclude, returns back a list of unique Runtime objects
type ListParameters ¶
ListParameters hold attributes of list orchestrations / operations queries.
type OperationDetailResponse ¶
type OperationDetailResponse struct { OperationResponse KymaConfig gqlschema.KymaConfigInput `json:"kymaConfig"` ClusterConfig gqlschema.GardenerConfigInput `json:"clusterConfig"` }
type OperationResponse ¶
type OperationResponse struct { OperationID string `json:"operationID"` RuntimeID string `json:"runtimeID"` GlobalAccountID string `json:"globalAccountID"` SubAccountID string `json:"subAccountID"` OrchestrationID string `json:"orchestrationID"` ServicePlanID string `json:"servicePlanID"` ServicePlanName string `json:"servicePlanName"` DryRun bool `json:"dryRun"` ShootName string `json:"shootName"` MaintenanceWindowBegin time.Time `json:"maintenanceWindowBegin"` MaintenanceWindowEnd time.Time `json:"maintenanceWindowEnd"` State string `json:"state"` Description string `json:"description"` }
type OperationResponseList ¶
type OperationResponseList struct { Data []OperationResponse `json:"data"` Count int `json:"count"` TotalCount int `json:"totalCount"` }
type ParallelStrategySpec ¶
type ParallelStrategySpec struct {
Workers int `json:"workers"`
}
ParallelStrategySpec defines parameters for the parallel orchestration strategy
type Parameters ¶
type Parameters struct { Version string `json:"version"` Targets TargetSpec `json:"targets"` Strategy StrategySpec `json:"strategy,omitempty"` DryRun bool `json:"dryRun,omitempty"` }
Parameters hold the attributes of orchestration create (upgrade) requests.
type Runtime ¶
type Runtime struct { InstanceID string `json:"instanceId,omitempty"` RuntimeID string `json:"runtimeId"` GlobalAccountID string `json:"globalAccountId"` SubAccountID string `json:"subaccountId"` // The corresponding shoot cluster's .metadata.name value ShootName string `json:"shootName"` // The corresponding shoot cluster's .spec.maintenance.timeWindow.Begin value, which is in in "HHMMSS+[HHMM TZ]" format, e.g. "040000+0000" MaintenanceWindowBegin time.Time `json:"maintenanceWindowBegin"` // The corresponding shoot cluster's .spec.maintenance.timeWindow.End value, which is in "HHMMSS+[HHMM TZ]" format, e.g. "040000+0000" MaintenanceWindowEnd time.Time `json:"maintenanceWindowEnd"` }
Runtime is the data type which captures the needed runtime specific attributes to perform orchestrations on a given runtime.
type RuntimeLister ¶
type RuntimeLister interface {
ListAllRuntimes() ([]runtime.RuntimeDTO, error)
}
RuntimeLister is the interface to get runtime objects from KEB
type RuntimeListerMock ¶
RuntimeListerMock is an autogenerated mock type for the RuntimeLister type
func (*RuntimeListerMock) ListAllRuntimes ¶
func (_m *RuntimeListerMock) ListAllRuntimes() ([]runtime.RuntimeDTO, error)
ListAllRuntimes provides a mock function with given fields:
type RuntimeOperation ¶
RuntimeOperation holds information about operation performed on a runtime
type RuntimeResolver ¶
type RuntimeResolver interface {
Resolve(targets TargetSpec) ([]Runtime, error)
}
RuntimeResolver given an input slice of target specs to include and exclude, resolves and returns a list of unique Runtime objects.
type RuntimeTarget ¶
type RuntimeTarget struct { // Valid values: "all" Target string `json:"target,omitempty"` // Regex pattern to match against the runtime's GlobalAccount field. E.g. CA50125541TID000000000741207136, CA.* GlobalAccount string `json:"globalAccount,omitempty"` // Regex pattern to match against the runtime's SubAccount field. E.g. 0d20e315-d0b4-48a2-9512-49bc8eb03cd1 SubAccount string `json:"subAccount,omitempty"` // Regex pattern to match against the shoot cluster's Region field (not SCP platform-region). E.g. "europe|eu-" Region string `json:"region,omitempty"` // RuntimeID is used to indicate a specific runtime RuntimeID string `json:"runtimeID,omitempty"` // PlanName is used to match runtimes with the same plan PlanName string `json:"planName,omitempty"` // Shoot is used to indicate a sepcific runtime by shoot name Shoot string `json:"shoot,omitempty"` }
RuntimeTarget captures a specification of SKR targets to resolve for an orchestration. When a RuntimeTarget defines multiple fields, all should match to any given runtime to be selected (i.e. the terms are AND-ed).
type ScheduleType ¶
type ScheduleType string
const ( Immediate ScheduleType = "immediate" MaintenanceWindow ScheduleType = "maintenanceWindow" )
type StatusResponse ¶
type StatusResponse struct { OrchestrationID string `json:"orchestrationID"` Type Type `json:"type"` State string `json:"state"` Description string `json:"description"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Parameters Parameters `json:"parameters"` OperationStats map[string]int `json:"operationStats,omitempty"` }
type StatusResponseList ¶
type StatusResponseList struct { Data []StatusResponse `json:"data"` Count int `json:"count"` TotalCount int `json:"totalCount"` }
type Strategy ¶
type Strategy interface { // Execute invokes operation managers' Execute(operationID string) method for each operation according to the encapsulated strategy. // The strategy is executed asynchronously. Successful call to the function returns a unique identifier, which can be used in a subsequent call to Wait(). Execute(operations []RuntimeOperation, strategySpec StrategySpec) (string, error) // Wait blocks and waits until the execution with the given ID is finished. Wait(executionID string) // Cancel shutdowns a given execution. Cancel(executionID string) }
Strategy interface encapsulates the strategy how the orchestration is performed.
type StrategySpec ¶
type StrategySpec struct { Type StrategyType `json:"type"` Schedule ScheduleType `json:"schedule,omitempty"` Parallel ParallelStrategySpec `json:"parallel,omitempty"` }
StrategySpec is the strategy part common for all orchestration trigger/status API
type TargetSpec ¶
type TargetSpec struct { Include []RuntimeTarget `json:"include"` Exclude []RuntimeTarget `json:"exclude,omitempty"` }
TargetSpec is the targets part common for all orchestration trigger/status API
type UpgradeResponse ¶
type UpgradeResponse struct {
OrchestrationID string `json:"orchestrationID"`
}