Repository navigation
Conversation
Based on https://github.com/clux/controller-rs This does not handle deletions yet.
Needs cleaning up.
The operator now creates a single pod object per ZooKeeperCluster and also watches these pods for changes.
myid file is still missing.
Used to be v3_5_8 but is now 3.5.8 as intended.
That's where it belongs!
I need to pull out the configuration options into a common object.
This is a temporary workaround, the goal is to use nodeSelectors and let the Scheduler assign pods.
…ientPort was missing.
soenkeliebau
left a comment
There was a problem hiding this comment.
I've left a few comments, more thoughts than actual requests for changes, I'd be happy for this to go in as is.
We are currently missing the rust build checks though, those could just go in this PR so we have them in place..
| properties: | ||
| version: | ||
| type: string | ||
| enum: [ 3.4.14 ] |
There was a problem hiding this comment.
Is this on purpose or just a leftover from the demo?
| use kube::CustomResource; | ||
| use serde::{Deserialize, Serialize}; | ||
| use stackable_operator::CRD; | ||
| use std::collections::HashMap; |
| /// This method contains the logic of reconciling an object (the desired state) we received with the actual state. | ||
| /// | ||
| /// We distinguish between three different types: | ||
| /// * Create |
There was a problem hiding this comment.
I'm still a bit shaky on the whole reconciliation concept, but shouldn't we treat create and update the same? From looking at the code the only extra thing we do when creating a cluster is adding the finalizer, which we use to check if we call create or update when reconciliation is started - seems to me to be a bit of hen and egg?
|
|
||
| /// This creates an instance of a [`Controller`] which waits for incoming events and reconciles them. | ||
| /// | ||
| /// This is an async method and the returned future needs to be consumed to make progress. |
There was a problem hiding this comment.
nit: might be clearer: consumed -> awaited
| zk_cluster: &ZooKeeperCluster, | ||
| context: &Context<ContextData>, | ||
| ) -> Result<ReconcilerAction, Error> { | ||
| let zk_spec: ZooKeeperClusterSpec = zk_cluster.spec.clone(); |
There was a problem hiding this comment.
This could be a reference I think
| labels.insert("zookeeper-name".to_string(), name.clone()); | ||
|
|
||
| let mut options = HashMap::new(); | ||
| options.insert("tickTime".to_string(), "2000".to_string()); |
There was a problem hiding this comment.
maybe add a TODO here to pull this out into a generic option crate?
| for (i, server) in zk_spec.servers.iter().enumerate() { | ||
| options.insert( | ||
| format!("server.{}", i + 1), | ||
| format!("{}:2888:3888", server.node_name), |
There was a problem hiding this comment.
add TODO to make this configurable?
| patch_resource(&pods_api, &pod_name, &pod, FIELD_MANAGER).await?; | ||
|
|
||
| let config = handlebars | ||
| .render("conf", &json!({ "options": options })) |
There was a problem hiding this comment.
Just a suggestion: I've used strict mode in the agent to ensure we fail early, in case a necessary variable is undefined
| }) | ||
| } | ||
|
|
||
| fn build_pod( |
There was a problem hiding this comment.
Haven't looked too closely at this function as I assume this will change fundamentally and was more to get the demo of the ground.
What I looked at seems totally fine.
…tion of pods. This is WIP and relies on unreviewed changes to operator-rs
|
Closing in favor of a new branch |
…ackabletech/operator-templating repo. Original commit message: Add actions to build Helm charts to the operators and retire os package building. (#7) * First version - mostly working * Replace operator version placeholder in Helm chart. * Fix ansible equality test with older jinja version and make Makefile a j2 template. * Reenable all repos * Bugfix: indentation and Makefile. * Update template/.github/workflows/publish_dev_artifacts.yml.j2 Co-authored-by: Teo Klestrup Röijezon <teo.roijezon@stackable.de> * Update repositories.yaml Co-authored-by: Teo Klestrup Röijezon <teo.roijezon@stackable.de> * Update template/.github/workflows/publish_dev_artifacts.yml.j2 Co-authored-by: Teo Klestrup Röijezon <teo.roijezon@stackable.de> * Update template/.github/workflows/publish_dev_artifacts.yml.j2 Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> * Update template/.github/workflows/publish_release_artifacts.yml.j2 Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> * Update template/.github/workflows/publish_release_artifacts.yml.j2 Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> * Moved crd.yaml to crds directory. * Update template/deploy/helm/[[product]]-operator/README.md.j2 Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> * Update template/deploy/helm/[[product]]-operator/templates/serviceaccount.yaml.j2 Co-authored-by: Siegfried Weber <mail@siegfriedweber.net> * Removed kind action from Makefile. Added chart linting config back in. * Text fix * Addressed review comments * Added note to Readme about potentielly missing details. * Fix yp call and indentation in Makefile.j2 * Install roles.yaml when compiling the Helm chart * Added wildcard cluster role for all operators. * WIP: testing hive and druid. * WIP: testing with Trino fails. * Make roles.yaml a Jinja template. * More templating of the roles.yaml.j2 * Add update verb to configmaps resource. Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Co-authored-by: Teo Klestrup Röijezon <teo.roijezon@stackable.de> Co-authored-by: Siegfried Weber <mail@siegfriedweber.net>
This is a start.
It defines a simple ZooKeeperCluster object and reacts to it.
It creates pods as necessary but the configuration is still missing.
This fixes #3, #1 and #2
I will keep this as a draft until the operator-rs code has been reviewed and will then migrate this code to use the new library.