Skip to content

Commit

Permalink
* Dependency refresh
Browse files Browse the repository at this point in the history
* PING improvements
* Update compiler version

Signed-off-by: Ryan <[email protected]>
  • Loading branch information
ryan-s-roberts committed Apr 30, 2024
1 parent 2d01b56 commit 5b4bfb4
Show file tree
Hide file tree
Showing 19 changed files with 1,361 additions and 934 deletions.
2,084 changes: 1,181 additions & 903 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ members = [
Inflector = "0.11.4"
anyhow = "1.0.6"
assert_fs = "1.0"
async-graphql = "5.0.6"
async-graphql-poem = "5.0.6"
async-graphql = "^5.0.6"
async-graphql-poem = "^5.0.6"
async-stream = "0.3.3"
async-trait = "0.1.61"
atty = "0.2.14"
Expand Down Expand Up @@ -80,7 +80,7 @@ mockito = "1.0.2"
oauth2 = "4.4"
opa = "0.9.0"
openssl = "0.10.55"
opentelemetry = { version = "0.18.0", features = ["rt-tokio"] }
opentelemetry = { version = "^0.19.0", features = ["rt-tokio"] }
opentelemetry-jaeger = { version = "0.17.0", features = [
"rt-tokio",
"reqwest_collector_client",
Expand Down
108 changes: 104 additions & 4 deletions charts/chronicle/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,106 @@ spec:
- name: chronicle-data
mountPath: /var/lib/chronicle/store/
{{- include "lib.volumeMounts" .Values.extraVolumeMounts | nindent 12 }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
command:
- bash
- -c
- |
PROBE_ID="liveness_$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 13)" &&
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") &&
echo '[
{
"@id": "_:n1",
"@type": [
"http://btp.works/chronicleoperations/ns#ActivityExists"
],
"http://btp.works/chronicleoperations/ns#activityName": [
{
"@value": "'"$PROBE_ID"'"
}
],
"http://btp.works/chronicleoperations/ns#namespaceName": [
{
"@value": "{{ .Values.livenessProbe.namespaceName }}"
}
],
"http://btp.works/chronicleoperations/ns#namespaceUuid": [
{
"@value": "{{ .Values.livenessProbe.namespaceUuid }}"
}
]
}
]' > /tmp/import.json &&
echo "Probe ID: $PROBE_ID" &&
RUST_LOG=debug chronicle \
-c /etc/chronicle/config/config.toml \
--console-logging json \
--sawtooth tcp://{{ include "chronicle.sawtooth.service" . }}:{{ include "chronicle.sawtooth.sawcomp" . }} \
--remote-database \
--database-name {{ .Values.postgres.database }} \
--database-username {{ .Values.postgres.user }} \
--database-host {{ .Values.postgres.host }} \
{{- if not .Values.opa.enabled }}
--embedded-opa-policy \
{{- end }}
import {{ .Values.livenessProbe.namespaceName }} {{ .Values.livenessProbe.namespaceUuid }} /tmp/import.json
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.startUpProbe.enabled }}
startupProbe:
exec:
command:
- bash
- -c
- |
PROBE_ID="startup_$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 13)" &&
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") &&
echo '[
{
"@id": "_:n1",
"@type": [
"http://btp.works/chronicleoperations/ns#ActivityExists"
],
"http://btp.works/chronicleoperations/ns#activityName": [
{
"@value": "'"$PROBE_ID"'"
}
],
"http://btp.works/chronicleoperations/ns#namespaceName": [
{
"@value": "{{ .Values.startUpProbe.namespaceName }}"
}
],
"http://btp.works/chronicleoperations/ns#namespaceUuid": [
{
"@value": "{{ .Values.startUpProbe.namespaceUuid }}"
}
]
}
]' > /tmp/import.json &&
echo "Probe ID: $PROBE_ID" &&
RUST_LOG=debug chronicle \
-c /etc/chronicle/config/config.toml \
--console-logging json \
--sawtooth tcp://{{ include "chronicle.sawtooth.service" . }}:{{ include "chronicle.sawtooth.sawcomp" . }} \
--remote-database \
--database-name {{ .Values.postgres.database }} \
--database-username {{ .Values.postgres.user }} \
--database-host {{ .Values.postgres.host }} \
{{- if not .Values.opa.enabled }}
--embedded-opa-policy \
{{- end }}
import {{ .Values.startUpProbe.namespaceName }} {{ .Values.startUpProbe.namespaceUuid }} /tmp/import.json
initialDelaySeconds: {{ .Values.startUpProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startUpProbe.periodSeconds }}
timeoutSeconds: {{ .Values.startUpProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startUpProbe.failureThreshold }}
{{- end }}
volumes:
- name: chronicle-secrets
persistentVolumeClaim:
Expand All @@ -163,10 +263,10 @@ spec:
- name: chronicle-config
configMap:
name: {{ .Release.Name }}-chronicle-config
{{- if not .Values.postgres.persistence.enabled }}
{{- if not .Values.postgres.persistence.enabled }}
- name: "pgdata"
emptyDir: {}
{{- end }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: chronicle-data
Expand All @@ -176,7 +276,7 @@ spec:
resources:
requests:
storage: 6Gi
{{- if .Values.postgres.persistence.enabled }}
{{- if .Values.postgres.persistence.enabled }}
- metadata:
name: "pgdata"
annotations: {{- include "lib.safeToYaml" .Values.postgres.persistence.annotations | nindent 10 }}
Expand All @@ -186,4 +286,4 @@ spec:
resources:
requests:
storage: {{ .Values.postgres.persistence.size | quote }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/chronicle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ auth:
userinfo:
url:

## @md | `livenessProbe.enabled` | if true, enables the liveness probe | false |
livenessProbe:
enabled: false
## @md | `livenessProbe.timeoutSeconds` | number of seconds after which the probe times out | 10 |
timeoutSeconds: 20
## @md | `livenessProbe.periodSeconds` | how often (in seconds) to perform the probe | 60 |
periodSeconds: 60
## @md | `livenessProbe.failureThreshold` | when a probe fails, Kubernetes will try failureThreshold times before giving up | 1 |
failureThreshold: 1
## @md | `livenessProbe.namespaceName` | the Chronicle namespace in which the probe operates | default |
namespaceName: default
## @md | `livenessProbe.namespaceUuid` | the UUID of the Chronicle namespace in which the probe operates | fd717fd6-70f1-44c1-81de-287d5e101089 |
namespaceUuid: fd717fd6-70f1-44c1-81de-287d5e101089

## @md | `startUpProbe.enabled` | if true, enables the startup probe | true |
startUpProbe:
enabled: false
## @md | `startUpProbe.initialDelaySeconds` | number of seconds after which the probe starts | 5 |
initialDelaySeconds: 5
## @md | `startUpProbe.failureThreshold` | when a probe fails, Kubernetes will try failureThreshold times before giving up | 30 |
failureThreshold: 30
## @md | `startUpProbe.periodSeconds` | how often (in seconds) to perform the probe | 10 |
periodSeconds: 10
## @md | `startUpProbe.timeoutSeconds` | number of seconds after which the probe times out | 3 |
timeoutSeconds: 3
## @md | `startUpProbe.namespaceName` | the Chronicle namespace in which the probe operates | default |
namespaceName: default
## @md | `startUpProbe.namespaceUuid` | the UUID of the Chronicle namespace in which the probe operates | fd717fd6-70f1-44c1-81de-287d5e101089 |
namespaceUuid: fd717fd6-70f1-44c1-81de-287d5e101089


## @md | `backtraceLevel` | backtrace level for Chronicle | nil |
backtraceLevel: full

Expand Down
2 changes: 2 additions & 0 deletions crates/api/src/chronicle_graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use async_graphql::{
scalar, Context, Enum, Error, ErrorExtensions, Object, ObjectType, Schema, ServerError,
SimpleObject, Subscription, SubscriptionType,
};


use async_graphql_poem::{
GraphQL, GraphQLBatchRequest, GraphQLBatchResponse, GraphQLProtocol, GraphQLSubscription,
GraphQLWebSocket,
Expand Down
2 changes: 2 additions & 0 deletions crates/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,7 @@ mod test {
use opa_tp_protocol::state::{policy_address, policy_meta_address, PolicyMeta};
use rand_core::SeedableRng;
use sawtooth_sdk::messages::setting::{Setting, Setting_Entry};
use tracing::info;

use std::{collections::HashMap, time::Duration};
use tempfile::TempDir;
Expand All @@ -1632,6 +1633,7 @@ mod test {
// Recv until we get a commit notification
loop {
let commit = self.api.notify_commit.subscribe().recv().await.unwrap();
info!(wait_for_commit = ?commit);
match commit {
common::ledger::SubmissionStage::Submitted(Ok(_)) => continue,
common::ledger::SubmissionStage::Committed(commit, _id) => {
Expand Down
1 change: 0 additions & 1 deletion crates/async-sawtooth-sdk/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ impl<
}

let channel = self.channel.clone();
let from_block = from_block;
let event_stream = channel.recv_stream::<EventList>().await?;
let event_stream = event_stream.then(move |events| {
let event_type = event_type.clone();
Expand Down
39 changes: 27 additions & 12 deletions crates/async-sawtooth-sdk/src/zmq_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,34 @@ impl RequestResponseSawtoothChannel for ZmqRequestResponseSawtoothChannel {
Ok((channel, Ok(Ok(response))))
if response.message_type == Message_MessageType::PING_REQUEST =>
{
trace!(ping_request = ?response.correlation_id);
debug!(ping_request = ?response.correlation_id);
let ping_reply = PingResponse::default().encode_to_vec();
channel
.tx
.lock()
.unwrap()
.send(
Message_MessageType::PING_RESPONSE,
&response.correlation_id,
&ping_reply,
)
.map_err(|e| error!(send_ping_reply = ?e))
.ok();
let tx_guard = channel.tx.lock().expect("Failed to lock tx for sending");
let ping_response_result = tx_guard.send(
Message_MessageType::PING_RESPONSE,
&response.correlation_id,
&ping_reply,
);

if let Err(e) = ping_response_result {
error!(send_ping_reply = ?e);
}

let new_uuid = uuid::Uuid::new_v4().to_string();
let ping_request_result = tx_guard.send(
Message_MessageType::PING_REQUEST,
&new_uuid,
&ping_reply,
);

if let Err(e) = ping_request_result {
error!(send_ping_request = ?e);
}
}
Ok((_channel, Ok(Ok(response))))
if response.message_type == Message_MessageType::PING_RESPONSE =>
{
debug!(ping_response = ?response.correlation_id);
}
Ok((channel, Ok(Ok(response)))) => {
let response = RX::parse_from_bytes(&response.content)
Expand Down
2 changes: 1 addition & 1 deletion crates/chronicle-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "chronicle-protocol"
version = "0.7.0"
version = "0.7.6"

[lib]
name = "chronicle_protocol"
Expand Down
2 changes: 1 addition & 1 deletion crates/chronicle-synth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "chronicle-synth"
version = "0.7.0"
version = "0.7.6"

[lib]
name = "chronicle_synth"
Expand Down
2 changes: 1 addition & 1 deletion crates/chronicle-telemetry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "chronicle-telemetry"
version = "0.7.0"
version = "0.7.6"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "common"
version = "0.7.0"
version = "0.7.6"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion crates/gq-subscribe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "gq-ws"
version = "0.7.0"
version = "0.7.6"

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/id-provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "oauth-token"
version = "0.7.0"
version = "0.7.6"

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/opa-tp-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "opa-tp-protocol"
version = "0.7.0"
version = "0.7.6"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion crates/opa-tp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "opa-tp"
version = "0.7.0"
version = "0.7.6"

[lib]
name = "opa_tp"
Expand Down
2 changes: 1 addition & 1 deletion crates/opactl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build = "build.rs"
edition = "2021"
name = "opactl"
version = "0.7.0"
version = "0.7.6"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion crates/sawtooth-tp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ path = "src/lib.rs"
build = "build.rs"
edition = "2021"
name = "sawtooth_tp"
version = "0.7.0"
version = "0.7.6"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion docker/unified-builder
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG RUST_VERSION=1.68
ARG RUST_VERSION=1.77
FROM --platform=${BUILDPLATFORM} rust:${RUST_VERSION} as hostbase

ENV PKG_CONFIG_ALLOW_CROSS=1
Expand Down

0 comments on commit 5b4bfb4

Please sign in to comment.