Skip to content

Changes to be compatible with crate2nix #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all 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
70 changes: 17 additions & 53 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -38,21 +38,12 @@ jobs:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
with:
profile: minimal
toolchain: "1.65.0"
override: true
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
with:
key: udeps
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
with:
command: install
args: cargo-udeps --locked
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
with:
command: udeps
- run: cargo install cargo-udeps
- run: cargo udeps

# This job evaluates the github environment to determine why this action is running and selects the appropriate
# target repository for published Helm charts based on this.
@@ -86,16 +77,16 @@ jobs:
run: |
if [[ $TRIGGER == "pull_request" ]]; then
echo "exporting test as target helm repo: ${{ env.TEST_REPO_HELM_URL }}"
echo "::set-output name=helm_repo::${{ env.TEST_REPO_HELM_URL }}"
echo "helm_repo=${{ env.TEST_REPO_HELM_URL }}" >> $GITHUB_OUTPUT
elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" ]]; then
echo "exporting dev as target helm repo: ${{ env.DEV_REPO_HELM_URL }}"
echo "::set-output name=helm_repo::${{ env.DEV_REPO_HELM_URL }}"
echo "helm_repo=${{ env.DEV_REPO_HELM_URL }}" >> $GITHUB_OUTPUT
elif [[ ( $TRIGGER == "create" || $TRIGGER == "push" ) && $GITHUB_REF == refs/tags/* ]]; then
echo "exporting stable as target helm repo: ${{ env.STABLE_REPO_HELM_URL }}"
echo "::set-output name=helm_repo::${{ env.STABLE_REPO_HELM_URL }}"
echo "helm_repo=${{ env.STABLE_REPO_HELM_URL }}" >> $GITHUB_OUTPUT
else
echo "Unknown trigger and ref combination encountered, skipping publish step: $TRIGGER $GITHUB_REF"
echo "::set-output name=helm_repo::skip"
echo "helm_repo=skip" >> $GITHUB_OUTPUT
fi
run_cargodeny:
@@ -125,16 +116,10 @@ jobs:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
- uses: dtolnay/rust-toolchain@1.65.0
with:
profile: minimal
toolchain: "1.65.0"
components: rustfmt
override: true
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
with:
command: fmt
args: --all -- --check
- run: cargo fmt --all -- --check

run_clippy:
name: Run Clippy
@@ -147,12 +132,9 @@ jobs:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
- uses: dtolnay/rust-toolchain@1.65.0
with:
profile: minimal
toolchain: "1.65.0"
components: clippy
override: true
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
with:
key: clippy
@@ -181,19 +163,13 @@ jobs:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
- uses: dtolnay/rust-toolchain@1.65.0
with:
profile: minimal
toolchain: "1.65.0"
components: rustfmt
override: true
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
with:
key: doc
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
with:
command: doc
args: --document-private-items
- run: cargo doc --document-private-items

run_tests:
name: Run Cargo Tests
@@ -206,17 +182,12 @@ jobs:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
with:
profile: minimal
toolchain: "1.65.0"
override: true
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
with:
key: test
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
with:
command: test
- run: cargo test


# Similar to check_charts, this tries to render the README, and see if there are unintended changes.
# This will save us from merging changes to the wrong file (instead of the templated source), and from
@@ -272,11 +243,7 @@ jobs:
with:
version: v3.6.2
- name: Set up cargo
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
with:
profile: minimal
toolchain: "1.65.0"
override: true
uses: dtolnay/[email protected]
- name: Set up rust-cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
with:
@@ -329,12 +296,9 @@ jobs:
submodules: recursive
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
if: ${{ github.event_name == 'pull_request' }}
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
- uses: dtolnay/rust-toolchain@1.65.0
with:
profile: minimal
toolchain: "1.65.0"
components: rustfmt
override: true
- name: Install requirements for version tool
if: ${{ github.event_name == 'pull_request' }}
run: pip install -r python/requirements.txt
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog
#h Changelog

All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Generate OLM bundle ([#645])

[#645]: https://github.com/stackabletech/commons-operator/pull/645

## [23.1.0] - 2023-01-23

### Added

- Log aggregation added ([#588]).

[#588]: https://github.com/stackabletech/zookeeper-operator/pull/588
@@ -20,6 +28,7 @@ All notable changes to this project will be documented in this file.
- Don't run init container as root and avoid chmod and chowning ([#603]).
- Fixed the RoleGroup `selector`. It was not used before. ([#611]).
- [BREAKING] Moved `spec.authentication`, `spec.tls` and `spec.logging` to `spec.clusterConfig`. Consolidated sub field names like `tls.client.secretClass` to `tls.serverSecretClass` ([#612]).
- Changes to be compatible with crate2nix ([#638])

[#586]: https://github.com/stackabletech/zookeeper-operator/pull/586
[#591]: https://github.com/stackabletech/zookeeper-operator/pull/591
@@ -29,6 +38,7 @@ All notable changes to this project will be documented in this file.
[#603]: https://github.com/stackabletech/zookeeper-operator/pull/603
[#611]: https://github.com/stackabletech/zookeeper-operator/pull/611
[#612]: https://github.com/stackabletech/zookeeper-operator/pull/612
[#638]: https://github.com/stackabletech/zookeeper-operator/pull/638

## [0.12.0] - 2022-11-07

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 0 additions & 120 deletions deploy/experimental/olm/README.md

This file was deleted.

21 changes: 0 additions & 21 deletions deploy/experimental/olm/catalog-source.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions deploy/experimental/olm/catalog.Dockerfile

This file was deleted.

350 changes: 0 additions & 350 deletions deploy/experimental/olm/manifests/zookeepercluster.crd.yaml

This file was deleted.

49 changes: 0 additions & 49 deletions deploy/experimental/olm/manifests/zookeeperznode.crd.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions deploy/experimental/olm/operator-group.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions deploy/experimental/olm/subscription.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/helm/zookeeper-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
apiVersion: v2
name: zookeeper-operator
version: "0.13.0-nightly"
appVersion: "0.13.0-nightly"
version: "0.0.0-dev"
appVersion: "0.0.0-dev"
description: The Stackable Operator for Apache ZooKeeper
home: https://github.com/stackabletech/zookeeper-operator
maintainers:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bundle
bundle.Dockerfile

catalog.Dockerfile
catalog
Original file line number Diff line number Diff line change
@@ -409,4 +409,4 @@ metadata:
labels:
app.kubernetes.io/name: zookeeper-operator
app.kubernetes.io/instance: zookeeper-operator
app.kubernetes.io/version: "0.10.0"
app.kubernetes.io/version: "23.1.0"
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
name: zookeeper-operator.v0.10.0
name: zookeeper-operator.v23.1.0
spec:
annotations:
support: stackable.tech
@@ -27,7 +27,7 @@ spec:
provider:
name: Stackable GmbH
url: https://stackable.tech
version: 0.10.0
version: 23.1.0
minKubeVersion: 1.20.0

installModes:
@@ -37,7 +37,7 @@ spec:
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: true
- supported: false
type: AllNamespaces

customresourcedefinitions:
@@ -184,6 +184,14 @@ spec:
- zookeeperclusters/status
verbs:
- patch
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
resourceNames:
- hostmount-anyuid
verbs:
- use

deployments:
- name: zookeeper-operator
@@ -206,7 +214,7 @@ spec:
containers:
- name: zookeeper-operator
securityContext: {}
image: "docker.stackable.tech/stackable/zookeeper-operator:0.10.0"
image: "docker.stackable.tech/stackable/zookeeper-operator:23.1.0"
imagePullPolicy: IfNotPresent
resources: {}
volumeMounts:
Original file line number Diff line number Diff line change
@@ -23,6 +23,6 @@ rules:
resources:
- securitycontextconstraints
resourceNames:
- hostmount-anyuid
- stackable-platform-scc
verbs:
- use
839 changes: 839 additions & 0 deletions deploy/olm/23.1.0/manifests/zkcluster.yaml

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions deploy/olm/23.1.0/manifests/zknode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: zookeeperznodes.zookeeper.stackable.tech
annotations:
helm.sh/resource-policy: keep
spec:
group: zookeeper.stackable.tech
names:
categories: []
kind: ZookeeperZnode
plural: zookeeperznodes
shortNames:
- zno
- znode
singular: zookeeperznode
scope: Namespaced
versions:
- additionalPrinterColumns: []
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for ZookeeperZnodeSpec via `CustomResource`
properties:
spec:
description: |-
A claim for a single ZooKeeper ZNode tree (filesystem node)
A `ConfigMap` will automatically be created with the same name, containing the connection string in the field `ZOOKEEPER`. Each `ZookeeperZnode` gets an isolated ZNode chroot, which the `ZOOKEEPER` automatically contains. All data inside of this chroot will be deleted when the corresponding `ZookeeperZnode` is.
`ZookeeperZnode` is *not* designed to manage the contents of this ZNode. Instead, it should be used to create a chroot for an installation of an application to work inside. Initializing the contents is the responsibility of the application.
properties:
clusterRef:
default:
name: null
namespace: null
description: |-
A reference to a product cluster (for example, a `ZookeeperCluster`)
`namespace`'s defaulting only applies when retrieved via [`ClusterRef::namespace_relative_from`]
properties:
name:
description: The name of the cluster
nullable: true
type: string
namespace:
description: |-
The namespace of the cluster
This field is optional, and will default to the namespace of the referring object.
nullable: true
type: string
type: object
type: object
required:
- spec
title: ZookeeperZnode
type: object
served: true
storage: true
subresources: {}
32 changes: 32 additions & 0 deletions deploy/olm/bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# usage: bundle.sh <release>, called from base folder:
# e.g. ./deploy/olm/bundle.sh 23.1.0

set -euo pipefail
set -x

OPERATOR_NAME="zookeeper-operator"

bundle-clean() {
rm -rf "deploy/olm/${VERSION}/bundle"
rm -rf "deploy/olm/${VERSION}/bundle.Dockerfile"
}


build-bundle() {
opm alpha bundle generate --directory manifests --package "${OPERATOR_NAME}-package" --output-dir bundle --channels stable --default stable
docker build -t "docker.stackable.tech/stackable/${OPERATOR_NAME}-bundle:${VERSION}" -f bundle.Dockerfile .
docker push "docker.stackable.tech/stackable/${OPERATOR_NAME}-bundle:${VERSION}"
opm alpha bundle validate --tag "docker.stackable.tech/stackable/${OPERATOR_NAME}-bundle:${VERSION}" --image-builder docker
}

main() {
VERSION="$1";

pushd "deploy/olm/${VERSION}"
bundle-clean
build-bundle
popd
}

main "$@"
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ then
exit 1
fi

cd "$(dirname "$0")"

case "$1" in
"helm")
echo "Adding 'stackable-dev' Helm Chart repository"
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ then
exit 1
fi

cd "$(dirname "$0")"

case "$1" in
"helm")
echo "Adding 'stackable-dev' Helm Chart repository"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")"
./getting_started.sh helm

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")"
./getting_started.sh stackablectl

2 changes: 1 addition & 1 deletion rust/crd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name = "stackable-zookeeper-crd"
authors = ["Stackable GmbH <info@stackable.de>"]
description = "Contains the Apache ZooKeeper CRD structs and utilities"
license = "OSL-3.0"
version = "0.13.0-nightly"
version = "0.0.0-dev"
edition = "2021"
repository = "https://github.com/stackabletech/zookeeper-operator"
publish = false
2 changes: 1 addition & 1 deletion rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name = "stackable-zookeeper-operator"
authors = ["Stackable GmbH <info@stackable.de>"]
description = "Stackable Operator for Apache ZooKeeper"
license = "OSL-3.0"
version = "0.13.0-nightly"
version = "0.0.0-dev"
edition = "2021"
repository = "https://github.com/stackabletech/zookeeper-operator"
publish = false
12 changes: 11 additions & 1 deletion rust/operator-binary/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
use std::path::PathBuf;

fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is required"));
built::write_built_file_with_opts(
// built's env module depends on a whole bunch of variables that crate2nix doesn't provide
// so we grab the specific env variables that we care about out ourselves instead.
built::Options::default().set_env(false),
"Cargo.toml".as_ref(),
&out_dir.join("built.rs"),
)
.unwrap();
}
11 changes: 6 additions & 5 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ mod znode_controller;
use crate::zk_controller::ZK_CONTROLLER_NAME;
use crate::znode_controller::ZNODE_CONTROLLER_NAME;

use clap::Parser;
use clap::{crate_description, crate_version, Parser};
use futures::StreamExt;
use stackable_operator::{
cli::{Command, ProductOperatorRun},
@@ -28,13 +28,14 @@ use std::sync::Arc;

mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET");
}

const APP_NAME: &str = "zookeeper";
const OPERATOR_NAME: &str = "zookeeper.stackable.tech";

#[derive(clap::Parser)]
#[clap(about = built_info::PKG_DESCRIPTION, author = stackable_operator::cli::AUTHOR)]
#[clap(about, author)]
struct Opts {
#[clap(subcommand)]
cmd: Command,
@@ -59,10 +60,10 @@ async fn main() -> anyhow::Result<()> {
tracing_target,
);
stackable_operator::utils::print_startup_string(
built_info::PKG_DESCRIPTION,
built_info::PKG_VERSION,
crate_description!(),
crate_version!(),
built_info::GIT_VERSION,
built_info::TARGET,
built_info::TARGET_PLATFORM.unwrap_or("unknown target"),
built_info::BUILT_TIME_UTC,
built_info::RUSTC_VERSION,
);