Skip to content
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

Upgrade vector #465

Merged
merged 14 commits into from
Aug 3, 2023
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Default stackableVersion to operator version ([#465]).

### Changed

- `vector` `0.26.0` -> `0.31.0` ([#465]).
- `operator-rs` `0.44.0` -> `0.45.1` ([#465]).

[#465]: https://github.com/stackabletech/opa-operator/pull/465

## [23.7.0] - 2023-07-14

### Added
Expand Down
38 changes: 30 additions & 8 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions deploy/helm/opa-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ spec:
- productVersion
- required:
- productVersion
- stackableVersion
description: The OPA image to use
properties:
custom:
Expand All @@ -81,7 +80,7 @@ spec:
description: Version of the product, e.g. `1.4.1`.
type: string
pullPolicy:
default: IfNotPresent
default: Always
description: '[Pull policy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) used when pulling the Images'
enum:
- IfNotPresent
Expand All @@ -104,7 +103,8 @@ spec:
nullable: true
type: string
stackableVersion:
description: Stackable version of the product, e.g. 2.1.0
description: Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`. If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
nullable: true
type: string
type: object
servers:
Expand Down
2 changes: 1 addition & 1 deletion rust/crd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = "0.0.0-dev"
publish = false

[dependencies]
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.44.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.45.1" }

semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "0.0.0-dev"
publish = false

[dependencies]
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.44.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.45.1" }
stackable-opa-crd = { path = "../crd" }

clap = "4.1"
Expand All @@ -20,12 +20,12 @@ semver = "1.0"
serde = "1.0"
serde_json = "1.0"
snafu = "0.7"
strum = { version = "0.24", features = ["derive"] }
strum = { version = "0.25", features = ["derive"] }
tokio = { version = "1.28", features = ["full"] }
tracing = "0.1"
pin-project = "1.0"

[build-dependencies]
built = { version = "0.5", features = ["chrono", "git2"] }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.44.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.45.1" }
stackable-opa-crd = { path = "../crd" }
5 changes: 4 additions & 1 deletion rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ pub async fn reconcile_opa(opa: Arc<OpaCluster>, ctx: Arc<Ctx>) -> Result<Action
tracing::info!("Starting reconcile");
let opa_ref = ObjectRef::from_obj(opa.as_ref());
let client = &ctx.client;
let resolved_product_image = opa.spec.image.resolve(DOCKER_IMAGE_BASE_NAME);
let resolved_product_image: ResolvedProductImage = opa
.spec
.image
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::CARGO_PKG_VERSION);
let opa_role = OpaRole::Server;

let mut cluster_resources = ClusterResources::new(
Expand Down
1 change: 1 addition & 0 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use std::sync::Arc;
pub mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET");
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
}

#[derive(Parser)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ commands:
- script: >-
helm install opa-vector-aggregator vector
--namespace $NAMESPACE
--version 0.19.0
--version 0.23.0
--repo https://helm.vector.dev
--values opa-vector-aggregator-values.yaml
---
Expand Down
siegfriedweber marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ customConfig:
type: vector
version: "2"
transforms:
automaticLogConfigServerOpa:
filteredAutomaticLogConfigServerOpa:
type: filter
inputs: [vector]
condition: >-
starts_with(string!(.pod), "test-opa-server-automatic-log-config") &&
.container == "opa"
automaticLogConfigServerBundleBuilder:
filteredAutomaticLogConfigServerBundleBuilder:
type: filter
inputs: [vector]
condition: >-
starts_with(string!(.pod), "test-opa-server-automatic-log-config") &&
.container == "bundle-builder"
automaticLogConfigServerVector:
filteredAutomaticLogConfigServerVector:
type: filter
inputs: [vector]
condition: >-
starts_with(string!(.pod), "test-opa-server-automatic-log-config") &&
.container == "vector"
automaticLogConfigServerPrepare:
filteredAutomaticLogConfigServerPrepare:
type: filter
inputs: [vector]
condition: >-
Expand Down
21 changes: 14 additions & 7 deletions tests/templates/kuttl/logging/test_log_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import requests


def check_processed_events():
def check_sent_events():
response = requests.post(
'http://opa-vector-aggregator:8686/graphql',
json={
Expand All @@ -12,8 +12,8 @@
nodes {
componentId
metrics {
processedEventsTotal {
processedEventsTotal
sentEventsTotal {
sentEventsTotal
}
}
}
Expand All @@ -30,12 +30,19 @@

transforms = result['data']['transforms']['nodes']
for transform in transforms:
processedEvents = transform['metrics']['processedEventsTotal']['processedEventsTotal']
sentEvents = transform['metrics']['sentEventsTotal']
componentId = transform['componentId']
assert processedEvents > 0, \
f'No events were processed in "{componentId}".'

if componentId == 'filteredInvalidEvents':
assert sentEvents is None or \
sentEvents['sentEventsTotal'] == 0, \
'Invalid log events were sent.'

Check failure on line 39 in tests/templates/kuttl/logging/test_log_aggregation.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/templates/kuttl/logging/test_log_aggregation.py#L39 <128>

continuation line under-indented for visual indent
Raw output
./tests/templates/kuttl/logging/test_log_aggregation.py:39:17: E128 continuation line under-indented for visual indent
else:
assert sentEvents is not None and \
sentEvents['sentEventsTotal'] > 0, \
f'No events were sent in "{componentId}".'

Check failure on line 43 in tests/templates/kuttl/logging/test_log_aggregation.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] tests/templates/kuttl/logging/test_log_aggregation.py#L43 <128>

continuation line under-indented for visual indent
Raw output
./tests/templates/kuttl/logging/test_log_aggregation.py:43:17: E128 continuation line under-indented for visual indent


if __name__ == '__main__':
check_processed_events()
check_sent_events()
print('Test successful!')