Skip to content

Commit 7d1e021

Browse files
committed
Rename product_namespace to namespace
1 parent c3e9fb4 commit 7d1e021

File tree

6 files changed

+20
-28
lines changed

6 files changed

+20
-28
lines changed

rust/stackable-cockpit/src/platform/demo/spec.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,14 @@ impl DemoSpec {
9797
/// - Does the demo support to be installed in the requested namespace?
9898
/// - Does the cluster have enough resources available to run this demo?
9999
#[instrument(skip_all)]
100-
pub async fn check_prerequisites(
101-
&self,
102-
client: &Client,
103-
product_namespace: &str,
104-
) -> Result<(), Error> {
100+
pub async fn check_prerequisites(&self, client: &Client, namespace: &str) -> Result<(), Error> {
105101
debug!("Checking prerequisites before installing demo");
106102

107103
// Returns an error if the demo doesn't support to be installed in the
108104
// requested namespace
109-
if !self.supports_namespace(product_namespace) {
105+
if !self.supports_namespace(namespace) {
110106
return Err(Error::UnsupportedNamespace {
111-
requested: product_namespace.to_string(),
107+
requested: namespace.to_string(),
112108
supported: self.supported_namespaces.clone(),
113109
});
114110
}

rust/stackable-cockpit/src/platform/manifests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ pub enum Error {
6262

6363
pub trait InstallManifestsExt {
6464
// TODO (Techassi): This step shouldn't care about templating the manifests nor fetching them from remote
65-
#[instrument(skip_all, fields(%product_namespace))]
65+
#[instrument(skip_all, fields(%namespace))]
6666
#[allow(async_fn_in_trait)]
6767
async fn install_manifests(
6868
manifests: &[ManifestSpec],
6969
parameters: &HashMap<String, String>,
70-
product_namespace: &str,
70+
namespace: &str,
7171
labels: Labels,
7272
client: &Client,
7373
transfer_client: &xfer::Client,
@@ -77,7 +77,7 @@ pub trait InstallManifestsExt {
7777
let mut parameters = parameters.clone();
7878
// We add the NAMESPACE parameter, so that stacks/demos can use that to render e.g. the
7979
// fqdn service names [which contain the namespace].
80-
parameters.insert("NAMESPACE".to_owned(), product_namespace.to_owned());
80+
parameters.insert("NAMESPACE".to_owned(), namespace.to_owned());
8181

8282
for manifest in manifests {
8383
match manifest {
@@ -116,7 +116,7 @@ pub trait InstallManifestsExt {
116116
chart_version: Some(&helm_chart.version),
117117
},
118118
Some(&values_yaml),
119-
product_namespace,
119+
namespace,
120120
true,
121121
)
122122
.context(InstallHelmReleaseSnafu {
@@ -140,7 +140,7 @@ pub trait InstallManifestsExt {
140140
.context(FileTransferSnafu)?;
141141

142142
client
143-
.deploy_manifests(&manifests, product_namespace, labels.clone())
143+
.deploy_manifests(&manifests, namespace, labels.clone())
144144
.await
145145
.context(DeployManifestSnafu)?
146146
}

rust/stackable-cockpit/src/platform/stack/spec.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,17 @@ impl StackSpec {
111111
/// - Does the stack support to be installed in the requested namespace?
112112
/// - Does the cluster have enough resources available to run this stack?
113113
#[instrument(skip_all)]
114-
pub async fn check_prerequisites(
115-
&self,
116-
client: &Client,
117-
product_namespace: &str,
118-
) -> Result<(), Error> {
114+
pub async fn check_prerequisites(&self, client: &Client, namespace: &str) -> Result<(), Error> {
119115
debug!("Checking prerequisites before installing stack");
120116

121117
// Returns an error if the stack doesn't support to be installed in the
122118
// requested product namespace. When installing a demo, this check is
123119
// already done on the demo spec level, however we still need to check
124120
// here, as stacks can be installed on their own.
125-
if !self.supports_namespace(product_namespace) {
121+
if !self.supports_namespace(namespace) {
126122
return Err(Error::UnsupportedNamespace {
127123
supported: self.supported_namespaces.clone(),
128-
requested: product_namespace.to_string(),
124+
requested: namespace.to_string(),
129125
});
130126
}
131127

@@ -204,7 +200,7 @@ impl StackSpec {
204200
&self,
205201
release_list: release::ReleaseList,
206202
operator_namespace: &str,
207-
_product_namespace: &str, // TODO (@NickLarsenNZ): remove this field
203+
_namespace: &str, // TODO (@NickLarsenNZ): remove this field
208204
chart_source: &ChartSourceType,
209205
) -> Result<(), Error> {
210206
info!(self.release, "Trying to install release");

rust/stackablectl/src/cmds/stacklet.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ pub struct StackletCredentialsArgs {
4848
short = 'n',
4949
global = true,
5050
default_value = DEFAULT_NAMESPACE,
51-
visible_aliases(["product-ns"]),
51+
aliases(["product-ns", "product-namespace"]),
5252
long_help = "Namespace in the cluster used to deploy the products. Use this to select
5353
a different namespace for credential lookup.")]
54-
pub product_namespace: String,
54+
pub namespace: String,
5555
}
5656

5757
#[derive(Debug, Args)]
@@ -211,7 +211,7 @@ async fn credentials_cmd(args: &StackletCredentialsArgs) -> Result<String, CmdEr
211211

212212
match get_credentials_for_product(
213213
&client,
214-
&args.product_namespace,
214+
&args.namespace,
215215
&args.stacklet_name,
216216
&args.product_name,
217217
)
@@ -229,7 +229,7 @@ async fn credentials_cmd(args: &StackletCredentialsArgs) -> Result<String, CmdEr
229229

230230
let output = format!(
231231
"Credentials for {} ({}) in namespace '{}':",
232-
args.product_name, args.stacklet_name, args.product_namespace
232+
args.product_name, args.stacklet_name, args.namespace
233233
);
234234

235235
Ok(format!("{}\n\n{}", output, table))

rust/stackablectl/src/output/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl ContextExt for ErrorContext {
1616
let mut ctx = tera::Context::new();
1717

1818
ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE);
19-
ctx.insert("default_product_namespace", DEFAULT_NAMESPACE);
19+
ctx.insert("default_namespace", DEFAULT_NAMESPACE);
2020

2121
ctx.insert("post_hints", &self.post_hints);
2222
ctx.insert("pre_hints", &self.pre_hints);

rust/stackablectl/src/output/result.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::output::{ContextExt, OutputKind};
55
#[derive(Debug, Default)]
66
pub struct ResultContext {
77
used_operator_namespace: String,
8-
used_product_namespace: String,
8+
used_namespace: String,
99

1010
command_hints: Vec<String>,
1111
post_hints: Vec<String>,
@@ -20,10 +20,10 @@ impl ContextExt for ResultContext {
2020
let mut ctx = tera::Context::new();
2121

2222
ctx.insert("default_operator_namespace", DEFAULT_OPERATOR_NAMESPACE);
23-
ctx.insert("default_product_namespace", DEFAULT_NAMESPACE);
23+
ctx.insert("default_namespace", DEFAULT_NAMESPACE);
2424

2525
ctx.insert("used_operator_namespace", &self.used_operator_namespace);
26-
ctx.insert("used_product_namespace", &self.used_product_namespace);
26+
ctx.insert("used_namespace", &self.used_namespace);
2727

2828
ctx.insert("command_hints", &self.command_hints);
2929
ctx.insert("post_hints", &self.post_hints);

0 commit comments

Comments
 (0)