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

Use docker image #119

Merged
merged 14 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.4.1] - 2021-10-27
### Changed
- `operator-rs` `0.3.0` → `0.4.0` ([#119]).
- Adapted pod image and container command to docker image ([#119]).
- BREAKING CRD: Fixed typos `Reporule` to `Regorule` ([#119]).
- Adapted documentation to represent new workflow with docker images ([#119]).

### Removed
- BREAKING monitoring: container port `metrics` temporarily removed (cannot assign the same port to `client` and `metrics`). This will not work with the current monitoring approach ([#119]).

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

## [0.4.1] - 2021-10-27

### Added

Expand Down
60 changes: 30 additions & 30 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

This is a Kubernetes Operator to manage OPA servers.

It is written by https://www.stackable.de[Stackable] in Rust, and it is supposed to be used with the https://github.com/stackabletech/agent[Stackable Agent] instead of the Kubernetes kubelet.

The docs can be found in the `docs` subdirectory, and they are published together with docs for all other Stackable products at https://docs.stackable.tech.
8 changes: 4 additions & 4 deletions deploy/crd/openpolicyagent.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ spec:
minimum: 0.0
nullable: true
type: integer
repoRuleReference:
regoRuleReference:
type: string
required:
- repoRuleReference
- regoRuleReference
type: object
configOverrides:
additionalProperties:
Expand Down Expand Up @@ -70,10 +70,10 @@ spec:
minimum: 0.0
nullable: true
type: integer
repoRuleReference:
regoRuleReference:
type: string
required:
- repoRuleReference
- regoRuleReference
type: object
configOverrides:
additionalProperties:
Expand Down
7 changes: 6 additions & 1 deletion docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

This is an operator for Kubernetes that can manage https://www.openpolicyagent.org/[OpenPolicyAgent] servers.

WARNING: This operator does _not_ work with containers/container images. It relies on the https://github.com/stackabletech/agent/[Stackable Agent] to run on "bare metal" via systemd.
WARNING: This operator only works with images from the https://repo.stackable.tech/#browse/browse:docker:v2%2Fstackable%2Fopa[Stackable] repository

[source]
----
docker pull docker.stackable.tech/stackable/opa:<version>
----
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ To create a single node OPA (v0.27.1) cluster with Prometheus metrics exposed on
default:
selector:
matchLabels:
kubernetes.io/arch: stackable-linux
kubernetes.io/os: linux
replicas: 1
config:
port: 8181
repoRuleReference: "http://mdesktop:3030/opa/v1"
regoRuleReference: "http://localhost:3030/opa/v1"
EOF

4 changes: 2 additions & 2 deletions examples/simple-opacluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
default:
selector:
matchLabels:
kubernetes.io/arch: stackable-linux
kubernetes.io/os: linux
config:
port: 8181
repoRuleReference: "http://mdesktop:3030/opa/v1"
regoRuleReference: "http://10.101.106.208:3030/opa/v1"
2 changes: 1 addition & 1 deletion rust/crd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/stackabletech/opa-operator"
version = "0.5.0-nightly"

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

rand = "0.8"
semver = "1.0"
Expand Down
19 changes: 9 additions & 10 deletions rust/crd/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ mod tests {
use indoc::indoc;
use rstest::rstest;
use stackable_operator::k8s_openapi::api::core::v1::Pod;
use std::ops::Deref;

#[test]
fn test_clean_url() {
Expand All @@ -394,7 +393,7 @@ mod tests {
kubernetes.io/hostname: debian
replicas: 1
config:
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -426,7 +425,7 @@ mod tests {
replicas: 1
config:
port: 12345
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -458,7 +457,7 @@ mod tests {
replicas: 1
config:
port: 12345
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -511,7 +510,7 @@ mod tests {
kubernetes.io/hostname: debian
replicas: 1
config:
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -573,7 +572,7 @@ mod tests {
)
.expect("should not fail");

for res in expected_result.deref() {
for res in expected_result {
assert!(conn_string.contains(res));
}
}
Expand All @@ -590,7 +589,7 @@ mod tests {
kubernetes.io/hostname: debian
replicas: 1
config:
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -621,7 +620,7 @@ mod tests {
kubernetes.io/hostname: debian
replicas: 1
config:
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
indoc! {"
- apiVersion: v1
Expand Down Expand Up @@ -676,7 +675,7 @@ mod tests {
kubernetes.io/hostname: debian
replicas: 1
config:
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
8181
)]
Expand All @@ -692,7 +691,7 @@ mod tests {
replicas: 1
config:
port: 12345
repoRuleReference: http://debian:3030/opa/v1
regoRuleReference: http://debian:3030/opa/v1
"},
12345
)]
Expand Down
8 changes: 4 additions & 4 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub const APP_NAME: &str = "opa";
pub const MANAGED_BY: &str = "opa-operator";

pub const CONFIG_FILE: &str = "config.yaml";
pub const REPO_RULE_REFERENCE: &str = "repoRuleReference";
pub const REGO_RULE_REFERENCE: &str = "repoRuleReference";
pub const PORT: &str = "port";

#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, Serialize)]
Expand Down Expand Up @@ -140,7 +140,7 @@ impl Conditions for OpaStatus {
#[serde(rename_all = "camelCase")]
pub struct OpaConfig {
pub port: Option<u16>,
pub repo_rule_reference: String,
pub rego_rule_reference: String,
}

impl Configuration for OpaConfig {
Expand Down Expand Up @@ -174,8 +174,8 @@ impl Configuration for OpaConfig {

if file == CONFIG_FILE {
config.insert(
REPO_RULE_REFERENCE.to_string(),
Some(self.repo_rule_reference.clone()),
REGO_RULE_REFERENCE.to_string(),
Some(self.rego_rule_reference.clone()),
);
} else {
error!(
Expand Down
Loading