diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml
index 0d1a931a4..ff7ed3ccd 100644
--- a/addons/core/translations/resources/en-us.yaml
+++ b/addons/core/translations/resources/en-us.yaml
@@ -452,6 +452,7 @@ managed-group:
description: No members in this managed group.
worker:
title: Worker
+ title_pki: New PKI Worker
title_plural: Workers
description: Workers are the server components that perform the session handling.
actions:
@@ -470,6 +471,9 @@ worker:
ip_address:
label: IP Address
help: The public IP address of the server
+ initial_upstreams:
+ label: Initial Upstreams
+ help: A list of hosts/IP addresses and optionally ports for reaching Boundary cluster. The port will default to :9201 if not specified.
config_file_path:
label: Config file path
help: The path on your server where you will store your configuration file
@@ -478,7 +482,7 @@ worker:
help: Boundary can use tags to define key-value pairs which targets can use to determine where they should route connections
steps:
1:
- title: 1. Create a config file
+ title: 1. Configure your new worker
create_directory: Create a configuration file in a new directory on your server
create_config: 'Open the file with a text editor, such as Vi. Paste the following configuration into the worker config file:'
save_config: Save the configuration in your `pki-worker.hcl` file.
diff --git a/ui/admin/app/components/form/worker/create-worker-led/index.hbs b/ui/admin/app/components/form/worker/create-worker-led/index.hbs
index 5b5eb9789..6cf45def8 100644
--- a/ui/admin/app/components/form/worker/create-worker-led/index.hbs
+++ b/ui/admin/app/components/form/worker/create-worker-led/index.hbs
@@ -5,42 +5,54 @@
@showEditToggle={{false}}
as |form|
>
-
-
-
-
-
-
-
-
{{t 'resources.worker.form.steps.1.title'}}
+ {{#if (feature-flag 'byow-pki-hcp-cluster-id')}}
+
+ {{/if}}
+
+
+
+
+
+ {{#if (feature-flag 'byow-pki-upstream')}}
+
+ {{/if}}
+
+
+
<:action>
diff --git a/ui/admin/app/components/form/worker/create-worker-led/index.js b/ui/admin/app/components/form/worker/create-worker-led/index.js
index 501fe2846..c2806dff7 100644
--- a/ui/admin/app/components/form/worker/create-worker-led/index.js
+++ b/ui/admin/app/components/form/worker/create-worker-led/index.js
@@ -1,45 +1,94 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
+import { inject as service } from '@ember/service';
export default class FormWorkerCreateWorkerLedComponent extends Component {
- // =attributes
+ // =services
+ @service features;
+ // =attributes
@tracked generatedWorkerAuthToken;
@tracked clusterId;
@tracked ipAddress;
@tracked configFilePath;
@tracked workerTags;
+ @tracked initialUpstreams;
+ // =methods
+
+ convertCommaSeparatedValuesToArray(input) {
+ return input
+ .split(',')
+ .filter((value) => value.trim())
+ .map((value) => `"${value?.trim()}"`)
+ .join(', ');
+ }
+
+ // =properties
+
+ /**
+ * Returns directory creation text for ``.
+ * @type {string}
+ */
get createConfigText() {
- return `mkdir ${this.configFilePath || ''}/ ;\\
+ return `mkdir ${this.configFilePath || ''}/ ;
touch ${this.configFilePath || ''}/pki-worker.hcl`;
}
+ /**
+ * Returns config creation text for ``. The user will see
+ * different outputs based on if they are using `hcp` or `oss` binaries.
+ * @type {string}
+ */
get workerConfigText() {
- return `hcp_boundary_cluster_id = "${this.clusterId || ''}"
+ const clusterText = `hcp_boundary_cluster_id = "${
+ this.clusterId || ''
+ }"`;
-listener "tcp" {
+ const tagsText = `tags {
+ type = [${
+ this.workerTags ? this.convertCommaSeparatedValuesToArray(this.workerTags) : '"", ""'
+ }]
+ }`;
+ const upstreamText = `
+ initial_upstreams = [${
+ this.initialUpstreams
+ ? this.convertCommaSeparatedValuesToArray(this.initialUpstreams)
+ : '"", "", ""'
+ }]`;
+
+ const listenerText = `listener "tcp" {
address = "0.0.0.0:9202"
purpose = "proxy"
-}
+}`;
+ const workerText = `
worker {
public_addr = "${this.ipAddress || ''}"
auth_storage_path = "${this.configFilePath || ''}/worker1"
- tags {
- type = [${
- this.workerTags
- ? this.workerTags
- .split(',')
- .filter((tag) => tag.trim())
- .map((tag) => `"${tag?.trim()}"`)
- .join(', ')
- : '"", ""'
- }]
+ ${
+ this.features.isEnabled('byow-pki-upstream')
+ ? `${tagsText}${upstreamText}`
+ : `${tagsText}`
}
}`;
+
+ if (this.features.isEnabled('byow-pki-hcp-cluster-id')) {
+ return `${clusterText}
+
+${listenerText}
+ ${workerText}`;
+ } else {
+ return `${listenerText}
+ ${workerText}`;
+ }
}
+ /**
+ * Returns boundary installation command and start worker server command
+ * for ``.
+ * @type {string}
+ */
get installBoundaryText() {
return `curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ;\\
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ;\\
@@ -47,6 +96,10 @@ sudo apt-get update && sudo apt-get install boundary ;\\
boundary server -config="${this.configFilePath || ''}/pki-worker.hcl"`;
}
+ /**
+ * Returns `shell` configuration object for ``.
+ * @type {Object}
+ */
get shellCodeEditor() {
return {
mode: 'shell',
@@ -56,7 +109,10 @@ boundary server -config="${this.configFilePath || ''}/pki-worker.hcl"`;
styleActiveLine: false,
};
}
-
+ /**
+ * Returns `hcl` configuration object for ``.
+ * @type {Object}
+ */
get hclCodeEditor() {
return {
mode: 'hcl',
diff --git a/ui/admin/app/templates/scopes/scope/workers/new.hbs b/ui/admin/app/templates/scopes/scope/workers/new.hbs
index 72f8bdf22..20e973134 100644
--- a/ui/admin/app/templates/scopes/scope/workers/new.hbs
+++ b/ui/admin/app/templates/scopes/scope/workers/new.hbs
@@ -8,7 +8,7 @@
- {{t 'titles.new'}}
+ {{t 'resources.worker.title_pki'}}
diff --git a/ui/admin/config/environment.js b/ui/admin/config/environment.js
index b6180ac64..b6ee398fa 100644
--- a/ui/admin/config/environment.js
+++ b/ui/admin/config/environment.js
@@ -9,6 +9,8 @@ const featureEditions = {
oss: {
'static-credentials': true,
byow: false,
+ 'byow-pki-hcp-cluster-id': false,
+ 'byow-pki-upstream': true,
},
};
featureEditions.enterprise = {
@@ -17,6 +19,8 @@ featureEditions.enterprise = {
};
featureEditions.hcp = {
...featureEditions.enterprise,
+ 'byow-pki-hcp-cluster-id': true,
+ 'byow-pki-upstream': false,
};
module.exports = function (environment) {
diff --git a/ui/admin/tests/acceptance/workers/create-test.js b/ui/admin/tests/acceptance/workers/create-test.js
index 667e7a853..d7044b741 100644
--- a/ui/admin/tests/acceptance/workers/create-test.js
+++ b/ui/admin/tests/acceptance/workers/create-test.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
-import { visit, fillIn, click, find } from '@ember/test-helpers';
+import { visit, fillIn, click, find, findAll } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
@@ -9,6 +9,7 @@ import {
//currentSession,
//invalidateSession,
} from 'ember-simple-auth/test-support';
+import { getOwner } from '@ember/application';
module('Acceptance | workers | create', function (hooks) {
setupApplicationTest(hooks);
@@ -38,6 +39,28 @@ module('Acceptance | workers | create', function (hooks) {
assert.strictEqual(getWorkersCount(), workersCount + 1);
});
+ test('cluster id input field is visible for `hcp` binary', async function (assert) {
+ assert.expect(2);
+ const config = getOwner(this).resolveRegistration('config:environment');
+ config.featureFlags['byow-pki-hcp-cluster-id'] = true;
+ config.featureFlags['byow-pki-upstream'] = false;
+ await visit(newWorkerURL);
+ const labels = findAll('label.rose-form-label');
+ assert.dom(labels[0]).hasText('Boundary Cluster ID');
+ assert.dom(labels[2]).doesNotIncludeText('Initial Upstreams');
+ });
+
+ test('initial upstreams input field is visible for `oss` binary', async function (assert) {
+ assert.expect(2);
+ const config = getOwner(this).resolveRegistration('config:environment');
+ config.featureFlags['byow-pki-hcp-cluster-id'] = false;
+ config.featureFlags['byow-pki-upstream'] = true;
+ await visit(newWorkerURL);
+ const labels = findAll('label.rose-form-label');
+ assert.dom(labels[0]).doesNotIncludeText('Boundary Cluster ID');
+ assert.dom(labels[2]).hasText('Initial Upstreams');
+ });
+
test('Users can navigate to new workers route with proper authorization', async function (assert) {
assert.expect(2);
await visit(newWorkerURL);