Skip to content

Commit

Permalink
fix(redis): remove REDIS_CA_CERT secret key (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored May 7, 2024
1 parent 779d980 commit 801980b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fix `ServiceIntegration` deletion when instance has no id set
- Change `Kafka` field `userConfig.kafka_version`: enum ~~`[3.4, 3.5, 3.6]`~~`[3.4, 3.5, 3.6, 3.7]`
- Add `ServiceIntegration` `flink_external_postgresql` type
- Remove `REDIS_CA_CERT` secret key. Can't be used with the service type

## v0.19.0 - 2024-04-18

Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type RedisSpec struct {
//+kubebuilder:subresource:status

// Redis is the Schema for the redis API.
// Info "Exposes secret keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`, `REDIS_CA_CERT`
// Info "Exposes secret keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`
// +kubebuilder:subresource:status
type Redis struct {
metav1.TypeMeta `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion charts/aiven-operator-crds/templates/aiven.io_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
openAPIV3Schema:
description:
'Redis is the Schema for the redis API. Info "Exposes secret
keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`, `REDIS_CA_CERT`'
keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`'
properties:
apiVersion:
description:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/aiven.io_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
openAPIV3Schema:
description:
'Redis is the Schema for the redis API. Info "Exposes secret
keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`, `REDIS_CA_CERT`'
keys": `REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`'
properties:
apiVersion:
description:
Expand Down
6 changes: 6 additions & 0 deletions controllers/generic_service_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ func (h *genericServiceHandler) get(ctx context.Context, avn *aiven.Client, avnG
return secret, err
}

// Redis shouldn't expose CA_CERT
// It can't be used to connect to redis
if o.getServiceType() == "redis" {
return secret, nil
}

cert, err := avnGen.ProjectKmsGetCA(ctx, spec.Project)
if err != nil {
return nil, fmt.Errorf("cannot retrieve project CA certificate: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api-reference/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Redis is the Schema for the redis API.

!!! Info "Exposes secret keys"

`REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`, `REDIS_CA_CERT`.
`REDIS_HOST`, `REDIS_PORT`, `REDIS_USER`, `REDIS_PASSWORD`.

**Required**

Expand Down
1 change: 0 additions & 1 deletion tests/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,4 @@ func TestRedis(t *testing.T) {
assert.NotEmpty(t, secret.Data["REDIS_PORT"])
assert.NotEmpty(t, secret.Data["REDIS_USER"])
assert.NotEmpty(t, secret.Data["REDIS_PASSWORD"])
assert.NotEmpty(t, secret.Data["REDIS_CA_CERT"])
}

0 comments on commit 801980b

Please sign in to comment.