Documentation
¶
Overview ¶
Package smb from common/admin contains a set of APIs used to interact with and administer SMB support for ceph clusters.
The Ceph smb mgr module is based on the concept of resources. Resource descriptions are used to create, update, or delete configuration state in the Ceph cluster and the Ceph cluster will attempt to configure SMB Servers based on these resources.
Resource types include Cluster, JoinAuth, UsersAndGroups, and Share. To modify the state on the Ceph cluster use the Apply function. To query the state of the resources on the Ceph cluster use the Show function. Resources that are to be deleted should have an Intent value of Removed. Resources being updated or created must have an Intent value of Present.
Index ¶
- Constants
- Variables
- func ValidateResources(resources []Resource) error
- type AccessCategory
- type AccessMode
- type Admin
- func (a *Admin) Apply(resources []Resource, opts *ApplyOptions) (ResultGroup, error)
- func (a *Admin) RemoveCluster(clusterID string) error
- func (a *Admin) RemoveJoinAuth(authID string) error
- func (a *Admin) RemoveShare(clusterID, shareID string) error
- func (a *Admin) RemoveUsersAndGroups(ugID string) error
- func (a *Admin) Show(refs []ResourceRef, opts *ShowOptions) ([]Resource, error)
- type ApplyOptions
- type CephFSProvider
- type CephFSSource
- type ChildResourceID
- type Cluster
- type ClusterAuthMode
- type Clustering
- type Commander
- type DomainSettings
- type GroupInfo
- type Intent
- type JoinAuth
- type JoinAuthSource
- type JoinAuthValues
- type PasswordFilter
- type Placement
- type PublicAddress
- type Resource
- type ResourceID
- type ResourceRef
- type ResourceType
- type Result
- type ResultGroup
- type Service
- type Share
- type ShareAccess
- type ShowOptions
- type SourceType
- type UserGroupSource
- type UserInfo
- type UsersAndGroups
- func (ug *UsersAndGroups) Identity() ResourceRef
- func (ug *UsersAndGroups) Intent() Intent
- func (ug *UsersAndGroups) MarshalJSON() ([]byte, error)
- func (ug *UsersAndGroups) SetValues(users []UserInfo, groups []GroupInfo) *UsersAndGroups
- func (*UsersAndGroups) Type() ResourceType
- func (ug *UsersAndGroups) Validate() error
- type UsersAndGroupsValues
Constants ¶
const ( // Present resources will be created or updated. Present = Intent("present") // Removed resources will be removed or ignored. Removed = Intent("removed") )
const ( // ClusterType resources represent SMB clusters. ClusterType = ResourceType("ceph.smb.cluster") ShareType = ResourceType("ceph.smb.share") // JoinAuthType resources contain information used to join a domain. JoinAuthType = ResourceType("ceph.smb.join.auth") // UsersAndGroupsType resources contain data used to define users and groups. UsersAndGroupsType = ResourceType("ceph.smb.usersgroups") // TLSCredentialType resources contain data used to establish TLS // secured network connections. TLSCredentialType = ResourceType("ceph.smb.tls.credential") )
const ( // ActiveDirectoryAuth indicates a cluster will use an active directory domain. ActiveDirectoryAuth = ClusterAuthMode("active-directory") // UserAuth indicates a cluster will use locally defined users and groups. UserAuth = ClusterAuthMode("user") )
const ( // DefaultClustering indicates SMB clustering should be enabled based on // the placement value. DefaultClustering = Clustering("default") // NeverClustering indicates SMB clustering should never be enabled. NeverClustering = Clustering("never") // AlwaysClustering indicates SMB clustering should always be enabled. AlwaysClustering = Clustering("always") )
const ( // UserAccess indicates a share login control applies to a user. UserAccess = AccessCategory("user") // GroupAccess indicates a share login control applies to a group. GroupAccess = AccessCategory("group") )
const ( // ReadAccess grants read-only access to a share. ReadAccess = AccessMode("read") // ReadWriteAccess grants read-write access to a share. ReadWriteAccess = AccessMode("read-write") // AdminAccess grants administrative access to a share. AdminAccess = AccessMode("admin") // NoneAccess denies access to a share. NoneAccess = AccessMode("none") )
const ( // SambaVFSProvider sets the default VFS based provider. SambaVFSProvider = CephFSProvider("samba-vfs") // SambaVFSNewProvider sets the new Ceph module VFS based provider. SambaVFSNewProvider = CephFSProvider("samba-vfs/new") // SambaVFSClassicProvider sets the older Ceph module VFS based provider. SambaVFSClassicProvider = CephFSProvider("samba-vfs/classic") // SambaVFSProxiedProvider sets the new Ceph module VFS based provider with CephFS proxy server support. SambaVFSProxiedProvider = CephFSProvider("samba-vfs/proxied") )
const ( // PasswordFilterUnset specifies no password filter. PasswordFilterUnset = PasswordFilter("") // PasswordFilterNone specifies no password filtering should be done. PasswordFilterNone = PasswordFilter("none") // PasswordFilterBase64 specifies passwords should be converted from/to // base64 encoding. PasswordFilterBase64 = PasswordFilter("base64") // PasswordFilterHidden specifies passwords should be replaced by opaque // placeholder values. PasswordFilterHidden = PasswordFilter("hidden") )
const ( // SMBService represents the core smb network file system service. SMBService = Service("smb") // SMBMetricsService represents the prometheus style metrics service. SMBMetricsService = Service("smbmetrics") // CTDBService represents the ctdb service used to coordinate clusters. CTDBService = Service("ctdb") // RemoteControlService represents a cloud compatible remote control // service (based on gRPC). RemoteControlService = Service("remote-control") )
const ( // ResourceSource indicates that another resource is being referenced. ResourceSource = SourceType("resource") )
Variables ¶
var ErrUnknownResourceType = errors.New("unknown resource type")
ErrUnknownResourceType indicates that JSON values contained a resource type value unknown to this library.
Functions ¶
func ValidateResources ¶
ValidateResources returns an error if any resource in the supplied slice is invalid. It returns nil if all resources are valid. The first invalid resource will be identified and described in the resulting error.
Types ¶
type AccessCategory ¶
type AccessCategory string
AccessCategory determines if share login controls applies to a user or group.
type AccessMode ¶
type AccessMode string
AccessMode determines what kind of access a share login control will grant.
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin is used to administer ceph smb features.
func NewFromConn ¶
NewFromConn creates an new management object from a preexisting rados connection. The existing connection can be rados.Conn or any type implementing the RadosCommander interface.
func (*Admin) Apply ¶
func (a *Admin) Apply(resources []Resource, opts *ApplyOptions) ( ResultGroup, error)
Apply changes to the resource descriptions stored on the Ceph cluster. Supply one or more Resource objects in the slice and these resources will be created, updated, or removed based on the Resource's parameters. An Intent() of Present will create or update a resource. An Intent() of Removed will remove a matching resource or be a no-op if nothing is matched. The opts value can be nil for default behavior or supplied to customize the way the command processes inputs and outputs. Currently, the password values supplied in the objects and returned in the result can be filtered depending on the fields in the ApplyOptions structure.
Similar To:
ceph smb apply -i -
func (*Admin) RemoveCluster ¶
RemoveCluster will remove a Cluster resource with a matching ID value from the Ceph cluster. This is a convenience function that creates a Cluster resource to remove and then applies it in one step.
func (*Admin) RemoveJoinAuth ¶
RemoveJoinAuth will remove a JoinAuth resource with a matching ID value from the Ceph cluster. This is a convenience function that creates a JoinAuth resource to remove and then applies it in one step.
func (*Admin) RemoveShare ¶
RemoveShare will remove a Share resource with matching ID values from the Ceph cluster. This is a convenience function that creates a Share resource to remove and then applies it in one step.
func (*Admin) RemoveUsersAndGroups ¶
RemoveUsersAndGroups will remove a UsersAndGroups resource with a matching ID value from the Ceph cluster. This is a convenience function that creates a UsersAndGroups resource to remove and then applies it in one step.
func (*Admin) Show ¶
func (a *Admin) Show(refs []ResourceRef, opts *ShowOptions) ( []Resource, error)
Show smb module resource descriptions stored on the Ceph cluster. If any values are provided in the refs slice, the function will query only resources matching those references. These may be all matching resources of a type or more specific references with IDs. The opts value can be nil for default behavior or supplied to customize the query results. Currently, ShowOptions can be used to filter password values.
Similar To:
ceph smb show
type ApplyOptions ¶
type ApplyOptions struct {
// PasswordFilter can be used to filter/obfuscate password values
// sent to the Ceph cluster.
PasswordFilter PasswordFilter
// PasswordFilterOut can be used to filter/obfuscate password values
// returned from the Ceph cluster.
PasswordFilterOut PasswordFilter
}
ApplyOptions controls optional behavior of the Apply function.
type CephFSProvider ¶
type CephFSProvider string
CephFSProvider indicates what method will be used to bridge smb services to CephFS.
type CephFSSource ¶
type CephFSSource struct {
Volume string `json:"volume"`
SubVolumeGroup string `json:"subvolumegroup,omitempty"`
SubVolume string `json:"subvolume,omitempty"`
Path string `json:"path"`
Provider CephFSProvider `json:"provider,omitempty"`
}
CephFSSource defines parameters that connect an SMB Share to a path or subvolume in CephFS.
type ChildResourceID ¶
type ChildResourceID struct {
ResourceType ResourceType
ParentID string
ID string
}
ChildResourceID refers to a resource via its ResourceType value, the ID of a parent resource (typically a cluster) and a string ID for the child.
func (ChildResourceID) String ¶
func (c ChildResourceID) String() string
String returns a string value referring to a child resource ID.
func (ChildResourceID) Type ¶
func (c ChildResourceID) Type() ResourceType
Type returns a ResourceType value.
type Cluster ¶
type Cluster struct {
IntentValue Intent `json:"intent"`
ClusterID string `json:"cluster_id"`
AuthMode ClusterAuthMode `json:"auth_mode"`
DomainSettings *DomainSettings `json:"domain_settings,omitempty"`
UserGroupSettings []UserGroupSource `json:"user_group_settings,omitempty"`
CustomDNS []string `json:"custom_dns,omitempty"`
Placement Placement `json:"placement,omitempty"`
Clustering Clustering `json:"clustering,omitempty"`
PublicAddrs []PublicAddress `json:"public_addrs,omitempty"`
}
Cluster configures an SMB Cluster resource that is managed within a Ceph cluster.
func NewActiveDirectoryCluster ¶
NewActiveDirectoryCluster returns a new Cluster with default values set to create/update a cluster with active directory authentication. In addition to the cluster name, this function accepts the name of the domain/realm and zero or more ID values naming ceph.smb.join.auth resources.
func NewClusterToRemove ¶
NewClusterToRemove return a new Cluster with default values set to remove a cluster from management.
func NewUserCluster ¶
NewUserCluster returns a new Cluster with default values set to create/update a cluster with local users-and-groups defined. In addition to the cluster name, this function accepts zero or more ID values naming ceph.smb.usersgroups resources.
func (*Cluster) Identity ¶
func (cluster *Cluster) Identity() ResourceRef
Identity returns a ResourceRef identifying this cluster.
func (*Cluster) MarshalJSON ¶
MarshalJSON supports marshalling a cluster to JSON.
func (*Cluster) SetPlacement ¶
SetPlacement modifies a cluster's placement settings.
type ClusterAuthMode ¶
type ClusterAuthMode string
ClusterAuthMode indicates how a Cluster should authenticate users.
type Clustering ¶
type Clustering string
Clustering indicates how an abstract cluster should be managed.
type Commander ¶
type Commander interface {
ccom.RadosBufferCommander
}
Commander interface supports sending commands to Ceph.
type DomainSettings ¶
type DomainSettings struct {
// Realm identifies the AD/Kerberos Realm to use.
Realm string `json:"realm"`
// JoinSources should contain one or more JoinAuthSource that
// the cluster may use to join a domain.
JoinSources []JoinAuthSource `json:"join_sources"`
}
DomainSettings are used to configure domain related settings for a cluster using active directory authentication.
type GroupInfo ¶
type GroupInfo struct {
Name string `json:"name"`
}
GroupInfo defines a group managed by an SMB server instance.
type JoinAuth ¶
type JoinAuth struct {
IntentValue Intent `json:"intent"`
AuthID string `json:"auth_id"`
Auth *JoinAuthValues `json:"auth,omitempty"`
LinkedToCluster string `json:"linked_to_cluster,omitempty"`
}
JoinAuth is a resource containing the parameters needed to join an SMB server to a domain.
func NewJoinAuth ¶
NewJoinAuth returns a new JoinAuth with default values.
func NewJoinAuthToRemove ¶
NewJoinAuthToRemove returns a new JoinAuth with default values set to remove the join auth resource from management.
func NewLinkedJoinAuth ¶
NewLinkedJoinAuth returns a new JoinAuth with default values that link the resource to a particular cluster. Linked resources can only be used by the cluster they link to and are automatically deleted when the linked cluster is deleted.
func (*JoinAuth) Identity ¶
func (ja *JoinAuth) Identity() ResourceRef
Identity returns a ResourceRef identifying this joinauth resource.
func (*JoinAuth) MarshalJSON ¶
MarshalJSON supports marshalling a cluster to JSON.
type JoinAuthSource ¶
type JoinAuthSource struct {
SourceType SourceType `json:"source_type"`
Ref string `json:"ref"`
}
JoinAuthSource identifies a Join Auth resource that will be used as a source of authentication parameters to join a cluster to a domain.
type JoinAuthValues ¶
JoinAuthValues contains the username and password an SMB server will use to join a domain.
type PasswordFilter ¶
type PasswordFilter string
PasswordFilter allows password values to be hidden or obfuscated when sent to or fetched from the smb module.
type Placement ¶
Placement is passed to cephadm to determine where cluster services will be run.
func SimplePlacement ¶
SimplePlacement returns a placement with common placement parameters - count and label - specified.
type PublicAddress ¶
PublicAddress used by a cluster with integrated Samba clustering enabled.
type Resource ¶
type Resource interface {
// Type returns the ResourceType enum value for the resource.
Type() ResourceType
// Identity returns a resource reference for the resource.
Identity() ResourceRef
// Intent returns the intent value for the resource.
Intent() Intent
// Validate returns an error if the resource is not well-formed or
// incomplete.
Validate() error
}
Resource is an interface provided for working with abstract resource description structures in the Ceph smb module.
type ResourceID ¶
type ResourceID struct {
ResourceType ResourceType
ID string
}
ResourceID refers to a resource via its ResourceType value and a string ID.
func (ResourceID) String ¶
func (r ResourceID) String() string
String returns a string value referring to a resource ID.
type ResourceRef ¶
type ResourceRef interface {
Type() ResourceType
String() string
}
ResourceRef provides a structured interface to refer to resources.
type ResourceType ¶
type ResourceType string
ResourceType values are used to identify the type of a resource.
func (ResourceType) String ¶
func (rt ResourceType) String() string
String returns a string value referring to a resource.
func (ResourceType) Type ¶
func (rt ResourceType) Type() ResourceType
Type returns a ResourceType value.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result represents the result of applying a new/changed resource.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON support unmarshalling JSON to a Result.
type ResultGroup ¶
ResultGroup contains a series of Results and summarizes if a modifcation was a success overall.
func (ResultGroup) Error ¶
func (rgroup ResultGroup) Error() string
Error supports treating a failed ResultGroup as a Go error.
func (ResultGroup) ErrorResults ¶
func (rgroup ResultGroup) ErrorResults() []*Result
ErrorResults returns a slice of results containing items that were not successful.
func (ResultGroup) Ok ¶
func (rgroup ResultGroup) Ok() bool
Ok returns true if all the resource modifications were successful.
type Service ¶ added in v0.37.0
type Service string
Service names particular network services provided by an ceph smb cluster.
type Share ¶
type Share struct {
}
Share is a resource representing SMB Shares that will be configured on the SMB servers hosted in the Ceph cluster.
func NewShareToRemove ¶
NewShareToRemove returns a new Share resource object with default values set to remove the share from management.
func (*Share) Identity ¶
func (share *Share) Identity() ResourceRef
Identity returns a ResourceRef identifying this share resource.
func (*Share) MarshalJSON ¶
MarshalJSON supports marshalling a Share resource to JSON.
type ShareAccess ¶
type ShareAccess struct {
}
ShareAccess defines parameters that control the ability to log in to a share with particular access levels.
func (*ShareAccess) Validate ¶
func (sa *ShareAccess) Validate() error
Validate returns an error describing an issue with the share access object or nil if the object is valid.
type ShowOptions ¶
type ShowOptions struct {
// PasswordFilter can be used to filter/obfuscate password values
// stored on the Ceph cluster.
PasswordFilter PasswordFilter
}
ShowOptions controls optional behavior of the Show function.
type SourceType ¶
type SourceType string
SourceType indicates how a Cluster resource refers to another resource it needs. Currently only ResourceSource is available.
type UserGroupSource ¶
type UserGroupSource struct {
SourceType SourceType `json:"source_type"`
Ref string `json:"ref"`
}
UserGroupSource identifies a Users and Groups resource that will be used as a source of user and group information on the SMB cluster.
type UsersAndGroups ¶
type UsersAndGroups struct {
IntentValue Intent `json:"intent"`
UsersGroupsID string `json:"users_groups_id"`
Values *UsersAndGroupsValues `json:"values,omitempty"`
LinkedToCluster string `json:"linked_to_cluster,omitempty"`
}
UsersAndGroups is a resource containing user and group definitions that are managed by an SMB server instances that do not use active directory domains.
func NewLinkedUsersAndGroups ¶
func NewLinkedUsersAndGroups(cluster *Cluster) *UsersAndGroups
NewLinkedUsersAndGroups returns a new UsersAndGroups resource object with default values that link the resource to a particular cluster. Linked resources can only be used by the cluster they link to and are automatically deleted when the linked cluster is deleted.
func NewUsersAndGroups ¶
func NewUsersAndGroups(ugID string) *UsersAndGroups
NewUsersAndGroups returns a new UsersAndGroups resource object with default values.
func NewUsersAndGroupsToRemove ¶
func NewUsersAndGroupsToRemove(ugID string) *UsersAndGroups
NewUsersAndGroupsToRemove returns a new UsersAndGroups resource object with default values set to remove the users and groups resource from management.
func (*UsersAndGroups) Identity ¶
func (ug *UsersAndGroups) Identity() ResourceRef
Identity returns a ResourceRef identifying this users and groups resource.
func (*UsersAndGroups) Intent ¶
func (ug *UsersAndGroups) Intent() Intent
Intent controls if a resource is to be created/updated or removed.
func (*UsersAndGroups) MarshalJSON ¶
func (ug *UsersAndGroups) MarshalJSON() ([]byte, error)
MarshalJSON supports marshalling a UsersAndGroups resource to JSON.
func (*UsersAndGroups) SetValues ¶
func (ug *UsersAndGroups) SetValues( users []UserInfo, groups []GroupInfo) *UsersAndGroups
SetValues modifies a UsersAndGroups resource's users list and groups list.
func (*UsersAndGroups) Type ¶
func (*UsersAndGroups) Type() ResourceType
Type returns a ResourceType value.
func (*UsersAndGroups) Validate ¶
func (ug *UsersAndGroups) Validate() error
Validate returns an error describing an issue with the resource or nil if the resource object is valid.
type UsersAndGroupsValues ¶
type UsersAndGroupsValues struct {
Users []UserInfo `json:"users,omitempty"`
Groups []GroupInfo `json:"groups,omitempty"`
}
UsersAndGroupsValues contains user and group definitions managed by an SMB server instance.