types

package
v0.3.1-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
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"
)
View Source
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.

View Source
const (
	WalrusSystemNamespace      = "walrus-system"
	DeployerServiceAccountName = "walrus"
)
View Source
const (
	ConnectorTypeK8s     string = "Kubernetes"
	ConnectorTypeAlibaba string = "Alibaba"
	ConnectorTypeAWS     string = "AWS"
)
View Source
const (
	ConnectorCategoryKubernetes     string = "Kubernetes"
	ConnectorCategoryCustom         string = "Custom"
	ConnectorCategoryVersionControl string = "VersionControl"
	ConnectorCategoryCloudProvider  string = "CloudProvider"
)
View Source
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__"
)
View Source
const (
	GitDriverGithub = "Github"
	GitDriverGitlab = "Gitlab"
)
View Source
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"
)
View Source
const (
	RoleKindSystem  = "system"
	RoleKindProject = "project"
)
View Source
const (
	SystemRoleAnonymity        = "system/anonymity"
	SystemRoleUser             = "system/user"
	SystemRolePlatformEngineer = "system/platform-engineer"
	SystemRoleAdmin            = "system/admin"

	ProjectRoleViewer = "project/viewer"
	ProjectRoleMember = "project/member"
	ProjectRoleOwner  = "project/owner"
)
View Source
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"
)
View Source
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"
)
View Source
const (
	// ServiceResourceShapeClass indicates the resource is a class.
	ServiceResourceShapeClass = "class"
	// ServiceResourceShapeInstance indicates the resource is an instance that implements a class.
	ServiceResourceShapeInstance = "instance"
)
View Source
const (
	SubjectKindUser  = "user"
	SubjectKindGroup = "group"
)
View Source
const (
	TokenKindDeployment = "deployment"
	TokenKindAPI        = "api"
)
View Source
const DeployerTypeTF string = "Terraform"
View Source
const (
	// LabelPrefix is used for generate label's field names.
	LabelPrefix = "label:"
)
View Source
const ServiceResourceRelationshipTypeDependency = "Dependency"

ServiceResourceRelationshipTypeDependency indicates the relationship between service resource and its dependencies.

View Source
const SubjectDomainBuiltin = "builtin"

Variables

Functions

func IsIdleCost

func IsIdleCost(name string) bool

func IsIdleOrManagementCost

func IsIdleOrManagementCost(name string) bool

func IsManagementCost

func IsManagementCost(name string) bool

func IsRoleKind

func IsRoleKind(s string) bool

func IsSubjectKind

func IsSubjectKind(s string) bool

func IsTokenKind

func IsTokenKind(s string) bool

func RolePolicyFields

func RolePolicyFields(f ...string) []string

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 CostFilters

type CostFilters [][]FilterRule

CostFilters indicate the filters for cost query.

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 {
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

IdleShareOption indicate the shared cost option for idle cost.

type ItemSharedOption

type ItemSharedOption struct {
	Filters         CostFilters     `json:"filters,omitempty"`
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

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 {
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

ManagementShareOption indicate the shared cost option for management cost.

type Operator

type Operator string

Operator for filter rule.

const (
	OperatorIn    Operator = "in"
	OperatorNotIn Operator = "notin"
)

type OutputValue

type OutputValue struct {
	Name      string         `json:"name,omitempty"`
	Value     property.Value `json:"value,omitempty"`
	Type      property.Type  `json:"type,omitempty"`
	Sensitive bool           `json:"sensitive,omitempty"`
}

type PVCost

type PVCost struct {
	Cost  float64 `json:"cost"`
	Bytes float64 `json:"bytes"`
}

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"`
	SharedOptions *SharedCostOptions `json:"sharedOptions,omitempty"`
}

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 ServiceResourceEndpoint struct {
	// EndpointType is the extra info for service resource type, like nodePort, loadBalance.
	EndpointType string `json:"endpointType,omitempty"`
	// Endpoints are the access endpoints.
	Endpoints []string `json:"endpoints,omitempty"`
}

type ServiceResourceEndpoints

type ServiceResourceEndpoints []ServiceResourceEndpoint

func (ServiceResourceEndpoints) Equal

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

type SharedCostOptions

type SharedCostOptions struct {
	Item       ItemSharedOptions      `json:"item,omitempty"`
	Idle       *IdleShareOption       `json:"idle,omitempty"`
	Management *ManagementShareOption `json:"management,omitempty"`
}

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 Step

type Step string

Step indicate the time step to aggregate cost.

const (
	StepDay   Step = "day"
	StepWeek  Step = "week"
	StepMonth Step = "month"
)

type TemplateSchema

type TemplateSchema struct {
	Readme            string                `json:"readme"`
	Variables         property.Schemas      `json:"variables"`
	Outputs           property.Schemas      `json:"outputs"`
	RequiredProviders []ProviderRequirement `json:"requiredProviders"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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