Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
- Support setting `clientAuthenticationMethod` for OIDC authentication. The value is passed through to the Flask-AppBuilder config as `token_endpoint_auth_method` ([#719]).
- BREAKING: Rename `EXPERIMENTAL_FILE_HEADER` and `EXPERIMENTAL_FILE_FOOTER` in `superset_config.py` for arbitrary Python code to `FILE_HEADER` and `FILE_FOOTER` ([#719], [#721]).
- Use an internal Secret for the Superset `SECRET_KEY`.
Going forward, the operator will automatically create the Secret in case it doesn't exist ([#722]).
- BREAKING: The `.clusterConfig.credentialsSecret` field has been renamed to `.clusterConfig.credentialsSecretName` for consistency ([#722]).
Going forward, the operator will automatically create the Secret in case it doesn't exist ([#722], [#754]).
Comment thread
sbernauer marked this conversation as resolved.
Outdated
- BREAKING: Implement generic database connection.
This means you need to replace your simple database connection string with a typed struct.
This struct is consistent between different CRDs, so that you can easily copy/paste it between stacklets.
More information can be found in the [Superset database documentation](https://docs.stackable.tech/home/nightly/superset/usage-guide/database-connections) for details ([#722]).
More information can be found in the [Superset database documentation](https://docs.stackable.tech/home/nightly/superset/usage-guide/database-connections) for details ([#722], [#754]).
- Internal operator refactoring: introduce dereference() and validate() steps in the reconciler ([#731]).
- test: Bump vector-aggregator to 0.55.0, replace /graphql call with gRPC call ([#735]).
- BREAKING: Removed product-config machinery. This is a breaking change in terms of configuration.
Expand All @@ -39,6 +38,7 @@
[#735]: https://github.com/stackabletech/superset-operator/pull/735
[#738]: https://github.com/stackabletech/superset-operator/pull/738
[#751]: https://github.com/stackabletech/superset-operator/pull/751
[#754]: https://github.com/stackabletech/superset-operator/pull/754

## [26.3.0] - 2026-03-16

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
image:
productVersion: 6.1.0
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
4 changes: 2 additions & 2 deletions extra/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ spec:
and `stopped` will take no effect until `reconciliationPaused` is set to false or removed.
type: boolean
type: object
credentialsSecretName:
credentialsSecret:
description: |-
The name of the Secret object containing the admin user credentials.
Read the
Expand Down Expand Up @@ -1108,7 +1108,7 @@ spec:
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- credentialsSecretName
- credentialsSecret
- metadataDatabase
type: object
image:
Expand Down
86 changes: 86 additions & 0 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use snafu::{ResultExt, Snafu};
use stackable_operator::{
builder::meta::ObjectMetaBuilder,
cli::OperatorEnvironmentOptions,
client::Client,
cluster_resources::ClusterResourceApplyStrategy,
commons::{
affinity::StackableAffinity,
Expand All @@ -17,6 +18,7 @@ use stackable_operator::{
rbac::build_rbac_resources,
resources::{NoRuntimeLimits, Resources},
},
k8s_openapi::api::core::v1::Secret,
kube::{
Resource, ResourceExt,
api::ObjectMeta,
Expand Down Expand Up @@ -48,6 +50,7 @@ use stackable_operator::{
},
};
use strum::{EnumDiscriminants, IntoStaticStr};
use tracing::instrument;

use crate::{
OPERATOR_NAME,
Expand Down Expand Up @@ -467,6 +470,22 @@ pub enum Error {
CreateSecretKeySecret {
source: random_secret_creation::Error,
},

#[snafu(display("failed to retrieve credentials secret {secret_name:?}"))]
RetrieveCredentialsSecret {
source: stackable_operator::client::Error,
secret_name: String,
},

#[snafu(display("object is missing metadata to build owner reference"))]
ObjectMissingMetadataForOwnerRef {
source: stackable_operator::builder::meta::Error,
},

#[snafu(display("failed to create SECRET_KEY secret from migrated value "))]
Comment thread
sbernauer marked this conversation as resolved.
Outdated
CreateRandomSecret {
source: stackable_operator::client::Error,
},
}

type Result<T, E = Error> = std::result::Result<T, E>;
Expand Down Expand Up @@ -534,6 +553,7 @@ pub async fn reconcile_superset(
.await
.context(ApplyRoleBindingSnafu)?;

migrate_legacy_secret_key_secret_from_26_3(superset, &validated, client).await?;
Comment thread
Techassi marked this conversation as resolved.
create_random_secret_if_not_exists(
&validated.cluster_config.secret_key_secret_name,
INTERNAL_SECRET_SECRET_KEY,
Expand Down Expand Up @@ -692,6 +712,72 @@ pub async fn reconcile_superset(
Ok(Action::await_change())
}

// TODO: Can be removed after SDP 26.7 is released (it's only a migration from 26.3 - 26.7)
// (don't forget about the snafu Error variants).
// Removal is tracked in https://github.com/stackabletech/superset-operator/issues/755
#[instrument(skip_all)]
async fn migrate_legacy_secret_key_secret_from_26_3(
superset: &SupersetCluster,
validated: &ValidatedCluster,
client: &Client,
) -> Result<()> {
let old_secret_name = &validated.cluster_config.credentials_secret_name;
let new_secret_name = &validated.cluster_config.secret_key_secret_name;
let secret_namespace = &validated.namespace;

let new_secret = client
.get_opt::<Secret>(new_secret_name, secret_namespace.as_ref())
.await
.with_context(|_| RetrieveCredentialsSecretSnafu {
secret_name: new_secret_name,
})?;
if new_secret.is_some() {
tracing::debug!("SECRET_KEY Secret already exists, nothing to migrate");
return Ok(());
}

let old_secret = client
.get_opt::<Secret>(old_secret_name, secret_namespace.as_ref())
.await
.with_context(|_| RetrieveCredentialsSecretSnafu {
secret_name: old_secret_name,
})?;
let old_secret_key = old_secret
.and_then(|secret| secret.data)
// Note: We remove the key to take ownership
.and_then(|mut data| data.remove("connections.secretKey"))
.and_then(|key| String::from_utf8(key.0).ok());
if let Some(old_secret_key) = old_secret_key {
tracing::info!(
old.secret.name = old_secret_name,
old.secret.namespace = %secret_namespace,
new.secret.name = new_secret_name,
new.secret.namespace = %secret_namespace,
"Migrating old SECRET_KEY to new Secret"
);

let secret = Secret {
metadata: ObjectMetaBuilder::new()
.name(new_secret_name)
.namespace(secret_namespace)
.ownerreference_from_resource(superset, None, Some(true))
.context(ObjectMissingMetadataForOwnerRefSnafu)?
.build(),
string_data: Some(BTreeMap::from([(
INTERNAL_SECRET_SECRET_KEY.to_string(),
old_secret_key,
)])),
..Secret::default()
};
client
.create(&secret)
.await
.context(CreateRandomSecretSnafu)?;
Comment thread
sbernauer marked this conversation as resolved.
}

Ok(())
}

pub fn error_policy(
_obj: Arc<DeserializeGuard<SupersetCluster>>,
error: &Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod tests {
image:
productVersion: 4.1.4
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/controller/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ mod tests {
image:
productVersion: 4.1.4
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {
image:
productVersion: 4.1.4
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/crd/affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod tests {
image:
productVersion: 6.1.0
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
4 changes: 3 additions & 1 deletion rust/operator-binary/src/crd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ pub mod versioned {
/// Read the
/// [getting started guide first steps](DOCS_BASE_URL_PLACEHOLDER/superset/getting_started/first_steps)
/// to find out more.
// TODO: In the future rename this to `credentialsSecretName`
#[serde(rename = "credentialsSecret")]
pub credentials_secret_name: String,

/// Cluster operations like pause reconciliation or cluster stop.
Expand Down Expand Up @@ -615,7 +617,7 @@ mod tests {
reconciliationPaused: false
stopped: true
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/ldap/50-install-superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
{%- endif %}

userRegistrationRole: Admin
credentialsSecretName: superset-with-ldap-admin-credentials
credentialsSecret: superset-with-ldap-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/logging/21-install-superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/oidc/40_install-superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- authenticationClass: keycloak2-$NAMESPACE
oidc:
clientCredentialsSecret: superset-keycloak2-client
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/opa/40_superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
roleMappingFromOpa:
configMapName: opa
package: superset
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/smoke/30-install-superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
{% endif %}
pullPolicy: IfNotPresent
clusterConfig:
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/kuttl/upgrade/40_install-superset.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
oidc:
clientCredentialsSecret: superset-keycloak1-client
{% endif %}
credentialsSecretName: superset-admin-credentials
credentialsSecret: superset-admin-credentials
metadataDatabase:
postgresql:
host: superset-postgresql
Expand Down
Loading