Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps & fix authsecret mutation #145

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
k8s.io/klog/v2 v2.130.1
kmodules.xyz/client-go v0.30.28
kmodules.xyz/custom-resources v0.30.0
kubedb.dev/apimachinery v0.48.1-0.20241025104947-405c179f3f23
kubedb.dev/apimachinery v0.48.1-0.20241028074647-683c8d4491f4
sigs.k8s.io/controller-runtime v0.18.4
xorm.io/xorm v1.3.6
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,8 @@ kmodules.xyz/monitoring-agent-api v0.30.2 h1:sAgz5P5EXZqhlj1NzJ+QltAgeIx5bGSMj+a
kmodules.xyz/monitoring-agent-api v0.30.2/go.mod h1:BoZFPDDRB7J39CcUsSDlzgW8PQCwik4ILPleyUob+Mg=
kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI=
kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g=
kubedb.dev/apimachinery v0.48.1-0.20241025104947-405c179f3f23 h1:nYWefc+tQjXFddLRfX8BaRku1phkqFx5KbNoVtd77NM=
kubedb.dev/apimachinery v0.48.1-0.20241025104947-405c179f3f23/go.mod h1:NCiS4uS+F8DUyU9/tUQO3wqyNRNf0busab5/0Q2nYA0=
kubedb.dev/apimachinery v0.48.1-0.20241028074647-683c8d4491f4 h1:1+DrfFOHjsKjZ1+1uqbJSi44D5slbKGv4jNlnh9DVKU=
kubedb.dev/apimachinery v0.48.1-0.20241028074647-683c8d4491f4/go.mod h1:NCiS4uS+F8DUyU9/tUQO3wqyNRNf0busab5/0Q2nYA0=
kubeops.dev/petset v0.0.7 h1:F77BTRfUqRVO7kNc8q2oFSSviDmYBqni/osXqu0kgJ4=
kubeops.dev/petset v0.0.7/go.mod h1:lt0SZV4ohRy7RiwLNUnMoauG4lCbcRbSqhMg20rdUQg=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
Expand Down
2 changes: 1 addition & 1 deletion solr/kubedb_client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (o *KubeDBClientBuilder) GetSolrClient() (*Client, error) {
var authSecret core.Secret
if !o.db.Spec.DisableSecurity {
err := o.kc.Get(o.ctx, types.NamespacedName{
Name: o.db.Spec.AuthSecret.Name,
Name: o.db.GetAuthSecretName(),
Namespace: o.db.Namespace,
}, &authSecret)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ func (k *ConnectCluster) KafkaClientCredentialsSecretName() string {
return meta_util.NameWithSuffix(k.Name, "kafka-client-cred")
}

func (k *ConnectCluster) DefaultUserCredSecretName(username string) string {
return meta_util.NameWithSuffix(k.Name, strings.ReplaceAll(fmt.Sprintf("%s-cred", username), "_", "-"))
func (k *ConnectCluster) DefaultUserCredSecretName() string {
return meta_util.NameWithSuffix(k.OffshootName(), "auth")
}

func (k *ConnectCluster) DefaultKeystoreCredSecretName() string {
Expand All @@ -213,7 +213,7 @@ func (k *ConnectCluster) GetAuthSecretName() string {
if k.Spec.AuthSecret != nil && k.Spec.AuthSecret.Name != "" {
return k.Spec.AuthSecret.Name
}
return k.DefaultUserCredSecretName("admin")
return k.DefaultUserCredSecretName()
}

// GetCertSecretName returns the secret name for a certificate alias if any,
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (k *Kafka) GetAuthSecretName() string {
if k.Spec.AuthSecret != nil && k.Spec.AuthSecret.Name != "" {
return k.Spec.AuthSecret.Name
}
return k.DefaultUserCredSecretName("admin")
return k.DefaultUserCredSecretName()
}

func (k *Kafka) GetPersistentSecrets() []string {
Expand All @@ -249,8 +249,8 @@ func (k *Kafka) CruiseControlConfigSecretName() string {
return meta_util.NameWithSuffix(k.OffshootName(), "cruise-control-config")
}

func (k *Kafka) DefaultUserCredSecretName(username string) string {
return meta_util.NameWithSuffix(k.Name, strings.ReplaceAll(fmt.Sprintf("%s-cred", username), "_", "-"))
func (k *Kafka) DefaultUserCredSecretName() string {
return meta_util.NameWithSuffix(k.OffshootName(), "auth")
}

func (k *Kafka) DefaultKeystoreCredSecretName() string {
Expand Down
14 changes: 14 additions & 0 deletions vendor/kubedb.dev/apimachinery/apis/kubedb/v1/openapi_generated.go

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

8 changes: 7 additions & 1 deletion vendor/kubedb.dev/apimachinery/apis/kubedb/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@ type SystemUserSecretsSpec struct {

type SecretReference struct {
core.LocalObjectReference `json:",inline,omitempty"`
ExternallyManaged bool `json:"externallyManaged,omitempty"`
// Recommendation engine will generate RotateAuth opsReq using this field
// +optional
RotateAfter *metav1.Duration `json:"rotateAfter,omitempty"`
// ActiveFrom holds the RFC3339 time. The referred authSecret is in-use from this timestamp.
// +optional
ActiveFrom *metav1.Time `json:"activeFrom,omitempty"`
ExternallyManaged bool `json:"externallyManaged,omitempty"`
}

type Age struct {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (r *Cassandra) GetAuthSecretName() string {
if r.Spec.AuthSecret != nil && r.Spec.AuthSecret.Name != "" {
return r.Spec.AuthSecret.Name
}
return r.DefaultUserCredSecretName("admin")
return meta_util.NameWithSuffix(r.OffshootName(), "auth")
}

func (r *Cassandra) ConfigSecretName() string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (c *ClickHouse) GetAuthSecretName() string {
if c.Spec.AuthSecret != nil && c.Spec.AuthSecret.Name != "" {
return c.Spec.AuthSecret.Name
}
return c.DefaultUserCredSecretName("admin")
return meta_util.NameWithSuffix(c.OffshootName(), "auth")
}

func (r *ClickHouse) ConfigSecretName() string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func (d *Druid) GoverningServiceName() string {
return meta_util.NameWithSuffix(d.ServiceName(), "pods")
}

func (d *Druid) GetAuthSecretName() string {
if d.Spec.AuthSecret != nil && d.Spec.AuthSecret.Name != "" {
return d.Spec.AuthSecret.Name
}
return meta_util.NameWithSuffix(d.OffShootName(), "auth")
}

func (d *Druid) OffShootSelectors(extraSelectors ...map[string]string) map[string]string {
selector := map[string]string{
meta_util.NameLabelKey: d.ResourceFQN(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ func (k *Kafka) CruiseControlConfigSecretName() string {
return meta_util.NameWithSuffix(k.OffshootName(), "cruise-control-config")
}

func (k *Kafka) DefaultUserCredSecretName(username string) string {
return meta_util.NameWithSuffix(k.Name, strings.ReplaceAll(fmt.Sprintf("%s-cred", username), "_", "-"))
func (k *Kafka) DefaultUserCredSecretName() string {
return meta_util.NameWithSuffix(k.OffshootName(), "auth")
}

func (k *Kafka) DefaultKeystoreCredSecretName() string {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (r *RabbitMQ) GetAuthSecretName() string {
if r.Spec.AuthSecret != nil && r.Spec.AuthSecret.Name != "" {
return r.Spec.AuthSecret.Name
}
return r.DefaultUserCredSecretName("admin")
return meta_util.NameWithSuffix(r.OffshootName(), "auth")
}

func (r *RabbitMQ) GetPersistentSecrets() []string {
Expand Down
Loading
Loading