Documentation ¶
Overview ¶
Package object for the Ceph object store.
Index ¶
- Constants
- Variables
- func Add(mgr manager.Manager, context *clusterd.Context, ...) error
- func BuildDNSEndpoint(domainName string, port int32, secure bool) string
- func BuildTransportTLS(tlsCert []byte, insecure bool) *http.Transport
- func CephObjectStoreDependents(clusterdCtx *clusterd.Context, clusterInfo *client.ClusterInfo, ...) (*dependents.DependentList, error)
- func CheckIfZonePresentInZoneGroup(objContext *Context) (bool, error)
- func CheckZoneIsMaster(objContext *Context) (bool, error)
- func CommitConfigChanges(c *Context) error
- func ConfigurePools(context *Context, cluster *cephv1.ClusterSpec, ...) error
- func ConfigureSharedPoolsForZone(objContext *Context, sharedPools cephv1.ObjectSharedPoolsSpec) error
- func DecodeSecret(secret *v1.Secret, keyName string) (string, error)
- func DecodeZoneGroupConfig(data string) (zoneGroupType, error)
- func DeletePools(ctx *Context, lastStore bool, poolPrefix string) error
- func DeleteUser(c *Context, id string, opts ...string) (string, error)
- func EmptyPool(pool cephv1.PoolSpec) bool
- func GenerateCephUserSecretName(store, username string) string
- func GetAdminOPSUserCredentials(objContext *Context, spec *cephv1.ObjectStoreSpec) (string, string, error)
- func GetBucketsStats(c *Context) (map[string]ObjectBucketStats, error)
- func GetDomainName(s *cephv1.CephObjectStore) string
- func GetHostnameFromEndpoint(endpoint string) (string, error)
- func GetObjectBucketProvisioner(data map[string]string, namespace string) (string, error)
- func GetRealmKeyArgs(ctx context.Context, clusterdContext *clusterd.Context, ...) (string, string, error)
- func GetRealmKeyArgsFromSecret(realmSecret *v1.Secret, realmName types.NamespacedName) (string, string, error)
- func GetRealmKeySecret(ctx context.Context, clusterdContext *clusterd.Context, ...) (*v1.Secret, error)
- func GetStableDomainName(s *cephv1.CephObjectStore) string
- func GetTlsCaCert(objContext *Context, objectStoreSpec *cephv1.ObjectStoreSpec) ([]byte, bool, error)
- func JoinMultisite(objContext *Context, endpointArg, zoneEndpoints, namespace string) error
- func ListUserBuckets(c *Context, id string, opts ...string) (string, error)
- func NewDebugHTTPClient(client admin.HTTPClient, logger *capnslog.PackageLogger) *debugHTTPClient
- func ParseDomainName(domainName string) (types.NamespacedName, error)
- func ReconcileCephUserSecret(ctx context.Context, k8sclient client.Client, scheme *runtime.Scheme, ...) (reconcile.Result, error)
- func RunAdminCommandNoMultisite(c *Context, expectJSON bool, args ...string) (string, error)
- func ShouldUpdateZoneEndpointList(zones []zoneType, desiredEndpointList []string, zoneName string) (bool, error)
- func UpdateEndpoint(objContext *Context, store *cephv1.CephObjectStore) error
- type AdminOpsContext
- type BucketPolicy
- type Context
- type MockClient
- type MockDoType
- type ObjectBucket
- type ObjectBucketMetadata
- type ObjectBucketStats
- type ObjectBuckets
- type ObjectUser
- type PolicyStatement
- func (ps *PolicyStatement) Actions(actions ...action) *PolicyStatement
- func (ps *PolicyStatement) Allows() *PolicyStatement
- func (ps *PolicyStatement) Denies() *PolicyStatement
- func (ps *PolicyStatement) EjectPrincipals(users ...string)
- func (ps *PolicyStatement) ForPrincipals(users ...string) *PolicyStatement
- func (ps *PolicyStatement) ForResources(resources ...string) *PolicyStatement
- func (ps *PolicyStatement) ForSubResources(resources ...string) *PolicyStatement
- func (ps *PolicyStatement) WithSID(sid string) *PolicyStatement
- type ProbeType
- type ProtocolType
- type ReconcileCephObjectStore
- type S3Agent
- func (s *S3Agent) CreateBucket(name string) error
- func (s *S3Agent) CreateBucketNoInfoLogging(name string) error
- func (s *S3Agent) DeleteBucket(name string) (bool, error)
- func (s *S3Agent) DeleteObjectInBucket(bucketname string, key string) (bool, error)
- func (s *S3Agent) GetBucketPolicy(bucket string) (*BucketPolicy, error)
- func (s *S3Agent) GetObjectInBucket(bucketname string, key string) (string, error)
- func (s *S3Agent) PutBucketPolicy(bucket string, policy BucketPolicy) (*s3.PutBucketPolicyOutput, error)
- func (s *S3Agent) PutObjectInBucket(bucketname string, body string, key string, contentType string) (bool, error)
Constants ¶
const ( ServiceServingCertCAFile = "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt" HttpTimeOut = time.Second * 15 )
const ( // AppName is the name Rook uses for the object store's application AppName = "rook-ceph-rgw" AccessKeyName = "access-key" SecretKeyName = "secret-key" )
const ( All action = "s3:*" AbortMultipartUpload action = "s3:AbortMultipartUpload" CreateBucket action = "s3:CreateBucket" DeleteBucketPolicy action = "s3:DeleteBucketPolicy" DeleteBucket action = "s3:DeleteBucket" DeleteBucketWebsite action = "s3:DeleteBucketWebsite" DeleteObject action = "s3:DeleteObject" DeleteObjectVersion action = "s3:DeleteObjectVersion" DeleteReplicationConfiguration action = "s3:DeleteReplicationConfiguration" GetAccelerateConfiguration action = "s3:GetAccelerateConfiguration" GetBucketAcl action = "s3:GetBucketAcl" GetBucketCORS action = "s3:GetBucketCORS" GetBucketLocation action = "s3:GetBucketLocation" GetBucketLogging action = "s3:GetBucketLogging" GetBucketNotification action = "s3:GetBucketNotification" GetBucketPolicy action = "s3:GetBucketPolicy" GetBucketRequestPayment action = "s3:GetBucketRequestPayment" GetBucketTagging action = "s3:GetBucketTagging" GetBucketVersioning action = "s3:GetBucketVersioning" GetBucketWebsite action = "s3:GetBucketWebsite" GetLifecycleConfiguration action = "s3:GetLifecycleConfiguration" GetObjectAcl action = "s3:GetObjectAcl" GetObject action = "s3:GetObject" GetObjectTorrent action = "s3:GetObjectTorrent" GetObjectVersionAcl action = "s3:GetObjectVersionAcl" GetObjectVersion action = "s3:GetObjectVersion" GetObjectVersionTorrent action = "s3:GetObjectVersionTorrent" GetReplicationConfiguration action = "s3:GetReplicationConfiguration" ListAllMyBuckets action = "s3:ListAllMyBuckets" ListBucketMultiPartUploads action = "s3:ListBucketMultiPartUploads" ListBucket action = "s3:ListBucket" ListBucketVersions action = "s3:ListBucketVersions" ListMultipartUploadParts action = "s3:ListMultipartUploadParts" PutAccelerateConfiguration action = "s3:PutAccelerateConfiguration" PutBucketAcl action = "s3:PutBucketAcl" PutBucketCORS action = "s3:PutBucketCORS" PutBucketLogging action = "s3:PutBucketLogging" PutBucketNotification action = "s3:PutBucketNotification" PutBucketPolicy action = "s3:PutBucketPolicy" PutBucketRequestPayment action = "s3:PutBucketRequestPayment" PutBucketTagging action = "s3:PutBucketTagging" PutBucketVersioning action = "s3:PutBucketVersioning" PutBucketWebsite action = "s3:PutBucketWebsite" PutLifecycleConfiguration action = "s3:PutLifecycleConfiguration" PutObjectAcl action = "s3:PutObjectAcl" PutObject action = "s3:PutObject" PutObjectVersionAcl action = "s3:PutObjectVersionAcl" PutReplicationConfiguration action = "s3:PutReplicationConfiguration" RestoreObject action = "s3:RestoreObject" )
const ( StartupProbeType ProbeType = "startup" ReadinessProbeType ProbeType = "readiness" HTTPProtocol ProtocolType = "HTTP" HTTPSProtocol ProtocolType = "HTTPS" )
const ( RGWErrorNone = iota RGWErrorUnknown RGWErrorNotFound RGWErrorBadData RGWErrorParse ErrorCodeFileExists = 17 )
const CephRegion = "us-east-1"
Region for aws golang sdk
const ( // DisableOBCEnvVar environment variable, if set to "true", will skip watching Object Bucket and Notification resources. // This variable can be added to container spec of the `rook-ceph-operator` deployment. DisableOBCEnvVar = "ROOK_DISABLE_OBJECT_BUCKET_CLAIM" )
const ( // RGWAdminOpsUserSecretName is the secret name of the admin ops user //nolint:gosec // since this is not leaking any hardcoded credentials, it's just the secret name RGWAdminOpsUserSecretName = "rgw-admin-ops-user" )
Variables ¶
var AllowedActions = []action{ DeleteObject, DeleteObjectVersion, GetBucketAcl, GetBucketCORS, GetBucketLocation, GetBucketLogging, GetBucketNotification, GetBucketTagging, GetBucketVersioning, GetBucketWebsite, GetObject, GetObjectAcl, GetObjectTorrent, GetObjectVersion, GetObjectVersionAcl, GetObjectVersionTorrent, ListAllMyBuckets, ListBucket, ListBucketMultiPartUploads, ListBucketVersions, ListMultipartUploadParts, PutBucketTagging, PutBucketVersioning, PutBucketWebsite, PutBucketVersioning, PutLifecycleConfiguration, PutObject, PutObjectAcl, PutObjectVersionAcl, PutReplicationConfiguration, RestoreObject, }
AllowedActions is a lenient default list of actions
var (
// An user with system privileges for dashboard service
DashboardUser = "dashboard-admin"
)
Functions ¶
func Add ¶
func Add(mgr manager.Manager, context *clusterd.Context, opManagerContext context.Context, opConfig opcontroller.OperatorConfig) error
Add creates a new cephObjectStore Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.
func BuildDNSEndpoint ¶
BuildDNSEndpoint build the dns name to reach out the service endpoint
func CephObjectStoreDependents ¶
func CephObjectStoreDependents( clusterdCtx *clusterd.Context, clusterInfo *client.ClusterInfo, store *v1.CephObjectStore, objCtx *Context, opsCtx *AdminOpsContext, ) (*dependents.DependentList, error)
CephObjectStoreDependents returns the buckets which exist in the object store that should block deletion. TODO: need unit tests for this - need to be able to fake the admin ops API (nontrivial)
func CheckZoneIsMaster ¶
func CommitConfigChanges ¶
CommitConfigChanges commits changes to RGW configs for realm/zonegroup/zone changes idempotently. Under the hood, this updates the RGW config period and commits the change if changes are detected.
func ConfigurePools ¶
func ConfigurePools(context *Context, cluster *cephv1.ClusterSpec, metadataPool, dataPool cephv1.PoolSpec, sharedPools cephv1.ObjectSharedPoolsSpec) error
func ConfigureSharedPoolsForZone ¶
func ConfigureSharedPoolsForZone(objContext *Context, sharedPools cephv1.ObjectSharedPoolsSpec) error
func DecodeZoneGroupConfig ¶
func DeleteUser ¶
DeleteUser deletes the user with the given ID. Even though we should be using the Admin Ops API, we keep this on purpose until the entire migration is completed Used for the dashboard user
func GetBucketsStats ¶
func GetBucketsStats(c *Context) (map[string]ObjectBucketStats, error)
func GetDomainName ¶
func GetDomainName(s *cephv1.CephObjectStore) string
GetDomainName build the dns name to reach out the service endpoint
func GetHostnameFromEndpoint ¶
func GetObjectBucketProvisioner ¶
GetObjectBucketProvisioner returns the bucket provisioner name appended with operator namespace if OBC is watching on it
func GetRealmKeyArgs ¶
func GetRealmKeySecret ¶
func GetStableDomainName ¶
func GetStableDomainName(s *cephv1.CephObjectStore) string
func GetTlsCaCert ¶
func GetTlsCaCert(objContext *Context, objectStoreSpec *cephv1.ObjectStoreSpec) ([]byte, bool, error)
GetTLSCACert fetch cacert for internal RGW requests
func JoinMultisite ¶
func NewDebugHTTPClient ¶
func NewDebugHTTPClient(client admin.HTTPClient, logger *capnslog.PackageLogger) *debugHTTPClient
NewDebugHTTPClient helps us mutating the HTTP client to debug the request/response
func ParseDomainName ¶
func ParseDomainName(domainName string) (types.NamespacedName, error)
ParseDomainName parse the name and namespace from the dns name
func ReconcileCephUserSecret ¶
func RunAdminCommandNoMultisite ¶
RunAdminCommandNoMultisite is for running radosgw-admin commands in scenarios where an object-store has not been created yet or for commands on the realm or zonegroup (ex: radosgw-admin zonegroup get) This function times out after a fixed interval if no response is received. The function will return a Kubernetes error "NotFound" when exec fails when the pod does not exist
func ShouldUpdateZoneEndpointList ¶
func ShouldUpdateZoneEndpointList(zones []zoneType, desiredEndpointList []string, zoneName string) (bool, error)
ShouldUpdateZoneEndpointList checks whether zone endpoint list need to be updated or not
func UpdateEndpoint ¶
func UpdateEndpoint(objContext *Context, store *cephv1.CephObjectStore) error
UpdateEndpoint updates an object.Context using the latest info from the CephObjectStore spec
Types ¶
type AdminOpsContext ¶
type AdminOpsContext struct { Context TlsCert []byte AdminOpsUserAccessKey string AdminOpsUserSecretKey string AdminOpsClient *admin.API }
AdminOpsContext holds the object store context as well as information for connecting to the admin ops API.
func NewMultisiteAdminOpsContext ¶
func NewMultisiteAdminOpsContext( objContext *Context, spec *cephv1.ObjectStoreSpec, ) (*AdminOpsContext, error)
type BucketPolicy ¶
type BucketPolicy struct { // Id (optional) identifies the bucket policy Id string `json:"Id"` // Version is the version of the BucketPolicy data structure // should always be '2012-10-17' Version string `json:"Version"` Statement []PolicyStatement `json:"Statement"` }
BucketPolicy represents set of policy statements for a single bucket.
func NewBucketPolicy ¶
func NewBucketPolicy(ps ...PolicyStatement) *BucketPolicy
NewBucketPolicy obviously returns a new BucketPolicy. PolicyStatements may be passed in at creation or added after the fact. BucketPolicies should be passed to PutBucketPolicy().
func (*BucketPolicy) DropPolicyStatements ¶
func (bp *BucketPolicy) DropPolicyStatements(sid ...string) *BucketPolicy
func (*BucketPolicy) EjectPrincipals ¶
func (bp *BucketPolicy) EjectPrincipals(users ...string) *BucketPolicy
func (*BucketPolicy) ModifyBucketPolicy ¶
func (bp *BucketPolicy) ModifyBucketPolicy(ps ...PolicyStatement) *BucketPolicy
ModifyBucketPolicy new and old statement SIDs and overwrites on a match. This allows users to Get, modify, and Replace existing statements as well as add new ones.
type Context ¶
type Context struct { Context *clusterd.Context Name string UID string Endpoint string Realm string ZoneGroup string Zone string // contains filtered or unexported fields }
Context holds the context for the object store.
func NewContext ¶
func NewContext(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo, name string) *Context
NewContext creates a new object store context.
func NewMultisiteContext ¶
func NewMultisiteContext(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo, store *cephv1.CephObjectStore) (*Context, error)
type MockClient ¶
type MockClient struct { // MockDo is a type that mock the Do method from the HTTP package MockDo MockDoType }
MockClient is the mock of the HTTP Client It can be used to mock HTTP request/response from the rgw admin ops API
type MockDoType ¶
MockDoType is a custom type that allows setting the function that our Mock Do func will run instead
type ObjectBucket ¶
type ObjectBucket struct { Name string `json:"name"` ObjectBucketMetadata ObjectBucketStats }
type ObjectBucketMetadata ¶
type ObjectBucketStats ¶
type ObjectBucketStats struct { Size uint64 `json:"size"` NumberOfObjects uint64 `json:"numberOfObjects"` }
func GetBucketStats ¶
func GetBucketStats(c *Context, bucketName string) (*ObjectBucketStats, bool, error)
type ObjectBuckets ¶
type ObjectBuckets []ObjectBucket
func (ObjectBuckets) Len ¶
func (slice ObjectBuckets) Len() int
func (ObjectBuckets) Less ¶
func (slice ObjectBuckets) Less(i, j int) bool
func (ObjectBuckets) Swap ¶
func (slice ObjectBuckets) Swap(i, j int)
type ObjectUser ¶
type ObjectUser struct { UserID string `json:"userId"` DisplayName *string `json:"displayName"` Email *string `json:"email"` AccessKey *string `json:"accessKey"` SecretKey *string `json:"secretKey"` SystemUser bool `json:"systemuser"` AdminOpsUser bool `json:"adminopsuser"` MaxBuckets int `json:"max_buckets"` UserQuota admin.QuotaSpec `json:"user_quota"` Caps []admin.UserCapSpec `json:"caps"` }
An ObjectUser defines the details of an object store user.
func CreateOrRecreateUserIfExists ¶
func CreateOrRecreateUserIfExists(c *Context, user ObjectUser, force bool) (*ObjectUser, int, error)
CreateOrRecreateUserIfExists if the user doesn't exist, it is created, should it already exist it is deleted and re-created It is called from the rgw dashboard setup logic.
func CreateUser ¶
func CreateUser(c *Context, user ObjectUser, force bool) (*ObjectUser, int, error)
CreateUser creates a new user with the information given. The function is used **ONCE** only to provision so the RGW Admin Ops User Subsequent interaction with the API will be done with the created user
type PolicyStatement ¶
type PolicyStatement struct { // Sid (optional) is the PolicyStatement's unique identifier Sid string `json:"Sid"` // Effect determines whether the Action(s) are 'Allow'ed or 'Deny'ed. Effect effect `json:"Effect"` // Principle is/are the Ceph user names affected by this PolicyStatement // Must be in the format of 'arn:aws:iam:::user/<ceph-user>' Principal map[string][]string `json:"Principal"` // Action is a list of s3:* actions Action []action `json:"Action"` // Resource is the ARN identifier for the S3 resource (bucket) // Must be in the format of 'arn:aws:s3:::<bucket>' Resource []string `json:"Resource"` }
PolicyStatement is the Go representation of a PolicyStatement json struct it defines what Actions that a Principle can or cannot perform on a Resource
func NewPolicyStatement ¶
func NewPolicyStatement() *PolicyStatement
NewPolicyStatement generates a new PolicyStatement. PolicyStatement methods are designed to be chain called with dot notation to allow for easy configuration at creation. This is preferable to a long parameter list.
func (*PolicyStatement) Actions ¶
func (ps *PolicyStatement) Actions(actions ...action) *PolicyStatement
Actions is the set of "s3:*" actions for the PolicyStatement is concerned
func (*PolicyStatement) Allows ¶
func (ps *PolicyStatement) Allows() *PolicyStatement
Allows sets the effect of the PolicyStatement to allow PolicyStatement's Actions
func (*PolicyStatement) Denies ¶
func (ps *PolicyStatement) Denies() *PolicyStatement
Denies sets the effect of the PolicyStatement to deny the PolicyStatement's Actions
func (*PolicyStatement) EjectPrincipals ¶
func (ps *PolicyStatement) EjectPrincipals(users ...string)
func (*PolicyStatement) ForPrincipals ¶
func (ps *PolicyStatement) ForPrincipals(users ...string) *PolicyStatement
ForPrincipals adds users to the PolicyStatement
func (*PolicyStatement) ForResources ¶
func (ps *PolicyStatement) ForResources(resources ...string) *PolicyStatement
ForResources adds resources (buckets) to the PolicyStatement with the appropriate ARN prefix
func (*PolicyStatement) ForSubResources ¶
func (ps *PolicyStatement) ForSubResources(resources ...string) *PolicyStatement
ForSubResources add contents inside the bucket to the PolicyStatement with the appropriate ARN prefix
func (*PolicyStatement) WithSID ¶
func (ps *PolicyStatement) WithSID(sid string) *PolicyStatement
type ProtocolType ¶
type ProtocolType string
type ReconcileCephObjectStore ¶
type ReconcileCephObjectStore struct {
// contains filtered or unexported fields
}
ReconcileCephObjectStore reconciles a cephObjectStore object
func (*ReconcileCephObjectStore) Reconcile ¶
func (r *ReconcileCephObjectStore) Reconcile(context context.Context, request reconcile.Request) (reconcile.Result, error)
Reconcile reads that state of the cluster for a cephObjectStore object and makes changes based on the state read and what is in the cephObjectStore.Spec The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
type S3Agent ¶
S3Agent wraps the s3.S3 structure to allow for wrapper methods
func NewInsecureS3Agent ¶
func NewS3Agent ¶
func (*S3Agent) CreateBucket ¶
CreateBucket creates a bucket with the given name
func (*S3Agent) CreateBucketNoInfoLogging ¶
CreateBucket creates a bucket with the given name
func (*S3Agent) DeleteBucket ¶
DeleteBucket function deletes given bucket using s3 client
func (*S3Agent) DeleteObjectInBucket ¶
DeleteObjectInBucket function deletes given bucket using s3 client
func (*S3Agent) GetBucketPolicy ¶
func (s *S3Agent) GetBucketPolicy(bucket string) (*BucketPolicy, error)
func (*S3Agent) GetObjectInBucket ¶
GetObjectInBucket function retrieves an object from a bucket using s3 client
func (*S3Agent) PutBucketPolicy ¶
func (s *S3Agent) PutBucketPolicy(bucket string, policy BucketPolicy) (*s3.PutBucketPolicyOutput, error)
PutBucketPolicy applies the policy to the bucket
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cosi implements the controller for the Ceph COSI Driver.
|
Package cosi implements the controller for the Ceph COSI Driver. |
Package notification to manage a rook bucket notifications.
|
Package notification to manage a rook bucket notifications. |
Package objectrealm to manage a rook object realm.
|
Package objectrealm to manage a rook object realm. |
Package topic to manage a rook bucket topics.
|
Package topic to manage a rook bucket topics. |
Package objectuser to manage a rook object store user.
|
Package objectuser to manage a rook object store user. |
Package zone to manage a rook object zone.
|
Package zone to manage a rook object zone. |
Package objectzonegroup to manage a rook object zonegroup.
|
Package objectzonegroup to manage a rook object zonegroup. |