Documentation ¶
Index ¶
- Constants
- Variables
- 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 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 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 ServiceResourceEndpoint
- type ServiceResourceEndpoints
- type ServiceResourceOperationKey
- type ServiceResourceOperationKeys
- type ServiceResourceStatus
- type SharedCostOptions
- type SharingStrategy
- type Step
- type TemplateSchema
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" )
built-in labels.
const ( WalrusSystemNamespace = "walrus-system" DeployerServiceAccountName = "walrus" )
const ( ConnectorTypeK8s 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 ( GitDriverGithub = "Github" GitDriverGitlab = "Gitlab" )
const ( // VertexKindService indicates the vertex kind of service, it contains resource groups. VertexKindService = "Service" // VertexKindServiceResourceGroup indicates the group resource that generates same type resources. VertexKindServiceResourceGroup = "ServiceResourceGroup" // VertexKindServiceResource indicates the vertex kind of service resource. VertexKindServiceResource = "ServiceResource" // 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 ( RoleKindSystem = "system" RoleKindProject = "project" )
const ( SystemRoleAnonymity = "system/anonymity" SystemRoleUser = "system/user" SystemRolePlatformEngineer = "system/platform-engineer" SystemRoleAdmin = "system/admin" ProjectRoleViewer = "project/viewer" ProjectRoleMember = "project/member" ProjectRoleOwner = "project/owner" )
const ( // ServiceRelationshipTypeImplicit indicates the service dependency is auto created by resource reference. ServiceRelationshipTypeImplicit = "Implicit" // ServiceRelationshipTypeExplicit indicates the service dependency is manually created by user. ServiceRelationshipTypeExplicit = "Explicit" )
const ( // ServiceResourceModeManaged indicates the resource created to target platform, // it is writable(update or delete). ServiceResourceModeManaged = "managed" // ServiceResourceModeData indicates the resource read from target platform, // it is read-only. ServiceResourceModeData = "data" // ServiceResourceModeDiscovered indicates the resource discovered from target platform, // it inherits its composition's characteristic to be writable or not. ServiceResourceModeDiscovered = "discovered" )
const ( // ServiceResourceShapeClass indicates the resource is a class. ServiceResourceShapeClass = "class" // ServiceResourceShapeInstance indicates the resource is an instance that implements a class. ServiceResourceShapeInstance = "instance" )
const ( SubjectKindUser = "user" SubjectKindGroup = "group" )
const ( TokenKindDeployment = "deployment" TokenKindAPI = "api" )
const DeployerTypeTF string = "Terraform"
const (
// LabelPrefix is used for generate label's field names.
LabelPrefix = "label:"
)
const ServiceResourceRelationshipTypeDependency = "Dependency"
ServiceResourceRelationshipTypeDependency indicates the relationship between service resource and its dependencies.
const SubjectDomainBuiltin = "builtin"
Variables ¶
var RoleKinds = []string{ RoleKindSystem, RoleKindProject, }
var SubjectKinds = []string{ SubjectKindUser, SubjectKindGroup, }
var TokenKinds = []string{ TokenKindDeployment, TokenKindAPI, }
Functions ¶
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"` // 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"` }
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 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"` // ResourceReferExcludes specifies the excluding object.Refer list of this policy, // only works if the Resources specified as ["<a kind of resource>"] // and ResourceRefers specified as ["*"]. ResourceReferExcludes []string `json:"resourceReferExcludes,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 ServiceResourceEndpoint ¶
type ServiceResourceEndpoints ¶
type ServiceResourceEndpoints []ServiceResourceEndpoint
func (ServiceResourceEndpoints) Equal ¶
func (a ServiceResourceEndpoints) Equal(eps ServiceResourceEndpoints) bool
type ServiceResourceOperationKey ¶
type ServiceResourceOperationKey struct { // Keys indicates the subordinate keys, // usually, it should not be valued in leaves. Keys []ServiceResourceOperationKey `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"` }
ServiceResourceOperationKey holds hierarchy query keys.
type ServiceResourceOperationKeys ¶
type ServiceResourceOperationKeys 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 []ServiceResourceOperationKey `json:"keys,omitempty"` }
type ServiceResourceStatus ¶
type ServiceResourceStatus struct { status.Status `json:",inline"` ResourceEndpoints ServiceResourceEndpoints `json:"resourceEndpoints,omitempty"` }
func (ServiceResourceStatus) Equal ¶
func (a ServiceResourceStatus) Equal(newArs ServiceResourceStatus) bool
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" )