Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.
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
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

:262: https://github.com/stackabletech/agent/pull/262[#262]
:267: https://github.com/stackabletech/agent/pull/267[#267]
:270: https://github.com/stackabletech/agent/pull/270[#270]

=== Changed
* Lazy validation of repository URLs changed to eager validation
({262}).
* `certificates.k8s.io/v1` used instead of `certificates.k8s.io/v1beta1`
so that the Stackable Agent is now compatible with Kubernetes v1.22
but not any longer with versions prior to v1.19 ({267}).
* Prints self-diagnostic information on startup ({270})

== 0.5.0 - 2021-07-26

Expand Down
76 changes: 76 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2018"
license = "Apache-2.0"
name = "stackable-agent"
version = "0.6.0-nightly"
build = "build.rs"

[dependencies]
# We are currently referencing the Krustlet directly from a Stackable fork of the official repository.
Expand Down Expand Up @@ -52,6 +53,9 @@ indoc = "1.0"
rstest = "0.11"
serde_yaml = "0.8"

[build-dependencies]
built = { version = "0.5", features = ["chrono", "git2"] }

[profile.release]
opt-level = "s"
lto = true
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}
32 changes: 32 additions & 0 deletions src/bin/stackable-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ use stackable_config::ConfigBuilder;
use stackable_agent::config::AgentConfig;
use stackable_agent::provider::StackableProvider;

mod built_info {
// The file has been placed there by the build script.
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}

pub fn print_startup_string(
pkg_version: &str,
git_version: Option<&str>,
target: &str,
built_time: &str,
rustc_version: &str,
) {
let git_information = match git_version {
None => "".to_string(),
Some(git) => format!(" (Git information: {})", git),
};
info!("Starting the Stackable Agent");
info!(
"This is version {}{}, built for {} by {} at {}",
pkg_version, git_information, target, rustc_version, built_time
)
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize the logger
Expand All @@ -18,6 +41,15 @@ async fn main() -> anyhow::Result<()> {
ConfigBuilder::build(env::args_os().collect::<Vec<OsString>>(), "CONFIG_FILE")
.expect("Error initializing Configuration!");

// Make sure to only print diagnostic information once we are actually trying to start
print_startup_string(
built_info::PKG_VERSION,
built_info::GIT_VERSION,
built_info::TARGET,
built_info::BUILT_TIME_UTC,
built_info::RUSTC_VERSION,
);

// Currently the only way to _properly_ configure the Krustlet is via these environment exports,
// as their config object only offers methods that parse from command line flags (or combinations
// of those flags with other things).
Expand Down