diff --git a/CHANGELOG.md b/CHANGELOG.md index 176ed122..509d420f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ ### Added - Initial implementation of the operator added. An admin user can be created in the Superset - database with the Init command which takes the credentials from a secret ([#7], [#12]). + database with the Init command which takes the credentials from a secret ([#7], [#12], [#33]). [#7]: https://github.com/stackabletech/superset-operator/pull/7 [#12]: https://github.com/stackabletech/superset-operator/pull/12 +[#33]: https://github.com/stackabletech/superset-operator/pull/33 diff --git a/deploy/crd/supersetcredentials.crd.yaml b/deploy/crd/supersetcredentials.crd.yaml deleted file mode 100644 index 21e8d3dc..00000000 --- a/deploy/crd/supersetcredentials.crd.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: supersetcredentials.superset.stackable.tech -spec: - group: superset.stackable.tech - names: - categories: [] - kind: SupersetCredentials - plural: supersetcredentials - shortNames: - - supersetcredentials - singular: supersetcredentials - scope: Namespaced - versions: - - additionalPrinterColumns: [] - name: v1alpha1 - schema: - openAPIV3Schema: - description: "Auto-generated derived type for SupersetCredentialsSpec via `CustomResource`" - properties: - spec: - properties: - adminUser: - properties: - email: - type: string - firstname: - type: string - lastname: - type: string - password: - type: string - username: - type: string - required: - - email - - firstname - - lastname - - password - - username - type: object - connections: - properties: - secretKey: - type: string - sqlalchemyDatabaseUri: - type: string - required: - - secretKey - - sqlalchemyDatabaseUri - type: object - required: - - adminUser - - connections - type: object - required: - - spec - title: SupersetCredentials - type: object - served: true - storage: true - subresources: {} diff --git a/deploy/helm/superset-operator/crds/crds.yaml b/deploy/helm/superset-operator/crds/crds.yaml index a66cc475..e9a93225 100644 --- a/deploy/helm/superset-operator/crds/crds.yaml +++ b/deploy/helm/superset-operator/crds/crds.yaml @@ -470,69 +470,3 @@ spec: storage: true subresources: status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: supersetcredentials.superset.stackable.tech - annotations: - helm.sh/resource-policy: keep -spec: - group: superset.stackable.tech - names: - categories: [] - kind: SupersetCredentials - plural: supersetcredentials - shortNames: - - supersetcredentials - singular: supersetcredentials - scope: Namespaced - versions: - - additionalPrinterColumns: [] - name: v1alpha1 - schema: - openAPIV3Schema: - description: "Auto-generated derived type for SupersetCredentialsSpec via `CustomResource`" - properties: - spec: - properties: - adminUser: - properties: - email: - type: string - firstname: - type: string - lastname: - type: string - password: - type: string - username: - type: string - required: - - email - - firstname - - lastname - - password - - username - type: object - connections: - properties: - secretKey: - type: string - sqlalchemyDatabaseUri: - type: string - required: - - secretKey - - sqlalchemyDatabaseUri - type: object - required: - - adminUser - - connections - type: object - required: - - spec - title: SupersetCredentials - type: object - served: true - storage: true - subresources: {} diff --git a/deploy/manifests/crds.yaml b/deploy/manifests/crds.yaml index 8b09ac72..4140e20f 100644 --- a/deploy/manifests/crds.yaml +++ b/deploy/manifests/crds.yaml @@ -471,69 +471,3 @@ spec: storage: true subresources: status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: supersetcredentials.superset.stackable.tech - annotations: - helm.sh/resource-policy: keep -spec: - group: superset.stackable.tech - names: - categories: [] - kind: SupersetCredentials - plural: supersetcredentials - shortNames: - - supersetcredentials - singular: supersetcredentials - scope: Namespaced - versions: - - additionalPrinterColumns: [] - name: v1alpha1 - schema: - openAPIV3Schema: - description: "Auto-generated derived type for SupersetCredentialsSpec via `CustomResource`" - properties: - spec: - properties: - adminUser: - properties: - email: - type: string - firstname: - type: string - lastname: - type: string - password: - type: string - username: - type: string - required: - - email - - firstname - - lastname - - password - - username - type: object - connections: - properties: - secretKey: - type: string - sqlalchemyDatabaseUri: - type: string - required: - - secretKey - - sqlalchemyDatabaseUri - type: object - required: - - adminUser - - connections - type: object - required: - - spec - title: SupersetCredentials - type: object - served: true - storage: true - subresources: {} diff --git a/examples/simple-superset-credentials-secret.yaml b/examples/simple-superset-credentials-secret.yaml index 05802c5c..5695d06b 100644 --- a/examples/simple-superset-credentials-secret.yaml +++ b/examples/simple-superset-credentials-secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: simple-superset-credentials -type: superset.stackable.tech/superset-credentials +type: Opaque stringData: adminUser.username: admin adminUser.firstname: Superset diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index ede85b3d..d8e676d5 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -53,25 +53,14 @@ pub struct SupersetClusterSpec { pub nodes: Role, } -#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[kube( - group = "superset.stackable.tech", - version = "v1alpha1", - kind = "SupersetCredentials", - plural = "supersetcredentials", - shortname = "supersetcredentials", - namespaced, - kube_core = "stackable_operator::kube::core", - k8s_openapi = "stackable_operator::k8s_openapi", - schemars = "stackable_operator::schemars" -)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] -pub struct SupersetCredentialsSpec { +pub struct SupersetCredentials { pub admin_user: AdminUserCredentials, pub connections: Connections, } -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AdminUserCredentials { pub username: String, @@ -81,7 +70,7 @@ pub struct AdminUserCredentials { pub password: String, } -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Connections { pub secret_key: String, diff --git a/rust/operator-binary/build.rs b/rust/operator-binary/build.rs index f467fe22..a9433a9f 100644 --- a/rust/operator-binary/build.rs +++ b/rust/operator-binary/build.rs @@ -1,12 +1,11 @@ use stackable_operator::crd::CustomResourceExt; use stackable_superset_crd::commands::{Init, Restart, Start, Stop}; -use stackable_superset_crd::{SupersetCluster, SupersetCredentials}; +use stackable_superset_crd::SupersetCluster; fn main() -> Result<(), stackable_operator::error::Error> { built::write_built_file().expect("Failed to acquire build-time information"); SupersetCluster::write_yaml_schema("../../deploy/crd/supersetcluster.crd.yaml")?; - SupersetCredentials::write_yaml_schema("../../deploy/crd/supersetcredentials.crd.yaml")?; Init::write_yaml_schema("../../deploy/crd/init.crd.yaml")?; Restart::write_yaml_schema("../../deploy/crd/restart.crd.yaml")?; Start::write_yaml_schema("../../deploy/crd/start.crd.yaml")?; diff --git a/rust/operator-binary/src/stackable-superset-operator.rs b/rust/operator-binary/src/stackable-superset-operator.rs index 8750b66e..ec17648b 100644 --- a/rust/operator-binary/src/stackable-superset-operator.rs +++ b/rust/operator-binary/src/stackable-superset-operator.rs @@ -3,7 +3,7 @@ use stackable_operator::kube::CustomResourceExt; use stackable_operator::{cli, logging}; use stackable_operator::{client, error}; use stackable_superset_crd::commands::{Init, Restart, Start, Stop}; -use stackable_superset_crd::{SupersetCluster, SupersetCredentials}; +use stackable_superset_crd::SupersetCluster; use tracing::error; mod built_info { @@ -25,7 +25,6 @@ async fn main() -> Result<(), error::Error> { SubCommand::with_name("crd") .setting(AppSettings::ArgRequiredElseHelp) .subcommand(cli::generate_crd_subcommand::()) - .subcommand(cli::generate_crd_subcommand::()) .subcommand(cli::generate_crd_subcommand::()) .subcommand(cli::generate_crd_subcommand::()) .subcommand(cli::generate_crd_subcommand::()) @@ -37,9 +36,6 @@ async fn main() -> Result<(), error::Error> { if cli::handle_crd_subcommand::(subcommand)? { return Ok(()); }; - if cli::handle_crd_subcommand::(subcommand)? { - return Ok(()); - }; if cli::handle_crd_subcommand::(subcommand)? { return Ok(()); };