Documentation ¶
Index ¶
- Constants
- Variables
- func EnvironmentTypes() []string
- func IsEnvironmentType(s string) bool
- func IsIdleCost(name string) bool
- func IsIdleOrManagementCost(name string) bool
- func IsManagementCost(name string) bool
- func IsRoleKind(s string) bool
- func IsSubjectKind(s string) bool
- func IsTokenKind(s string) bool
- func RoleKinds() []string
- func RolePolicyFields(f ...string) []string
- type CatalogSync
- type CostFilters
- type FilterField
- type FilterRule
- type FinOpsCustomPricing
- type GraphEdge
- type GraphVertex
- type GraphVertexID
- type GroupByField
- type IdleShareOption
- type ItemSharedOption
- type ItemSharedOptions
- type ManagementShareOption
- type Operator
- type OutputValue
- type PVCost
- type ProviderRequirement
- type QueryCondition
- type QueryPagination
- type ResourceComponentEndpoint
- type ResourceComponentEndpoints
- type ResourceComponentOperationKey
- type ResourceComponentOperationKeys
- type ResourceComponentStatus
- type RetryStrategy
- type RolePolicies
- func (in RolePolicies) Clone() RolePolicies
- func (in RolePolicies) Deduplicate() RolePolicies
- func (in RolePolicies) Delete(rs ...RolePolicy) RolePolicies
- func (in RolePolicies) Len() int
- func (in RolePolicies) Less(i, j int) bool
- func (in RolePolicies) Normalize() RolePolicies
- func (in RolePolicies) Sort() RolePolicies
- func (in RolePolicies) Swap(i, j int)
- type RolePolicy
- type Schema
- func (s *Schema) Expose() UISchema
- func (s *Schema) Intersect(s2 *Schema)
- func (s *Schema) IsEmpty() bool
- func (s *Schema) OutputSchema() *openapi3.Schema
- func (s *Schema) SetOutputSchema(v *openapi3.Schema)
- func (s *Schema) SetVariableSchema(v *openapi3.Schema)
- func (s *Schema) Validate() error
- func (s *Schema) VariableSchema() *openapi3.Schema
- type Selector
- type SharedCostOptions
- type SharingStrategy
- type Step
- type TemplateVersionSchema
- type TemplateVersionSchemaData
- type UISchema
- type WorkflowExecutionTrigger
- type WorkflowStepApprovalSpec
- func (s *WorkflowStepApprovalSpec) IsApprovalUser(user object.ID) bool
- func (s *WorkflowStepApprovalSpec) IsApproved() bool
- func (s *WorkflowStepApprovalSpec) IsRejected() bool
- func (s *WorkflowStepApprovalSpec) SetApprovedUser(user object.ID) error
- func (s *WorkflowStepApprovalSpec) SetRejectedUser(user object.ID) error
- func (s *WorkflowStepApprovalSpec) SetUserApproval(user object.ID, approved bool) error
- func (s *WorkflowStepApprovalSpec) ToAttributes() map[string]any
Constants ¶
const ( // AnnotationEnableManagedNamespace specify whether Walrus-managed namespace is enabled. // Defaults to true. AnnotationEnableManagedNamespace = "walrus.seal.io/enable-managed-namespace" // AnnotationManagedNamespace specify custom environment namespace name. AnnotationManagedNamespace = "walrus.seal.io/managed-namespace-name" )
const ( LabelWalrusProjectName string = "walrus.seal.io/project-name" LabelWalrusEnvironmentName string = "walrus.seal.io/environment-name" LabelWalrusServiceName string = "walrus.seal.io/service-name" // LabelWalrusEnvironmentPath indicate environment with project name, format: projectName/environmentName. LabelWalrusEnvironmentPath string = "walrus.seal.io/environment-path" // LabelWalrusServicePath indicate service with project name and environment name, // format: projectName/environmentName/serviceName LabelWalrusServicePath string = "walrus.seal.io/service-path" // LabelWalrusManaged indicates whether the resource is managed by Seal. LabelWalrusManaged string = "walrus.seal.io/managed" // LabelWalrusCategory indicates the category of the resource. LabelWalrusCategory string = "walrus.seal.io/category" )
built-in labels.
const ( WalrusSystemNamespace = "walrus-system" DeployerServiceAccountName = "walrus-deployer" WorkflowServiceAccountName = "walrus-workflow" )
const ( ConnectorTypeKubernetes string = "Kubernetes" ConnectorTypeAlibaba string = "Alibaba" ConnectorTypeAWS string = "AWS" )
const ( ConnectorCategoryKubernetes string = "Kubernetes" ConnectorCategoryCustom string = "Custom" ConnectorCategoryVersionControl string = "VersionControl" ConnectorCategoryCloudProvider string = "CloudProvider" )
const ( // ManagementCostItemName indicates cost item name for cluster management. ManagementCostItemName = "__management__" // UnmountedCostItemName indicated cost item name for unmounted resource (PV or LB). UnmountedCostItemName = "__unmounted__" // IdleCostItemName indicated cost item name for idle. IdleCostItemName = "__idle__" // UnallocatedItemName indicate the cost for the resources unallocated. UnallocatedItemName = "__unallocated__" )
const ( EnvironmentDevelopment = "development" EnvironmentStaging = "staging" EnvironmentProduction = "production" )
const ( GitDriverGithub = "Github" GitDriverGitlab = "Gitlab" )
const ( // VertexKindResource indicates the vertex kind of service, it contains resource groups. VertexKindResource = "Resource" // VertexKindResourceComponentGroup indicates the group resource that generates same type resources. VertexKindResourceComponentGroup = "ResourceComponentGroup" // VertexKindResourceComponent indicates the vertex kind of service resource. VertexKindResourceComponent = "ResourceComponent" // EdgeTypeComposition indicates vertex is composed of another vertex. EdgeTypeComposition = "Composition" // EdgeTypeRealization indicates vertex are realized by another vertex. EdgeTypeRealization = "Realization" // EdgeTypeDependency indicates vertex has dependency on another vertex. EdgeTypeDependency = "Dependency" )
const ( // ResourceRelationshipTypeImplicit indicates the resource dependency is auto created by resource reference. ResourceRelationshipTypeImplicit = "Implicit" // ResourceRelationshipTypeExplicit indicates the resource dependency is manually created by user. ResourceRelationshipTypeExplicit = "Explicit" )
const ( // ResourceComponentModeManaged indicates the resource created to target platform, // it is writable(update or delete). ResourceComponentModeManaged = "managed" // ResourceComponentModeData indicates the resource read from target platform, // it is read-only. ResourceComponentModeData = "data" // ResourceComponentModeDiscovered indicates the resource discovered from target platform, // it inherits its composition's characteristic to be writable or not. ResourceComponentModeDiscovered = "discovered" )
const ( // ResourceComponentShapeClass indicates the resource is a class. ResourceComponentShapeClass = "class" // ResourceComponentShapeInstance indicates the resource is an instance that implements a class. ResourceComponentShapeInstance = "instance" )
const ( RoleKindSystem = "system" RoleKindProject = "project" )
const ( SystemRoleAnonymity = "system/anonymity" SystemRoleUser = "system/user" SystemRoleManager = "system/manager" SystemRoleAdmin = "system/admin" ProjectRoleViewer = "project/viewer" ProjectRoleMember = "project/member" ProjectRoleOwner = "project/owner" )
const ( SubjectKindUser = "user" SubjectKindGroup = "group" )
const ( TokenKindDeployment = "deployment" TokenKindAPI = "api" )
const ( WorkflowTypeDefault = "default" WorkflowTypeCron = "cron" )
const ( WorkflowStepTypeService = "service" WorkflowStepTypeApproval = "approval" )
const ( ExecutionStatusRunning = "Running" ExecutionStatusSucceeded = "Succeeded" ExecutionStatusFailed = "Failed" ExecutionStatusError = "Error" )
const ( // WorkflowStepApprovalTypeOr means step is approved // if any of the approval users approves it. WorkflowStepApprovalTypeOr = "or" // WorkflowStepApprovalTypeAnd means step is approved // only all of the approval users approve it. WorkflowStepApprovalTypeAnd = "and" // WorkflowStepApprovalType is the key of type in spec. WorkflowStepApprovalType = "approvalType" // WorkflowStepApprovalUsers is the key of approval users in spec. WorkflowStepApprovalUsers = "approvalUsers" // WorkflowStepApprovedUsers is the key of approved users in spec. WorkflowStepApprovedUsers = "approvedUsers" // WorkflowStepRejectedUsers is the key of reject users in spec. WorkflowStepRejectedUsers = "rejectedUsers" )
const DeployerTypeTF string = "Terraform"
const (
// LabelPrefix is used for generate label's field names.
LabelPrefix = "label:"
)
const ResourceComponentRelationshipTypeDependency = "Dependency"
ResourceComponentRelationshipTypeDependency indicates the relationship between resource component and its dependencies.
const SubjectDomainBuiltin = "builtin"
const (
WorkflowExecutionTriggerTypeManual = "manual"
)
Variables ¶
var SubjectKinds = []string{ SubjectKindUser, SubjectKindGroup, }
var TokenKinds = []string{ TokenKindDeployment, TokenKindAPI, }
Functions ¶
func EnvironmentTypes ¶ added in v0.4.0
func EnvironmentTypes() []string
func IsEnvironmentType ¶ added in v0.4.0
func IsIdleCost ¶
func IsIdleOrManagementCost ¶
func IsManagementCost ¶
func IsRoleKind ¶
func IsSubjectKind ¶
func IsTokenKind ¶
func RolePolicyFields ¶
Types ¶
type CatalogSync ¶
type CatalogSync struct { Total int `json:"total"` Succeeded int `json:"succeeded"` Failed int `json:"failed"` Time time.Time `json:"time"` }
CatalogSync is the sync information of a catalog.
type FilterField ¶
type FilterField string
FilterField indicate type for filter field.
const ( FilterFieldConnectorID FilterField = "connector_id" FilterFieldNamespace FilterField = "namespace" FilterFieldClusterName FilterField = "cluster_name" FilterFieldNode FilterField = "node" FilterFieldController FilterField = "controller" FilterFieldControllerKind FilterField = "controller_kind" FilterFieldPod FilterField = "pod" FilterFieldContainer FilterField = "container" FilterFieldName FilterField = "name" // FilterFieldProject is "label:seal.io/project-name". FilterFieldProject = FilterField("label:" + LabelWalrusProjectName) // FilterFieldEnvironmentPath is "label:seal.io/environment-name". FilterFieldEnvironmentPath = FilterField("label:" + LabelWalrusEnvironmentPath) // FilterFieldServicePath is "label:seal.io/service-name". FilterFieldServicePath = FilterField("label:" + LabelWalrusServicePath) )
built-in filter fieldName.
func (*FilterField) IsLabel ¶
func (f *FilterField) IsLabel() bool
type FilterRule ¶
type FilterRule struct { FieldName FilterField `json:"fieldName,omitempty"` Operator Operator `json:"operator,omitempty"` Values []string `json:"values,omitempty"` IncludeAll bool `json:"includeAll,omitempty"` }
FilterRule indicate the filter rule for cost query.
type FinOpsCustomPricing ¶
type FinOpsCustomPricing struct { // CPU describing cost per core-month of CPU. CPU string `json:"cpu"` // CPU describing cost per core-month of CPU for spot nodes. SpotCPU string `json:"spotCPU"` // RAM describing cost per GiB-month of RAM/memory. RAM string `json:"ram"` // SpotRAM describing cost per GiB-month of RAM/memory for spot nodes. SpotRAM string `json:"spotRAM"` GPU string `json:"gpu"` SpotGPU string `json:"spotGPU"` // Storage describing cost per GB-month of storage (e.g. PV, disk) resources. Storage string `json:"storage"` }
FinOpsCustomPricing used to config opencost.
func DefaultFinOpsCustomPricing ¶
func DefaultFinOpsCustomPricing() *FinOpsCustomPricing
func (*FinOpsCustomPricing) IsZero ¶
func (c *FinOpsCustomPricing) IsZero() bool
type GraphEdge ¶
type GraphEdge struct { // Type indicates the type of the edge, like: Dependency or Composition. Type string `json:"type"` // Start indicates the beginning of the edge. Start GraphVertexID `json:"start"` // End indicates the ending of the edge. End GraphVertexID `json:"end"` }
GraphEdge defines the edge of graph.
type GraphVertex ¶
type GraphVertex struct { GraphVertexID `json:",inline"` // Name indicates a human-readable string of the vertex. Name string `json:"name,omitempty"` // Description indicates the detail of the vertex. Description string `json:"description,omitempty"` // Icon indicates the icon of the vertex. Icon string `json:"icon,omitempty"` // Labels indicates the labels of the vertex. Labels map[string]string `json:"labels,omitempty"` // CreateTime indicates the time to create the vertex. CreateTime *time.Time `json:"createTime,omitempty"` // UpdateTime indicates the time to update the vertex. UpdateTime *time.Time `json:"updateTime,omitempty"` // Status observes the status of the vertex. Status status.Summary `json:"status,omitempty"` // Extensions records the other information of the vertex, // e.g. the physical type, logical category or the operational keys of the resource. Extensions map[string]any `json:"extensions,omitempty"` }
GraphVertex defines the vertex of graph.
type GraphVertexID ¶
type GraphVertexID struct { // Kind indicates the kind of the resource, // which should be the same as the API handler's Kind returning. Kind string `json:"kind"` // ID indicates the identifier of the resource. ID any `json:"id,omitempty"` }
GraphVertexID defines the identifier of the vertex, which uniquely represents an API resource.
type GroupByField ¶
type GroupByField string
GroupByField indicate type for groupBy field.
const ( // Properties. GroupByFieldConnectorID GroupByField = "connector_id" GroupByFieldNamespace GroupByField = "namespace" GroupByFieldClusterName GroupByField = "cluster_name" GroupByFieldNode GroupByField = "node" GroupByFieldController GroupByField = "controller" GroupByFieldControllerKind GroupByField = "controller_kind" GroupByFieldPod GroupByField = "pod" GroupByFieldContainer GroupByField = "container" GroupByFieldWorkload GroupByField = "workload" // Time bucket. GroupByFieldDay GroupByField = "day" GroupByFieldWeek GroupByField = "week" GroupByFieldMonth GroupByField = "month" // Built-in labels. GroupByFieldProject = GroupByField("label:" + LabelWalrusProjectName) // "label:walrus.seal.io/project-name". GroupByFieldEnvironment = GroupByField( "label:" + LabelWalrusEnvironmentName, ) // "label:walrus.seal.io/environment-name". GroupByFieldService = GroupByField( "label:" + LabelWalrusServiceName, ) // "label:walrus.seal.io/service-name". GroupByFieldEnvironmentPath = GroupByField( "label:" + LabelWalrusEnvironmentPath, ) // "label:walrus.seal.io/environment-path". GroupByFieldServicePath = GroupByField("label:" + LabelWalrusServicePath) // "label:walrus.seal.io/service-path". )
built-in groupBy fieldName.
func (*GroupByField) IsLabel ¶
func (f *GroupByField) IsLabel() bool
type IdleShareOption ¶
type IdleShareOption struct {
}IdleShareOption indicate the shared cost option for idle cost.
type ItemSharedOption ¶
type ItemSharedOption struct {}
ItemSharedOption indicate the shared cost option for custom item cost query.
type ItemSharedOptions ¶
type ItemSharedOptions []ItemSharedOption
ItemSharedOptions indicate the shared cost options for custom item cost query.
type ManagementShareOption ¶
type ManagementShareOption struct {
}ManagementShareOption indicate the shared cost option for management cost.
type OutputValue ¶
type ProviderRequirement ¶
type ProviderRequirement struct { *tfconfig.ProviderRequirement Name string `json:"name"` }
ProviderRequirement include the required provider.
type QueryCondition ¶
type QueryCondition struct { Filters CostFilters `json:"filters,omitempty"` GroupBy GroupByField `json:"groupBy,omitempty"` Step Step `json:"step,omitempty"` Paging QueryPagination `json:"paging,omitempty"` Query string `json:"query"` }
QueryCondition indicated the filters, groupBys, step, and shared costs query params.
type QueryPagination ¶
type QueryPagination struct { Page int `json:"page,omitempty"` PerPage int `json:"perPage,omitempty"` }
QueryPagination indicate the pagination query config.
type ResourceComponentEndpoint ¶ added in v0.4.0
type ResourceComponentEndpoints ¶ added in v0.4.0
type ResourceComponentEndpoints []ResourceComponentEndpoint
func (ResourceComponentEndpoints) Equal ¶ added in v0.4.0
func (a ResourceComponentEndpoints) Equal(eps ResourceComponentEndpoints) bool
type ResourceComponentOperationKey ¶ added in v0.4.0
type ResourceComponentOperationKey struct { // Keys indicates the subordinate keys, // usually, it should not be valued in leaves. Keys []ResourceComponentOperationKey `json:"keys,omitempty"` // Name indicates the name of the key. Name string `json:"name"` // Value indicates the value of the key, // usually, it should be valued in leaves. Value string `json:"value,omitempty"` // Loggable indicates whether to be able to get log. Loggable *bool `json:"loggable,omitempty"` // Executable indicates whether to be able to execute remote command. Executable *bool `json:"executable,omitempty"` }
ResourceComponentOperationKey holds hierarchy query keys.
type ResourceComponentOperationKeys ¶ added in v0.4.0
type ResourceComponentOperationKeys struct { // Labels stores label of layer, // its length means each key contains levels with the same value as level. Labels []string `json:"labels,omitempty"` // Keys stores key in tree. Keys []ResourceComponentOperationKey `json:"keys,omitempty"` }
type ResourceComponentStatus ¶ added in v0.4.0
type ResourceComponentStatus struct { status.Status `json:",inline"` ResourceEndpoints ResourceComponentEndpoints `json:"resourceEndpoints,omitempty"` }
func (ResourceComponentStatus) Equal ¶ added in v0.4.0
func (a ResourceComponentStatus) Equal(newArs ResourceComponentStatus) bool
type RetryStrategy ¶ added in v0.4.0
type RetryStrategy struct { Limit int `json:"limit"` RetryPolicy v1alpha1.RetryPolicy `json:"retryPolicy"` Backoff *v1alpha1.Backoff `json:"backoff"` }
RetryStrategy is the retry strategy of a workflow step. See https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/retry-conditional.yaml
type RolePolicies ¶
type RolePolicies []RolePolicy
func DefaultRolePolicies ¶
func DefaultRolePolicies() RolePolicies
func (RolePolicies) Clone ¶
func (in RolePolicies) Clone() RolePolicies
func (RolePolicies) Deduplicate ¶
func (in RolePolicies) Deduplicate() RolePolicies
func (RolePolicies) Delete ¶
func (in RolePolicies) Delete(rs ...RolePolicy) RolePolicies
func (RolePolicies) Len ¶
func (in RolePolicies) Len() int
func (RolePolicies) Less ¶
func (in RolePolicies) Less(i, j int) bool
func (RolePolicies) Normalize ¶
func (in RolePolicies) Normalize() RolePolicies
func (RolePolicies) Sort ¶
func (in RolePolicies) Sort() RolePolicies
func (RolePolicies) Swap ¶
func (in RolePolicies) Swap(i, j int)
type RolePolicy ¶
type RolePolicy struct { // Actions specifies the including action list of this policy. Actions []string `json:"actions,omitempty"` // Resources specifies the including resource list of this policy. Resources []string `json:"resources,omitempty"` // ResourceRefers specifies the including object.Refer list of this policy, // only works if the Resources specified as ["<a kind of resource>"]. ResourceRefers []string `json:"resourceRefers,omitempty"` // Paths specifies the route-registered path list of this policy, // i.e. /resources/:id, only works if the Resources has not been specified. Paths []string `json:"paths,omitempty"` }
func (RolePolicy) IsZero ¶
func (in RolePolicy) IsZero() bool
func (RolePolicy) Normalize ¶
func (in RolePolicy) Normalize() RolePolicy
func (RolePolicy) String ¶
func (in RolePolicy) String() string
type Schema ¶ added in v0.4.0
Schema specifies the openAPI schema with variables and outputs.
func (*Schema) Intersect ¶ added in v0.4.0
Intersect sets variables & outputs schema of s to intersection of s and s2.
func (*Schema) OutputSchema ¶ added in v0.4.0
OutputSchema returns the outputs' schema.
func (*Schema) SetOutputSchema ¶ added in v0.4.0
func (*Schema) SetVariableSchema ¶ added in v0.4.0
func (*Schema) VariableSchema ¶ added in v0.4.0
VariableSchema returns the variables' schema.
type Selector ¶ added in v0.4.0
type Selector struct { ProjectName string `json:"projectName,omitempty"` EnvironmentName string `json:"environmentName,omitempty"` EnvironmentType string `json:"environmentType,omitempty"` ResourceLabels map[string]string `json:"resourceLabels,omitempty"` EnvironmentLabels map[string]string `json:"environmentLabels,omitempty"` }
type SharedCostOptions ¶
type SharedCostOptions struct {}
SharedCostOptions indicate the shared cost options for shared cost query.
type SharingStrategy ¶
type SharingStrategy string
SharingStrategy indicate the share cost strategy.
const ( SharingStrategyEqually SharingStrategy = "equally" SharingStrategyProportionally SharingStrategy = "proportionally" )
type TemplateVersionSchema ¶ added in v0.4.0
type TemplateVersionSchema struct { Schema `json:",inline"` // TemplateVersionSchemaData include the data of this template version. TemplateVersionSchemaData `json:",inline"` }
TemplateVersionSchema include the internal template variables schema and template data.
func (*TemplateVersionSchema) Validate ¶ added in v0.4.0
func (s *TemplateVersionSchema) Validate() error
Validate reports if the schema is valid.
type TemplateVersionSchemaData ¶ added in v0.4.0
type TemplateVersionSchemaData struct { // Readme specifies the readme of this template. Readme string `json:"readme"` // RequiredProviders specifies the required providers of this template. RequiredProviders []ProviderRequirement `json:"requiredProviders"` }
TemplateVersionSchemaData include the data of this template version.
type UISchema ¶ added in v0.4.0
type UISchema Schema
UISchema include the UI schema that users can customize.
func (*UISchema) VariableSchema ¶ added in v0.4.0
VariableSchema returns the variables' schema.
type WorkflowExecutionTrigger ¶ added in v0.4.0
WorkflowExecutionTrigger is the trigger of a workflow execution.
type WorkflowStepApprovalSpec ¶ added in v0.4.0
type WorkflowStepApprovalSpec struct { ApprovalUsers []object.ID `json:"approvalUsers"` ApprovedUsers []object.ID `json:"approvedUsers"` RejectedUsers []object.ID `json:"rejectedUsers"` Type string `json:"approvalType"` }
func NewWorkflowStepApprovalSpec ¶ added in v0.4.0
func NewWorkflowStepApprovalSpec(spec map[string]any) (*WorkflowStepApprovalSpec, error)
func (*WorkflowStepApprovalSpec) IsApprovalUser ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) IsApprovalUser(user object.ID) bool
func (*WorkflowStepApprovalSpec) IsApproved ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) IsApproved() bool
func (*WorkflowStepApprovalSpec) IsRejected ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) IsRejected() bool
func (*WorkflowStepApprovalSpec) SetApprovedUser ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) SetApprovedUser(user object.ID) error
func (*WorkflowStepApprovalSpec) SetRejectedUser ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) SetRejectedUser(user object.ID) error
func (*WorkflowStepApprovalSpec) SetUserApproval ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) SetUserApproval(user object.ID, approved bool) error
SetUserApproval sets the user approval status.
func (*WorkflowStepApprovalSpec) ToAttributes ¶ added in v0.4.0
func (s *WorkflowStepApprovalSpec) ToAttributes() map[string]any