Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayName(resType string) string
- func Equal(x, y ResourceSpec) bool
- func ErrorInvalidItemType(expected, actual interface{}) error
- func FromAny(src *anypb.Any, spec ResourceSpec) error
- func FromJSON(src []byte, spec ResourceSpec) error
- func FromYAML(src []byte, spec ResourceSpec) error
- func FullName(spec ResourceSpec) string
- func GetDisplayName(r Resource) string
- func Hash(resource Resource) []byte
- func HashMeta(r Resource) []byte
- func IsEmpty(spec ResourceSpec) bool
- func IsLocallyOriginated(mode config_core.CpMode, r Resource) bool
- func PluralType(resType string) string
- func ResourceListByMesh(rl ResourceList) (map[string]ResourceList, error)
- func ResourceListHash(rl ResourceList) []byte
- func ResourceOrigin(rm ResourceMeta) (mesh_proto.ResourceOrigin, bool)
- func ToAny(spec ResourceSpec) (*anypb.Any, error)
- func ToJSON(spec ResourceSpec) ([]byte, error)
- func ToYAML(spec ResourceSpec) ([]byte, error)
- func Validate(resource Resource) error
- func ZoneOfResource(res Resource) string
- type ByMeta
- type DDSFlagType
- type OverviewResource
- type Pagination
- type Policy
- type PolicyItem
- type PolicyWithFromList
- type PolicyWithSingleItem
- type PolicyWithToList
- type Resource
- type ResourceHasher
- type ResourceKey
- type ResourceList
- type ResourceMeta
- type ResourceNameExtensions
- type ResourceScope
- type ResourceSpec
- type ResourceType
- type ResourceTypeDescriptor
- func (d ResourceTypeDescriptor) HasInsights() bool
- func (d ResourceTypeDescriptor) NewInsight() Resource
- func (d ResourceTypeDescriptor) NewInsightList() ResourceList
- func (d ResourceTypeDescriptor) NewList() ResourceList
- func (d ResourceTypeDescriptor) NewObject() Resource
- func (d ResourceTypeDescriptor) NewOverview() Resource
- func (d ResourceTypeDescriptor) NewOverviewList() ResourceList
- type ResourceValidator
- type ResourceWithAddress
- type ResourceWithInsights
- type TransformDefaultAfterMerge
- type TypeFilter
- func AllowedToInspect() TypeFilter
- func HasDDSFlag(flagType DDSFlagType) TypeFilter
- func HasDdsEnabled() TypeFilter
- func HasDubboctlEnabled() TypeFilter
- func HasScope(scope ResourceScope) TypeFilter
- func HasWsEnabled() TypeFilter
- func IsPolicy() TypeFilter
- func Named(names ...ResourceType) TypeFilter
- func Not(filter TypeFilter) TypeFilter
- func Or(filters ...TypeFilter) TypeFilter
- type TypeFilterFn
Constants ¶
const ( DefaultMesh = "default" // NoMesh defines a marker that resource is not bound to a Mesh. // Resources not bound to a mesh (ScopeGlobal) should have an empty string in Mesh field. NoMesh = "" )
const ( ScopeMesh = "Mesh" ScopeGlobal = "Global" )
const ( // DDSDisabledFlag is a flag that indicates that this resource type is not sent using DDS. DDSDisabledFlag = DDSFlagType(0) // ZoneToGlobalFlag is a flag that indicates that this resource type is sent from Zone CP to Global CP. ZoneToGlobalFlag = DDSFlagType(1) // GlobalToAllZonesFlag is a flag that indicates that this resource type is sent from Global CP to all zones. GlobalToAllZonesFlag = DDSFlagType(1 << 2) // GlobalToAllButOriginalZoneFlag is a flag that indicates that this resource type is sent from Global CP to // all zones except the zone where the resource was originally created. Today the only resource that has this // flag is ZoneIngress. GlobalToAllButOriginalZoneFlag = DDSFlagType(1 << 3) )
const ( // GlobalToZoneSelector is selector for all flags that indicate resource sync from Global to Zone. // Can't be used as DDS flag for resource type. GlobalToZoneSelector = GlobalToAllZonesFlag | GlobalToAllButOriginalZoneFlag // AllowedOnGlobalSelector is selector for all flags that indicate resource can be created on Global. AllowedOnGlobalSelector = GlobalToAllZonesFlag // AllowedOnZoneSelector is selector for all flags that indicate resource can be created on Zone. AllowedOnZoneSelector = ZoneToGlobalFlag | GlobalToAllButOriginalZoneFlag )
const ( // K8sNamespaceComponent identifies the namespace component of a resource name on Kubernetes. // The value is considered a part of user-facing dubbo API and should not be changed lightly. // The value has a format of a Kubernetes label name. K8sNamespaceComponent = "k8s.dubbo.io/namespace" // K8sNameComponent identifies the name component of a resource name on Kubernetes. // The value is considered a part of user-facing dubbo API and should not be changed lightly. // The value has a format of a Kubernetes label name. K8sNameComponent = "k8s.dubbo.io/name" )
Variables ¶
var ResourceNameExtensionsUnsupported = ResourceNameExtensions(nil)
ResourceNameExtensionsUnsupported is a convenience constant that is meant to make source code more readable.
Functions ¶
func DisplayName ¶
func Equal ¶
func Equal(x, y ResourceSpec) bool
func ErrorInvalidItemType ¶
func ErrorInvalidItemType(expected, actual interface{}) error
func FromJSON ¶
func FromJSON(src []byte, spec ResourceSpec) error
func FromYAML ¶
func FromYAML(src []byte, spec ResourceSpec) error
func FullName ¶
func FullName(spec ResourceSpec) string
func GetDisplayName ¶
func IsEmpty ¶
func IsEmpty(spec ResourceSpec) bool
func IsLocallyOriginated ¶
func IsLocallyOriginated(mode config_core.CpMode, r Resource) bool
func PluralType ¶
func ResourceListByMesh ¶
func ResourceListByMesh(rl ResourceList) (map[string]ResourceList, error)
func ResourceListHash ¶
func ResourceListHash(rl ResourceList) []byte
func ResourceOrigin ¶
func ResourceOrigin(rm ResourceMeta) (mesh_proto.ResourceOrigin, bool)
func ToJSON ¶
func ToJSON(spec ResourceSpec) ([]byte, error)
func ToYAML ¶
func ToYAML(spec ResourceSpec) ([]byte, error)
func ZoneOfResource ¶
ZoneOfResource returns zone from which the resource was synced to Global CP There is no information in the resource itself whether the resource is synced or created on the CP. Therefore, it's a caller responsibility to make use it only on synced resources.
Types ¶
type DDSFlagType ¶
type DDSFlagType uint32
func (DDSFlagType) Has ¶
func (kt DDSFlagType) Has(flag DDSFlagType) bool
Has return whether this flag has all the passed flags on.
type OverviewResource ¶
type Pagination ¶
func (*Pagination) GetNextOffset ¶
func (p *Pagination) GetNextOffset() string
func (*Pagination) GetTotal ¶
func (p *Pagination) GetTotal() uint32
func (*Pagination) SetNextOffset ¶
func (p *Pagination) SetNextOffset(nextOffset string)
func (*Pagination) SetTotal ¶
func (p *Pagination) SetTotal(total uint32)
type Policy ¶
type Policy interface { ResourceSpec }
type PolicyItem ¶
type PolicyItem interface {
GetDefault() interface{}
}
type PolicyWithFromList ¶
type PolicyWithFromList interface { Policy GetFromList() []PolicyItem }
type PolicyWithSingleItem ¶
type PolicyWithSingleItem interface { Policy GetPolicyItem() PolicyItem }
type PolicyWithToList ¶
type PolicyWithToList interface { Policy GetToList() []PolicyItem }
type Resource ¶
type Resource interface { GetMeta() ResourceMeta SetMeta(ResourceMeta) GetSpec() ResourceSpec SetSpec(ResourceSpec) error Descriptor() ResourceTypeDescriptor }
type ResourceHasher ¶
type ResourceHasher interface {
Hash() []byte
}
type ResourceKey ¶
func MetaToResourceKey ¶
func MetaToResourceKey(meta ResourceMeta) ResourceKey
func ResourceListToResourceKeys ¶
func ResourceListToResourceKeys(rl ResourceList) []ResourceKey
func WithMesh ¶
func WithMesh(mesh string, name string) ResourceKey
func WithoutMesh ¶
func WithoutMesh(name string) ResourceKey
type ResourceList ¶
type ResourceList interface { GetItemType() ResourceType GetItems() []Resource NewItem() Resource AddItem(Resource) error GetPagination() *Pagination SetPagination(pagination Pagination) }
type ResourceMeta ¶
type ResourceNameExtensions ¶
ResourceNameExtensions represents an composite resource name in environments other than Universal.
E.g., name of a Kubernetes resource consists of a namespace component and a name component that is local to that namespace.
Technically, ResourceNameExtensions is a mapping between a component identifier and a component value, e.g.
"k8s.dubbo.io/namespace" => "my-namespace" "k8s.dubbo.io/name" => "my-policy"
Component identifier must be considered a part of user-facing dubbo API. In other words, it is supposed to be visible to users and should not be changed lightly.
Component identifier might have any value, however, it's preferable to choose one that is intuitive to users of that particular environment. E.g., on Kubernetes component identifiers should use a label name format, like in "k8s.dubbo.io/namespace" and "k8s.dubbo.io/name".
type ResourceScope ¶
type ResourceScope string
type ResourceSpec ¶
type ResourceSpec interface{}
type ResourceType ¶
type ResourceType string
type ResourceTypeDescriptor ¶
type ResourceTypeDescriptor struct { // Name identifier of this resourceType this maps to the k8s entity and universal name. Name ResourceType // Resource a created element of this type Resource Resource // ResourceList a create list container of this type ResourceList ResourceList // ReadOnly if this type will be created, modified and deleted by the system. ReadOnly bool // AdminOnly if this type requires users to be admin to access. AdminOnly bool // Scope whether this resource is Global or Mesh scoped. Scope ResourceScope // DDSFlags a set of flags that defines how this entity is sent using DDS (if unset DDS is disabled). DDSFlags DDSFlagType // WsPath the path to access on the REST api. WsPath string // DubboctlArg the name of the cmdline argument when doing `get` or `delete`. DubboctlArg string // DubboctlListArg the name of the cmdline argument when doing `list`. DubboctlListArg string // AllowToInspect if it's required to generate Inspect API endpoint for this type AllowToInspect bool // IsPolicy if this type is a policy (Dataplanes, Insights, Ingresses are not policies as they describe either metadata or workload, Retries are policies). IsPolicy bool // DisplayName the name of the policy showed as plural to be displayed in the UI and maybe CLI SingularDisplayName string // PluralDisplayName the name of the policy showed as plural to be displayed in the UI and maybe CLI PluralDisplayName string // IsExperimental indicates if a policy is in experimental state (might not be production ready). IsExperimental bool // IsPluginOriginated indicates if a policy is implemented as a plugin IsPluginOriginated bool // Schema contains an unmarshalled OpenAPI schema of the resource Schema *spec.Schema // Insight contains the insight type attached to this resourceType Insight Resource // Overview contains the overview type attached to this resourceType Overview Resource // DumpForGlobal whether resources of this type should be dumped when exporting a zone to migrate to global DumpForGlobal bool }
func (ResourceTypeDescriptor) HasInsights ¶
func (d ResourceTypeDescriptor) HasInsights() bool
func (ResourceTypeDescriptor) NewInsight ¶
func (d ResourceTypeDescriptor) NewInsight() Resource
func (ResourceTypeDescriptor) NewInsightList ¶
func (d ResourceTypeDescriptor) NewInsightList() ResourceList
func (ResourceTypeDescriptor) NewList ¶
func (d ResourceTypeDescriptor) NewList() ResourceList
func (ResourceTypeDescriptor) NewObject ¶
func (d ResourceTypeDescriptor) NewObject() Resource
func (ResourceTypeDescriptor) NewOverview ¶
func (d ResourceTypeDescriptor) NewOverview() Resource
func (ResourceTypeDescriptor) NewOverviewList ¶
func (d ResourceTypeDescriptor) NewOverviewList() ResourceList
type ResourceValidator ¶
type ResourceValidator interface {
Validate() error
}
type ResourceWithAddress ¶
type ResourceWithInsights ¶
type ResourceWithInsights interface { NewInsightList() ResourceList NewOverviewList() ResourceList }
type TransformDefaultAfterMerge ¶
type TransformDefaultAfterMerge interface {
Transform()
}
type TypeFilter ¶
type TypeFilter interface {
Apply(descriptor ResourceTypeDescriptor) bool
}
func AllowedToInspect ¶
func AllowedToInspect() TypeFilter
func HasDDSFlag ¶
func HasDDSFlag(flagType DDSFlagType) TypeFilter
func HasDdsEnabled ¶
func HasDdsEnabled() TypeFilter
func HasDubboctlEnabled ¶
func HasDubboctlEnabled() TypeFilter
func HasScope ¶
func HasScope(scope ResourceScope) TypeFilter
func HasWsEnabled ¶
func HasWsEnabled() TypeFilter
func IsPolicy ¶
func IsPolicy() TypeFilter
func Named ¶
func Named(names ...ResourceType) TypeFilter
func Not ¶
func Not(filter TypeFilter) TypeFilter
func Or ¶
func Or(filters ...TypeFilter) TypeFilter
type TypeFilterFn ¶
type TypeFilterFn func(descriptor ResourceTypeDescriptor) bool
func (TypeFilterFn) Apply ¶
func (f TypeFilterFn) Apply(descriptor ResourceTypeDescriptor) bool