Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Specify the operator namespace to constrain CLI's requests #1099

Merged
merged 1 commit into from
Aug 31, 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
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ object OptionsParser {
commandParse[commands.Deploy, String](opt("serviceaccount"))((c, sa) => c.copy(serviceAccount = Some(sa)))
.optional()
.text("the serviceaccount to be used"),
commandParse[commands.Deploy, String](opt("operator-namespace"))((c, ons) =>
c.copy(operatorNamespace = Some(ons)))
.optional()
.text("the namespace where the operator is deployed"),
commandCheck[commands.Deploy](d => {
if (d.logbackConfig.isDefined && !d.logbackConfig.get.exists()) {
failure("the provided logback configuration file doesn't exist")
Expand Down Expand Up @@ -349,6 +353,10 @@ object OptionsParser {
commandParse[commands.Configure, File](opt("logback-config"))((c, f) => c.copy(logbackConfig = Some(f)))
.optional()
.text("the logback configuration to be applied"),
commandParse[commands.Configure, String](opt("operator-namespace"))((c, ons) =>
c.copy(operatorNamespace = Some(ons)))
.optional()
.text("the namespace where the operator is deployed"),
commandCheck[commands.Configure](c => {
if (c.logbackConfig.isDefined && !c.logbackConfig.get.exists()) {
failure("the provided logback configuration file doesn't exist")
Expand Down Expand Up @@ -487,6 +495,7 @@ object commands {
case class Deploy(
crFile: File = new File(""),
namespace: Option[String] = None,
operatorNamespace: Option[String] = None,
dockerUsername: String = "",
dockerPassword: String = "",
noRegistryCredentials: Boolean = false,
Expand Down Expand Up @@ -537,6 +546,7 @@ object commands {
case class Configure(
cloudflowApp: String = "",
namespace: Option[String] = None,
operatorNamespace: Option[String] = None,
confs: Seq[File] = Seq(),
configKeys: Map[String, String] = Map(),
logbackConfig: Option[File] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final case class ConfigureExecution(c: Configure, client: KubeClient, logger: Cl
streamletsConfigs <- streamletsConfigs(
currentCr,
cloudflowConfig,
() => client.getKafkaClusters(None).map(parseValues))
() => client.getKafkaClusters(namespace = c.operatorNamespace).map(parseValues))

uid <- client.uidCloudflowApp(currentCr.spec.appId, namespace)
_ <- client.configureCloudflowApp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ final case class DeployExecution(d: Deploy, client: KubeClient, logger: CliLogge
// validate the Cr against the cluster
_ <- referencedKafkaSecretExists(
applicationCr,
() => client.getKafkaClusters(namespace = Some(namespace)).map(_.keys.toList))
() => client.getKafkaClusters(namespace = d.operatorNamespace).map(_.keys.toList))

// streamlets configurations
streamletsConfigs <- streamletsConfigs(applicationCr, cloudflowConfig, () => {
client.getKafkaClusters(None).map(parseValues)
client.getKafkaClusters(namespace = d.operatorNamespace).map(parseValues)
})

// Operations on the cluster
Expand Down