Skip to content

Commit 5adcd07

Browse files
adding support for installing ArgoCD with Verrazzano 1.5+ (#207)
1 parent a4388de commit 5adcd07

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

electron/app/locales/en/webui.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,8 @@
14391439
"vz-install-design-install-jaeger-help": "Whether to install the optional Jaeger transaction tracing component.",
14401440
"vz-install-design-istio-sampling-label": "Istio Tracing Sampling Rate",
14411441
"vz-install-design-istio-sampling-help": "The percentage of Istio requests that will be traced in Jaeger.",
1442+
"vz-install-design-install-argocd-label": "Install Argo CD",
1443+
"vz-install-design-install-argocd-help": "Whether to install the optional Argo CD continuous delivery component.",
14421444

14431445
"vz-installer-aborted-error-title": "Installing Verrazzano Aborted",
14441446
"vz-installer-kubectl-exe-invalid-error-message": "Unable to install Verrazzano because the Kubernetes client executable is invalid: {{error}}.",

webui/src/js/models/vz-install-definition.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2022, Oracle and/or its affiliates.
3+
* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
44
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
66
'use strict';
@@ -20,6 +20,7 @@ define(['utils/observable-properties'],
2020
this.actualInstalledVersion = props.createProperty();
2121
this.installJaeger = props.createProperty(false);
2222
this.istioSamplingRate = props.createProperty(1);
23+
this.installArgoCD = props.createProperty(false);
2324

2425
this.readFrom = (json) => {
2526
props.createGroup(name, this).readFrom(json);

webui/src/js/utils/vz-install-resource-generator.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2022, Oracle and/or its affiliates.
3+
* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
44
* Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
55
*/
66
'use strict';
@@ -46,6 +46,22 @@ define(['models/wkt-project', 'js-yaml', 'utils/vz-helper', 'utils/i18n', 'utils
4646
});
4747
}
4848
}
49+
50+
const vzVersionTag = this.project.vzInstall.versionTag.value;
51+
let isArgoAvailable = false;
52+
if (vzVersionTag) {
53+
const vzVersionToInstall = vzVersionTag.slice(1);
54+
isArgoAvailable = window.api.utils.compareVersions(vzVersionToInstall, '1.5.0') >= 0;
55+
}
56+
57+
if (isArgoAvailable && this.project.vzInstall.installArgoCD.value) {
58+
if (!data.spec.components) {
59+
data.spec.components = {};
60+
}
61+
data.spec.components.argoCD = {
62+
enabled: true
63+
};
64+
}
4965
return jsYaml.dump(data).split('\n');
5066
}
5167

webui/src/js/viewModels/vz-install-design-view.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2022, Oracle and/or its affiliates.
3+
* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
44
* Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
55
*/
66
'use strict';
@@ -15,11 +15,23 @@ define(['models/wkt-project', 'accUtils', 'utils/common-utilities', 'knockout',
1515
function (project, accUtils, utils, ko, i18n, screenUtils, BufferingDataProvider, ArrayDataProvider) {
1616
function VerrazzanoInstallDesignViewModel() {
1717

18+
const subscriptions = [];
19+
1820
this.connected = () => {
1921
accUtils.announce('Verrazzano Install Design View page loaded.', 'assertive');
22+
23+
subscriptions.push(this.project.vzInstall.actualInstalledVersion.observable.subscribe(newTagValue => {
24+
this.computedArgoCDAvailabilityFromVersion(newTagValue);
25+
}));
26+
27+
this.computedArgoCDAvailabilityFromVersion();
2028
};
2129

22-
this.disconnected = () => { };
30+
this.disconnected = () => {
31+
subscriptions.forEach((subscription) => {
32+
subscription.dispose();
33+
});
34+
};
2335

2436
this.labelMapper = (labelId, payload) => {
2537
if (labelId.startsWith('page-design-')) {
@@ -49,6 +61,22 @@ function (project, accUtils, utils, ko, i18n, screenUtils, BufferingDataProvider
4961
return { ...versionObject, label };
5062
}));
5163
});
64+
65+
this.isArgoCDAvailable = ko.observable(false);
66+
this.computedArgoCDAvailabilityFromVersion = (versionTag = undefined) => {
67+
const vzInstallVersionTag = versionTag ? versionTag : this.project.vzInstall.versionTag.observable();
68+
69+
let result = false; // for now, assume that Verrazzano 1.4.x and below are the most common.
70+
if (vzInstallVersionTag) {
71+
const vzInstallVersion = vzInstallVersionTag.slice(1);
72+
if (window.api.utils.compareVersions(vzInstallVersion, '1.5.0') >= 0) {
73+
result = true;
74+
}
75+
}
76+
if (this.isArgoCDAvailable() !== result) {
77+
this.isArgoCDAvailable(result);
78+
}
79+
};
5280
}
5381
return VerrazzanoInstallDesignViewModel;
5482
});

webui/src/js/views/vz-install-design-view.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2022, 2023, Oracle and/or its affiliates.
33
Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
44
-->
55
<h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('title')]]"></oj-bind-text></h6>
@@ -35,4 +35,12 @@ <h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('title')]]"></oj-b
3535
</oj-input-number>
3636
</oj-bind-if>
3737
</oj-form-layout>
38+
<oj-bind-if test="[[isArgoCDAvailable]]">
39+
<oj-form-layout max-columns="1" direction="row">
40+
<oj-switch label-hint="[[labelMapper('install-argocd-label')]]"
41+
value="{{project.vzInstall.installArgoCD.observable}}"
42+
help.instruction="[[labelMapper('install-argocd-help')]]">
43+
</oj-switch>
44+
</oj-form-layout>
45+
</oj-bind-if>
3846
</div>

0 commit comments

Comments
 (0)