Skip to content

Commit

Permalink
feat: update credential name (#21)
Browse files Browse the repository at this point in the history
* feat: update credential name

* feat: update generated code
  • Loading branch information
whg517 authored Feb 6, 2024
1 parent f92c32c commit 8c392cb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 40 deletions.
16 changes: 6 additions & 10 deletions pkg/apis/commons/v1alpha1/database_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DatabaseSpec struct {
// Credential is the credential for the database.
// It contains Username and Password, or ExistSecret.
//+kubebuilder:validation:Required
Credential *CredentialSpec `json:"credential,omitempty"`
Credential *DatabaseCredentialSpec `json:"credential,omitempty"`
}

type DatabaseStatus struct {
Expand Down Expand Up @@ -71,8 +71,8 @@ type DatabaseConnectionSpec struct {
Default bool `json:"default,omitempty"`
}

// CredentialSpec include: Username and Password or ExistSecret.
type CredentialSpec struct {
// DatabaseCredentialSpec include: Username and Password or ExistSecret.
type DatabaseCredentialSpec struct {
// ExistSecret is a Secret name, created by user.
// It includes Username and Password, it is encrypted by base64.
// If ExistSecret is not empty, Username and Password will be ignored.
Expand Down Expand Up @@ -127,9 +127,7 @@ type DatabaseConnectionProvider struct {

// MysqlProvider defines the desired connection info of Mysql
type MysqlProvider struct {
// If you want to use mysql8+ , you should set driver to com.mysql.cj.jdbc.Driver,
// otherwise you should set driver to com.mysql.jdbc.Driver.
// +kubebuilder:default=com.mysql.cj.jdbc.Driver
// +kubebuilder:default=mysql
// +kubebuilder:validation:Required
Driver string `json:"driver,omitempty"`
// +kubebuilder:validation:Required
Expand All @@ -139,7 +137,7 @@ type MysqlProvider struct {
// +kubebuilder:validation:Required
SSL bool `json:"ssl,omitempty"`
// +kubebuilder:validation:Required
Credential *CredentialSpec `json:"credential,omitempty"`
Credential *DatabaseCredentialSpec `json:"credential,omitempty"`
}

// PostgresProvider defines the desired connection info of Postgres
Expand All @@ -153,7 +151,7 @@ type PostgresProvider struct {
// +kubebuilder:validation:Required
SSL bool `json:"ssl,omitempty"`
// +kubebuilder:validation:Required
Credential *CredentialSpec `json:"credential,omitempty"`
Credential *DatabaseCredentialSpec `json:"credential,omitempty"`
}

// RedisProvider defines the desired connection info of Redis
Expand All @@ -162,8 +160,6 @@ type RedisProvider struct {
Host string `json:"host,omitempty"`
// +kubebuilder:validation:Required
Port string `json:"port,omitempty"`
// +kubebuilder:validation:Optional
Credential *CredentialSpec `json:"credential,omitempty"`
}

func init() {
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/commons/v1alpha1/s3_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const S3BucketFinalizer = "s3bucket.finalizers.stack.zncdata.net"
type S3ConnectionSpec struct {

// +kubebuilder:validation:Required
S3Credential *S3Credential `json:"credential,omitempty"`
Credential *S3Credential `json:"credential,omitempty"`

// +kubebuilder:validation:Required
Endpoint string `json:"endpoint,omitempty"`
Expand All @@ -42,11 +42,11 @@ type S3ConnectionSpec struct {
PathStyle bool `json:"pathStyle,omitempty"`
}

// S3Credential include AccessKey and SecretKey or ExistingSecret.
// S3Credential include `ACCESS_KEY` and `SECRET_KEY` or ExistingSecret.
type S3Credential struct {

// ExistingSecret include AccessKey and SecretKey ,it is encrypted by base64.
// If ExistingSecret is not empty, AccessKey and SecretKey will be ignored.
// ExistingSecret include `ACCESS_KEY` and `SECRET_KEY` ,it is encrypted by base64.
// If ExistingSecret is not empty, `ACCESS_KEY` and `SECRET_KEY` will be ignored.
// +kubebuilder:validation:Optional
ExistSecret string `json:"existSecret,omitempty"`

Expand Down
47 changes: 21 additions & 26 deletions pkg/apis/commons/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit 8c392cb

Please sign in to comment.