Skip to content

Commit

Permalink
refactor: Change the name of the blob to azblob
Browse files Browse the repository at this point in the history
  • Loading branch information
daviderli614 committed Nov 26, 2024
1 parent c397749 commit aaf8cb6
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 53 deletions.
24 changes: 12 additions & 12 deletions apis/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,21 @@ func (in *TLSSpec) GetSecretName() string {

// ObjectStorageProviderSpec defines the object storage provider for the cluster. The data will be stored in the storage.
type ObjectStorageProviderSpec struct {
// S3 is the S3 storage configuration.
// S3 is the AWS S3 storage configuration.
// +optional
S3 *S3Storage `json:"s3,omitempty"`

// OSS is the Aliyun OSS storage configuration.
// +optional
OSS *OSSStorage `json:"oss,omitempty"`

// GCS is the Google GCS storage configuration.
// GCS is the Google cloud storage configuration.
// +optional
GCS *GCSStorage `json:"gcs,omitempty"`

// Blob is the Azure Blob storage configuration.
// AZBlob is the Azure Blob storage configuration.
// +optional
Blob *BlobStorage `json:"blob,omitempty"`
AZBlob *AZBlobStorage `json:"azblob,omitempty"`

// Cache is the cache storage configuration for object storage.
// +optional
Expand All @@ -600,7 +600,7 @@ type ObjectStorageProviderAccessor interface {
GetS3Storage() *S3Storage
GetGCSStorage() *GCSStorage
GetOSSStorage() *OSSStorage
GetBlobStorage() *BlobStorage
GetAZBlobStorage() *AZBlobStorage
GetCacheFileStorage() *FileStorage
}

Expand Down Expand Up @@ -634,9 +634,9 @@ func (in *ObjectStorageProviderSpec) GetOSSStorage() *OSSStorage {
return nil
}

func (in *ObjectStorageProviderSpec) GetBlobStorage() *BlobStorage {
func (in *ObjectStorageProviderSpec) GetAZBlobStorage() *AZBlobStorage {
if in != nil {
return in.Blob
return in.AZBlob
}
return nil
}
Expand All @@ -652,7 +652,7 @@ func (in *ObjectStorageProviderSpec) getSetObjectStorageCount() int {
if in.GCS != nil {
count++
}
if in.Blob != nil {
if in.AZBlob != nil {
count++
}
return count
Expand Down Expand Up @@ -797,8 +797,8 @@ func (in *GCSStorage) GetRoot() string {
return ""
}

// BlobStorage defines the Blob storage specification.
type BlobStorage struct {
// AZBlobStorage defines the Azure Blob storage specification.
type AZBlobStorage struct {
// The data will be stored in the container.
// +required
Container string `json:"container"`
Expand All @@ -818,14 +818,14 @@ type BlobStorage struct {
Endpoint string `json:"endpoint,omitempty"`
}

func (in *BlobStorage) GetSecretName() string {
func (in *AZBlobStorage) GetSecretName() string {
if in != nil {
return in.SecretName
}
return ""
}

func (in *BlobStorage) GetRoot() string {
func (in *AZBlobStorage) GetRoot() string {
if in != nil {
return in.Root
}
Expand Down
10 changes: 5 additions & 5 deletions apis/v1alpha1/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func (in *GreptimeDBCluster) Check(ctx context.Context, client client.Client) er
}
}

if secretName := in.GetObjectStorageProvider().GetBlobStorage().GetSecretName(); secretName != "" {
if err := checkBlobCredentialsSecret(ctx, client, in.GetNamespace(), secretName); err != nil {
if secretName := in.GetObjectStorageProvider().GetAZBlobStorage().GetSecretName(); secretName != "" {
if err := checkAZBlobCredentialsSecret(ctx, client, in.GetNamespace(), secretName); err != nil {
return err
}
}
Expand Down Expand Up @@ -201,8 +201,8 @@ func (in *GreptimeDBStandalone) Check(ctx context.Context, client client.Client)
}
}

if secretName := in.GetObjectStorageProvider().GetBlobStorage().GetSecretName(); secretName != "" {
if err := checkBlobCredentialsSecret(ctx, client, in.GetNamespace(), secretName); err != nil {
if secretName := in.GetObjectStorageProvider().GetAZBlobStorage().GetSecretName(); secretName != "" {
if err := checkAZBlobCredentialsSecret(ctx, client, in.GetNamespace(), secretName); err != nil {
return err
}
}
Expand Down Expand Up @@ -294,7 +294,7 @@ func checkS3CredentialsSecret(ctx context.Context, client client.Client, namespa
return checkSecretData(ctx, client, namespace, name, []string{AccessKeyIDSecretKey, SecretAccessKeySecretKey})
}

func checkBlobCredentialsSecret(ctx context.Context, client client.Client, namespace, name string) error {
func checkAZBlobCredentialsSecret(ctx context.Context, client client.Client, namespace, name string) error {
return checkSecretData(ctx, client, namespace, name, []string{AccountName, AccountKey})
}

Expand Down
14 changes: 7 additions & 7 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18318,7 +18318,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down Expand Up @@ -18542,7 +18542,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down
10 changes: 5 additions & 5 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@



#### BlobStorage
#### AZBlobStorage



BlobStorage defines the Blob storage specification.
AZBlobStorage defines the Azure Blob storage specification.



Expand Down Expand Up @@ -710,10 +710,10 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `s3` _[S3Storage](#s3storage)_ | S3 is the S3 storage configuration. | | |
| `s3` _[S3Storage](#s3storage)_ | S3 is the AWS S3 storage configuration. | | |
| `oss` _[OSSStorage](#ossstorage)_ | OSS is the Aliyun OSS storage configuration. | | |
| `gcs` _[GCSStorage](#gcsstorage)_ | GCS is the Google GCS storage configuration. | | |
| `blob` _[BlobStorage](#blobstorage)_ | Blob is the Azure Blob storage configuration. | | |
| `gcs` _[GCSStorage](#gcsstorage)_ | GCS is the Google cloud storage configuration. | | |
| `azblob` _[AZBlobStorage](#azblobstorage)_ | AZBlob is the Azure Blob storage configuration. | | |
| `cache` _[CacheStorage](#cachestorage)_ | Cache is the cache storage configuration for object storage. | | |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: blob-credentials
name: azblob-credentials
stringData:
account-name: "your-blob-account-name"
account-key: "your-blob-account-key"
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ spec:
datanode:
replicas: 1
objectStorage:
blob:
azblob:
container: "greptimedb"
secretName: "blob-credentials"
secretName: "azblob-credentials"
endpoint: "https://<storage-account>.blob.core.windows.net"
root: "cluster-with-blob-data"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: blob-credentials
name: azblob-credentials
stringData:
account-name: "your-blob-account-name"
account-key: "your-blob-account-key"
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ spec:
main:
image: greptime/greptimedb:latest
objectStorage:
blob:
azblob:
container: "greptimedb"
secretName: "blob-credentials"
secretName: "azblob-credentials"
endpoint: "https://<storage-account>.blob.core.windows.net"
root: "standalone-with-blob"
6 changes: 3 additions & 3 deletions manifests/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18324,7 +18324,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down Expand Up @@ -18548,7 +18548,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down Expand Up @@ -21871,7 +21871,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down
6 changes: 3 additions & 3 deletions manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18317,7 +18317,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down Expand Up @@ -18541,7 +18541,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down Expand Up @@ -21864,7 +21864,7 @@ spec:
type: integer
objectStorage:
properties:
blob:
azblob:
properties:
container:
type: string
Expand Down
18 changes: 9 additions & 9 deletions pkg/dbconfig/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (c *StorageConfig) ConfigureObjectStorage(namespace string, accessor v1alph
if err := c.configureGCS(namespace, gcs); err != nil {
return err
}
} else if blob := accessor.GetBlobStorage(); blob != nil {
if err := c.configureBlob(namespace, blob); err != nil {
} else if blob := accessor.GetAZBlobStorage(); blob != nil {
if err := c.configureAZBlob(namespace, blob); err != nil {
return err
}
}
Expand Down Expand Up @@ -140,18 +140,18 @@ func (c *StorageConfig) configureGCS(namespace string, gcs *v1alpha1.GCSStorage)
return nil
}

func (c *StorageConfig) configureBlob(namespace string, blob *v1alpha1.BlobStorage) error {
if blob == nil {
func (c *StorageConfig) configureAZBlob(namespace string, azblob *v1alpha1.AZBlobStorage) error {
if azblob == nil {
return nil
}

c.StorageType = pointer.String("Azblob")
c.Container = pointer.String(blob.Container)
c.StorageRoot = pointer.String(blob.Root)
c.StorageEndpoint = pointer.String(blob.Endpoint)
c.Container = pointer.String(azblob.Container)
c.StorageRoot = pointer.String(azblob.Root)
c.StorageEndpoint = pointer.String(azblob.Endpoint)

if blob.SecretName != "" {
data, err := k8sutil.GetSecretsData(namespace, blob.SecretName, []string{v1alpha1.AccountName, v1alpha1.AccountKey})
if azblob.SecretName != "" {
data, err := k8sutil.GetSecretsData(namespace, azblob.SecretName, []string{v1alpha1.AccountName, v1alpha1.AccountKey})
if err != nil {
return err
}
Expand Down

0 comments on commit aaf8cb6

Please sign in to comment.