-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR refactors the init process and adds a new custom resource for druid connections. The Init resource is now called SupersetDB and also tracks a status. it is first `Provisioned`. If possible (secret also deployed) a kubernetes `Job` is started and the status of the CR becomes `Initializing`. The job is watched, and depending on whether it successfully completes or not, the SupersetDB also becomes `Ready` or `Failed` respectively. This change allows us to also depend on the DB being ready (or not). This is necessary for writing the druid connection information into the DB. A new CRD is introduced: `DruidConnection`. It holds information about the superset DB it should write to, and the Druid cluster that should be connected. A new controller watches the discovery config map as well as the superset DB resources. Once all the dependencies are there (and `Ready`) a job is started, and the status is updated, just like it is done for the `SupersetDB`. This is in line with the declarative philosophy of k8s; the spec reflects the desired state and the status tracks the actual underlying cluster. Also, with multiple controllers watching object states, control flow is delegated a bit to the API server. Before we were watching the job state manually, now we react to status changes which are given to us by the API server. The controllers only react to object changes. This PR also relies on the Druid Discovery PR stackabletech/druid-operator#102 What wasn't done: If the DruidConnection resource is deleted, the actual connection is not deleted. The issue doesn't say that this is necessary, and there is no obvious, documented way to delete data sources from the commandline, we'd have to go into the database and delete stuff there. On the controller side we can use a [finalizer](https://github.com/kube-rs/kube-rs/blob/d90ee9706923ceddf94c3d50928bc390543af2fc/examples/secret_syncer.rs#L92-L102). Co-authored-by: Felix Hennig <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,313 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[workspace] | ||
members = ["rust/crd", "rust/operator-binary"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: druidconnections.superset.stackable.tech | ||
spec: | ||
group: superset.stackable.tech | ||
names: | ||
categories: [] | ||
kind: DruidConnection | ||
plural: druidconnections | ||
shortNames: [] | ||
singular: druidconnection | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: [] | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: "Auto-generated derived type for DruidConnectionSpec via `CustomResource`" | ||
properties: | ||
spec: | ||
properties: | ||
druid: | ||
properties: | ||
name: | ||
type: string | ||
namespace: | ||
type: string | ||
required: | ||
- name | ||
- namespace | ||
type: object | ||
superset: | ||
properties: | ||
name: | ||
type: string | ||
namespace: | ||
type: string | ||
required: | ||
- name | ||
- namespace | ||
type: object | ||
required: | ||
- druid | ||
- superset | ||
type: object | ||
status: | ||
nullable: true | ||
properties: | ||
condition: | ||
enum: | ||
- Pending | ||
- Importing | ||
- Ready | ||
- Failed | ||
type: string | ||
startedAt: | ||
description: Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers. | ||
format: date-time | ||
nullable: true | ||
type: string | ||
required: | ||
- condition | ||
type: object | ||
required: | ||
- spec | ||
title: DruidConnection | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.