refactor: 💡 remove explicit byow-pki-upstream, as it is default (#1658)
* refactor: 💡 consolidate ssh features into ssh-target flag ✅ Closes: ICU-8383 * refactor: 💡 factor out base edition * feat: 🎸 dynamic feature edition enablement and toggling * refactor: 💡 remove explicit byow-pki-upstream, as it is default ✅ Closes: ICU-8551 * refactor: 💡 extract feature flag config into separate file
This commit is contained in:
1 parent
acd719140d
commit
ee2fa6df7d
6 files changed
+69
-63
No files matched your search
@@ -41,7 +41,7 @@
|
|||||||
placeholder='/home/ubuntu/boundary'
|
placeholder='/home/ubuntu/boundary'
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{{#if (feature-flag 'byow-pki-upstream')}}
|
{{#if (not (feature-flag 'byow-pki-hcp-cluster-id'))}}
|
||||||
<form.input
|
<form.input
|
||||||
@name='initial_upstreams'
|
@name='initial_upstreams'
|
||||||
@value={{this.initialUpstreams}}
|
@value={{this.initialUpstreams}}
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ worker {
|
|||||||
public_addr = "${this.ipAddress || '<public_ip_address>'}"
|
public_addr = "${this.ipAddress || '<public_ip_address>'}"
|
||||||
auth_storage_path = "${this.configFilePath || '<path>'}/worker1"
|
auth_storage_path = "${this.configFilePath || '<path>'}/worker1"
|
||||||
${
|
${
|
||||||
this.features.isEnabled('byow-pki-upstream')
|
this.features.isEnabled('byow-pki-hcp-cluster-id')
|
||||||
? `${tagsText}${upstreamText}`
|
? `${tagsText}`
|
||||||
: `${tagsText}`
|
: `${tagsText}${upstreamText}`
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
|||||||
@@ -5,47 +5,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const features = require('./features');
|
||||||
|
|
||||||
const APP_NAME = process.env.APP_NAME || 'Boundary';
|
const APP_NAME = process.env.APP_NAME || 'Boundary';
|
||||||
const API_HOST = process.env.API_HOST || '';
|
const API_HOST = process.env.API_HOST || '';
|
||||||
const EDITION = process.env.EDITION || 'oss'; // Default edition is OSS
|
|
||||||
|
|
||||||
// Base edition declares available features, disabled by default.
|
|
||||||
const baseEdition = {
|
|
||||||
byow: false,
|
|
||||||
'byow-pki-hcp-cluster-id': false,
|
|
||||||
'byow-pki-upstream': false,
|
|
||||||
'json-credentials': false,
|
|
||||||
'ssh-target': false,
|
|
||||||
'static-credentials': false,
|
|
||||||
'target-worker-filters-v2': false,
|
|
||||||
'target-worker-filters-v2-ingress': false,
|
|
||||||
'target-worker-filters-v2-hcp': false,
|
|
||||||
'target-network-address': false,
|
|
||||||
'vault-worker-filter': false,
|
|
||||||
};
|
|
||||||
// Editions maps edition keys to their associated featuresets.
|
|
||||||
const featureEditions = {};
|
|
||||||
featureEditions.oss = {
|
|
||||||
...baseEdition,
|
|
||||||
byow: true,
|
|
||||||
'byow-pki-upstream': true,
|
|
||||||
'json-credentials': true,
|
|
||||||
'static-credentials': true,
|
|
||||||
'target-worker-filters-v2': true,
|
|
||||||
'target-network-address': true,
|
|
||||||
};
|
|
||||||
featureEditions.enterprise = {
|
|
||||||
...featureEditions.oss,
|
|
||||||
'ssh-target': true,
|
|
||||||
'target-worker-filters-v2-ingress': true,
|
|
||||||
'vault-worker-filter': true,
|
|
||||||
};
|
|
||||||
featureEditions.hcp = {
|
|
||||||
...featureEditions.enterprise,
|
|
||||||
'byow-pki-hcp-cluster-id': true,
|
|
||||||
'byow-pki-upstream': false,
|
|
||||||
'target-worker-filters-v2-hcp': true,
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = function (environment) {
|
module.exports = function (environment) {
|
||||||
let ENV = {
|
let ENV = {
|
||||||
@@ -135,22 +98,11 @@ module.exports = function (environment) {
|
|||||||
timeout: 4000,
|
timeout: 4000,
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedEdition: EDITION,
|
selectedEdition: features.selectedEdition,
|
||||||
featureEditions,
|
featureEditions: features.featureEditions,
|
||||||
featureFlags: {},
|
featureFlags: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes a set of features and enables them in all editions.
|
|
||||||
* For use in development and testing only.
|
|
||||||
*/
|
|
||||||
const enableFeaturesInAllEditions = (features = {}) => {
|
|
||||||
Object.entries(featureEditions).forEach(
|
|
||||||
([key, edition]) =>
|
|
||||||
(ENV.featureEditions[key] = { ...features, ...edition })
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (environment === 'development') {
|
if (environment === 'development') {
|
||||||
// ENV.APP.LOG_RESOLVER = true;
|
// ENV.APP.LOG_RESOLVER = true;
|
||||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||||
@@ -174,10 +126,13 @@ module.exports = function (environment) {
|
|||||||
|
|
||||||
// Default edition in development
|
// Default edition in development
|
||||||
ENV.selectedEdition = 'enterprise';
|
ENV.selectedEdition = 'enterprise';
|
||||||
enableFeaturesInAllEditions({
|
features.enableFeaturesInAllEditions(
|
||||||
// Show edition toggle in UI in development
|
{
|
||||||
'dev-edition-toggle': true,
|
// Show edition toggle in UI in development
|
||||||
});
|
'dev-edition-toggle': true,
|
||||||
|
},
|
||||||
|
ENV
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'test') {
|
if (environment === 'test') {
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
const EDITION = process.env.EDITION || 'oss'; // Default edition is OSS
|
||||||
|
|
||||||
|
const selectedEdition = EDITION;
|
||||||
|
|
||||||
|
// Base edition declares available features, disabled by default.
|
||||||
|
const baseEdition = {
|
||||||
|
byow: false,
|
||||||
|
'byow-pki-hcp-cluster-id': false,
|
||||||
|
'json-credentials': false,
|
||||||
|
'ssh-target': false,
|
||||||
|
'static-credentials': false,
|
||||||
|
'target-worker-filters-v2': false,
|
||||||
|
'target-worker-filters-v2-ingress': false,
|
||||||
|
'target-worker-filters-v2-hcp': false,
|
||||||
|
'target-network-address': false,
|
||||||
|
'vault-worker-filter': false,
|
||||||
|
};
|
||||||
|
// Editions maps edition keys to their associated featuresets.
|
||||||
|
const featureEditions = {};
|
||||||
|
featureEditions.oss = {
|
||||||
|
...baseEdition,
|
||||||
|
byow: true,
|
||||||
|
'json-credentials': true,
|
||||||
|
'static-credentials': true,
|
||||||
|
'target-worker-filters-v2': true,
|
||||||
|
'target-network-address': true,
|
||||||
|
};
|
||||||
|
featureEditions.enterprise = {
|
||||||
|
...featureEditions.oss,
|
||||||
|
'ssh-target': true,
|
||||||
|
'target-worker-filters-v2-ingress': true,
|
||||||
|
'vault-worker-filter': true,
|
||||||
|
};
|
||||||
|
featureEditions.hcp = {
|
||||||
|
...featureEditions.enterprise,
|
||||||
|
'byow-pki-hcp-cluster-id': true,
|
||||||
|
'target-worker-filters-v2-hcp': true,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a set of features and enables them in all editions.
|
||||||
|
* For use in development and testing only.
|
||||||
|
*/
|
||||||
|
const enableFeaturesInAllEditions = (features = {}, ENV) => {
|
||||||
|
Object.entries(featureEditions).forEach(
|
||||||
|
([key, edition]) => (ENV.featureEditions[key] = { ...features, ...edition })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
featureEditions,
|
||||||
|
selectedEdition,
|
||||||
|
enableFeaturesInAllEditions,
|
||||||
|
};
|
||||||
@@ -47,7 +47,6 @@ module('Acceptance | workers | create', function (hooks) {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const featuresService = this.owner.lookup('service:features');
|
const featuresService = this.owner.lookup('service:features');
|
||||||
featuresService.enable('byow-pki-hcp-cluster-id');
|
featuresService.enable('byow-pki-hcp-cluster-id');
|
||||||
featuresService.disable('byow-pki-upstream');
|
|
||||||
await visit(newWorkerURL);
|
await visit(newWorkerURL);
|
||||||
const labels = findAll('label.rose-form-label');
|
const labels = findAll('label.rose-form-label');
|
||||||
assert.dom(labels[0]).hasText('Boundary Cluster ID');
|
assert.dom(labels[0]).hasText('Boundary Cluster ID');
|
||||||
@@ -58,7 +57,6 @@ module('Acceptance | workers | create', function (hooks) {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const featuresService = this.owner.lookup('service:features');
|
const featuresService = this.owner.lookup('service:features');
|
||||||
featuresService.disable('byow-pki-hcp-cluster-id');
|
featuresService.disable('byow-pki-hcp-cluster-id');
|
||||||
featuresService.enable('byow-pki-upstream');
|
|
||||||
await visit(newWorkerURL);
|
await visit(newWorkerURL);
|
||||||
const labels = findAll('label.rose-form-label');
|
const labels = findAll('label.rose-form-label');
|
||||||
assert.dom(labels[0]).doesNotIncludeText('Boundary Cluster ID');
|
assert.dom(labels[0]).doesNotIncludeText('Boundary Cluster ID');
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ module(
|
|||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
const featuresService = this.owner.lookup('service:features');
|
const featuresService = this.owner.lookup('service:features');
|
||||||
featuresService.enable('byow-pki-hcp-cluster-id');
|
featuresService.enable('byow-pki-hcp-cluster-id');
|
||||||
featuresService.disable('byow-pki-upstream');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it correctly populates the cluster id for an hcp dev cluster', async function (assert) {
|
test('it correctly populates the cluster id for an hcp dev cluster', async function (assert) {
|
||||||
|
|||||||
Reference in new issue
Block a user