Skip to content

Commit 407cc2e

Browse files
authored
Merge pull request #829 from nextcloud/fix/Kubernetes-ui-and-frp
fix: do not require harp_frp_address for K8s.
2 parents 2c83215 + b2b961e commit 407cc2e

File tree

11 files changed

+71
-17
lines changed

11 files changed

+71
-17
lines changed

.github/workflows/tests-deploy-k8s-clusterip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
run: |
171171
./occ app_api:daemon:register \
172172
k8s_test "K8s Test" "kubernetes-install" "http" "${{ env.NODE_IP }}:8780" "http://${{ env.NODE_IP }}" \
173-
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" --harp_frp_address "${{ env.NODE_IP }}:8782" \
173+
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" \
174174
--k8s --k8s_expose_type=clusterip --set-default
175175
./occ app_api:daemon:list
176176

.github/workflows/tests-deploy-k8s-loadbalancer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ jobs:
175175
run: |
176176
./occ app_api:daemon:register \
177177
k8s_test "K8s Test" "kubernetes-install" "http" "${{ env.NODE_IP }}:8780" "http://${{ env.NODE_IP }}" \
178-
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" --harp_frp_address "${{ env.NODE_IP }}:8782" \
178+
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" \
179179
--k8s --k8s_expose_type=loadbalancer --set-default
180180
./occ app_api:daemon:list
181181

.github/workflows/tests-deploy-k8s-manual.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
run: |
171171
./occ app_api:daemon:register \
172172
k8s_test "K8s Test" "kubernetes-install" "http" "${{ env.NODE_IP }}:8780" "http://${{ env.NODE_IP }}" \
173-
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" --harp_frp_address "${{ env.NODE_IP }}:8782" \
173+
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" \
174174
--k8s --k8s_expose_type=manual --k8s_upstream_host=${{ env.MANUAL_CLUSTER_IP }} --set-default
175175
./occ app_api:daemon:list
176176

.github/workflows/tests-deploy-k8s.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
run: |
163163
./occ app_api:daemon:register \
164164
k8s_test "K8s Test" "kubernetes-install" "http" "${{ env.NODE_IP }}:8780" "http://${{ env.NODE_IP }}" \
165-
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" --harp_frp_address "${{ env.NODE_IP }}:8782" \
165+
--harp --harp_shared_key "${{ env.HP_SHARED_KEY }}" \
166166
--k8s --k8s_expose_type=nodeport --set-default
167167
./occ app_api:daemon:list
168168

js/app_api-adminSettings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/app_api-adminSettings.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Command/Daemon/ListDaemons.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7676
$daemon->getHost(),
7777
$deployConfig['nextcloud_url'],
7878
isset($deployConfig['harp']) ? 'yes' : 'no',
79-
$deployConfig['harp']['frp_address'] ?? '(none)',
79+
($deployConfig['harp']['frp_address'] ?? null) ?: '(none)',
8080
$deployConfig['harp']['docker_socket_port'] ?? '(none)',
8181
];
8282
}

lib/Command/Daemon/RegisterDaemon.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function configure(): void {
4545
$this->addOption('compute_device', null, InputOption::VALUE_REQUIRED, 'Computation device for GPU support (cpu|cuda|rocm)');
4646
$this->addOption('set-default', null, InputOption::VALUE_NONE, 'Set DaemonConfig as default');
4747
$this->addOption('harp', null, InputOption::VALUE_NONE, 'Set the daemon to use HaRP for all Docker and ExApp communication');
48-
$this->addOption('harp_frp_address', null, InputOption::VALUE_REQUIRED, '[host]:[port] of the HaRP FRP server, the default host is same as the HaRP host, port is 8782');
48+
$this->addOption('harp_frp_address', null, InputOption::VALUE_REQUIRED, '[host]:[port] of the HaRP FRP server (not required for K8s daemons). Default: same as HaRP host, port 8782');
4949
$this->addOption('harp_shared_key', null, InputOption::VALUE_REQUIRED, 'HaRP shared key for secure communication between HaRP and AppAPI');
5050
$this->addOption('harp_docker_socket_port', null, InputOption::VALUE_REQUIRED, '\'remotePort\' of the FRP client of the remote Docker socket proxy. There is one included in the harp container so this can be skipped for default setups.', '24000');
5151
$this->addOption('harp_exapp_direct', null, InputOption::VALUE_NONE, 'Flag for the advanced setups only. Disables the FRP tunnel between ExApps and HaRP.');
@@ -68,9 +68,9 @@ protected function configure(): void {
6868
$this->addUsage('local_docker "Docker Local" "docker-install" "http" "/var/run/docker.sock" "http://nextcloud.local" --net=nextcloud --set-default --compute_device=cuda');
6969

7070
// Kubernetes usage examples
71-
$this->addUsage('k8s_daemon "Kubernetes HaRP" "kubernetes-install" "http" "harp.nextcloud.svc:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --harp_frp_address "harp.nextcloud.svc:8782" --k8s');
72-
$this->addUsage('k8s_daemon_nodeport "K8s NodePort" "kubernetes-install" "http" "harp.example.com:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --harp_frp_address "harp.example.com:8782" --k8s --k8s_expose_type=nodeport --k8s_upstream_host="k8s-node.example.com"');
73-
$this->addUsage('k8s_daemon_lb "K8s LoadBalancer" "kubernetes-install" "http" "harp.example.com:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --harp_frp_address "harp.example.com:8782" --k8s --k8s_expose_type=loadbalancer');
71+
$this->addUsage('k8s_daemon "Kubernetes HaRP" "kubernetes-install" "http" "harp.nextcloud.svc:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --k8s');
72+
$this->addUsage('k8s_daemon_nodeport "K8s NodePort" "kubernetes-install" "http" "harp.example.com:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --k8s --k8s_expose_type=nodeport --k8s_upstream_host="k8s-node.example.com"');
73+
$this->addUsage('k8s_daemon_lb "K8s LoadBalancer" "kubernetes-install" "http" "harp.example.com:8780" "http://nextcloud.local" --harp --harp_shared_key "secret" --k8s --k8s_expose_type=loadbalancer');
7474
}
7575

7676
protected function execute(InputInterface $input, OutputInterface $output): int {
@@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9191
$output->writeln('Value error: HaRP enabled daemon requires `harp_shared_key` option.');
9292
return 1;
9393
}
94-
if ($isHarp && !$input->getOption('harp_frp_address')) {
94+
if ($isHarp && !$isK8s && !$input->getOption('harp_frp_address')) {
9595
$output->writeln('Value error: HaRP enabled daemon requires `harp_frp_address` option.');
9696
return 1;
9797
}

src/components/DaemonConfig/DaemonConfigDetailsModal.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,37 @@
1818
{{ t('app_api', 'The "Manual install" daemon is usually used for development. It cannot be set as the default daemon.') }}
1919
</NcNoteCard>
2020

21+
<NcNoteCard v-if="daemon.accepts_deploy_id === 'kubernetes-install'" type="info">
22+
{{ t('app_api', 'This is a Kubernetes daemon managed via CLI.') }}
23+
</NcNoteCard>
24+
2125
<p><b>{{ t('app_api', 'ExApps installed') }}: </b>{{ daemon.exAppsCount }}</p>
2226
<p><b>{{ t('app_api', 'Name') }}: </b>{{ daemon.name }}</p>
2327
<p><b>{{ t('app_api', 'Protocol') }}: </b>{{ daemon.protocol }}</p>
2428
<p><b>{{ t('app_api', 'Host') }}: </b>{{ daemon.host }}</p>
25-
<p v-if="daemon.deploy_config.harp">
29+
<p v-if="daemon.deploy_config.harp && daemon.accepts_deploy_id !== 'kubernetes-install'">
2630
<b>{{ t('app_api', 'ExApp direct communication (FRP disabled)') }}: </b>
2731
{{ daemon.deploy_config.harp.exapp_direct ?? false }}
2832
</p>
2933

34+
<template v-if="daemon.deploy_config.kubernetes">
35+
<h3>{{ t('app_api', 'Kubernetes settings') }}</h3>
36+
<p><b>{{ t('app_api', 'Expose type') }}: </b>{{ daemon.deploy_config.kubernetes.expose_type }}</p>
37+
<p v-if="daemon.deploy_config.kubernetes.node_port">
38+
<b>{{ t('app_api', 'Node port') }}: </b>{{ daemon.deploy_config.kubernetes.node_port }}
39+
</p>
40+
<p v-if="daemon.deploy_config.kubernetes.upstream_host">
41+
<b>{{ t('app_api', 'Upstream host') }}: </b>{{ daemon.deploy_config.kubernetes.upstream_host }}
42+
</p>
43+
<p v-if="daemon.deploy_config.kubernetes.external_traffic_policy">
44+
<b>{{ t('app_api', 'External traffic policy') }}: </b>{{ daemon.deploy_config.kubernetes.external_traffic_policy }}
45+
</p>
46+
<p v-if="daemon.deploy_config.kubernetes.load_balancer_ip">
47+
<b>{{ t('app_api', 'Load balancer IP') }}: </b>{{ daemon.deploy_config.kubernetes.load_balancer_ip }}
48+
</p>
49+
<p><b>{{ t('app_api', 'Node address type') }}: </b>{{ daemon.deploy_config.kubernetes.node_address_type }}</p>
50+
</template>
51+
3052
<h3>{{ t('app_api', 'Deploy options') }}</h3>
3153
<p><b>{{ t('app_api', 'Docker network') }}: </b>{{ daemon.deploy_config.net }}</p>
3254
<p><b>{{ t('app_api', 'Nextcloud URL') }}: </b>{{ daemon.deploy_config.nextcloud_url }}</p>

src/components/DaemonConfig/ManageDaemonConfigModal.vue

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
v-model="host"
5656
:label="isHarp ? t('app_api', 'HaRP host') : t('app_api', 'Daemon host')"
5757
:placeholder="daemonHostHelperText"
58+
:readonly="isEdit && isK8s"
5859
:aria-label="daemonHostHelperText" />
5960
<InfoTooltip :text="daemonHostHelperText" />
6061
</div>
@@ -66,6 +67,7 @@
6667
v-model="deployConfig.haproxy_password"
6768
:label="isHarp ? t('app_api', 'HaRP shared key') : t('app_api', 'HaProxy password')"
6869
:error="isHaProxyPasswordValid === false"
70+
:disabled="isEdit && isK8s"
6971
:placeholder="haProxyPasswordHelperText"
7072
:aria-label="haProxyPasswordHelperText"
7173
:helper-text="!isHaProxyPasswordValid ? t('app_api', 'The password must be at least 12 characters long') : ''"
@@ -77,6 +79,7 @@
7779
id="nextcloud-url"
7880
v-model="nextcloud_url"
7981
:label="t('app_api', 'Nextcloud URL')"
82+
:readonly="isEdit && isK8s"
8083
:helper-text="getNextcloudUrlHelperText"
8184
:input-class="getNextcloudUrlHelperText !== '' ? 'text-warning' : ''"
8285
:placeholder="t('app_api', 'Nextcloud URL')"
@@ -106,12 +109,13 @@
106109
</NcButton>
107110
<div v-show="deployConfigSettingsOpened" class="deploy-config" :aria-label="t('app_api', 'Deploy options')">
108111
<NcFormBoxSwitch
112+
v-if="!isK8s || !isEdit"
109113
v-model="isHarp"
110114
@update:model-value="toggleHarp">
111115
{{ t('app_api', 'Enable HaRP') }}
112116
</NcFormBoxSwitch>
113117
<div v-if="isHarp" class="harp-options">
114-
<div class="row" :aria-label="t('app_api', 'FRP server address')">
118+
<div v-if="!isK8s" class="row" :aria-label="t('app_api', 'FRP server address')">
115119
<NcInputField
116120
id="frp-address"
117121
v-model="deployConfig.harp.frp_address"
@@ -120,7 +124,7 @@
120124
:aria-label="t('app_api', 'FRP server address')" />
121125
<InfoTooltip :text="t('app_api', 'The address (host:port) of the FRP server that should be reachable by the ExApp in the network defined in the \'Docker network\' section.')" />
122126
</div>
123-
<div class="row" :aria-label="t('app_api', 'Docker socket proxy port')">
127+
<div v-if="!isK8s" class="row" :aria-label="t('app_api', 'Docker socket proxy port')">
124128
<NcInputField
125129
id="harp-dsp-port"
126130
v-model="deployConfig.harp.docker_socket_port"
@@ -129,7 +133,7 @@
129133
:aria-label="t('app_api', 'Docker socket proxy port')" />
130134
<InfoTooltip :text="t('app_api', 'The port in HaRP which the Docker socket proxy connects to. This should be exposed but for the in-built one, it is not required to be exposed or changed.')" />
131135
</div>
132-
<div class="row-switch" :aria-label="t('app_api', 'Disable FRP')">
136+
<div v-if="!isK8s" class="row-switch" :aria-label="t('app_api', 'Disable FRP')">
133137
<NcFormBoxSwitch
134138
v-model="deployConfig.harp.exapp_direct"
135139
class="switch"
@@ -148,6 +152,7 @@
148152
v-model="deployConfig.net"
149153
:label="t('app_api', 'Docker network')"
150154
:placeholder="t('app_api', 'Docker network')"
155+
:readonly="isEdit && isK8s"
151156
:aria-label="t('app_api', 'Docker network')"
152157
:show-trailing-button="isEditDifferentNetwork"
153158
:error="isHarp && !deployConfig.net"
@@ -165,6 +170,7 @@
165170
id="compute-device"
166171
v-model="deployConfig.computeDevice"
167172
class="ncselect"
173+
:disabled="isEdit && isK8s"
168174
:input-label="t('app_api', 'Compute device')"
169175
:aria-label-combobox="t('app_api', 'Computation device')"
170176
:options="computeDevices" />
@@ -179,6 +185,7 @@
179185
v-model="memoryLimit"
180186
:label="t('app_api', 'Memory limit (in MiB)')"
181187
:placeholder="t('app_api', 'Memory limit (in MiB)')"
188+
:readonly="isEdit && isK8s"
182189
:aria-label="t('app_api', 'Memory limit (in MiB)')"
183190
:error="isMemoryLimitValid === false"
184191
:helper-text="isMemoryLimitValid === false ? t('app_api', 'Must be a positive integer') : ''" />
@@ -191,11 +198,29 @@
191198
v-model="cpuLimit"
192199
:label="t('app_api', 'CPU limit')"
193200
:placeholder="t('app_api', 'CPU limit as decimal value')"
201+
:readonly="isEdit && isK8s"
194202
:aria-label="t('app_api', 'CPU limit')"
195203
:error="isCpuLimitValid === false"
196204
:helper-text="isCpuLimitValid === false ? t('app_api', 'Must be a positive number') : ''" />
197205
<InfoTooltip :text="t('app_api', 'Maximum number of CPU cores that the ExApp container can use (e.g. 0.5 for half a core, 2 for two cores)')" />
198206
</div>
207+
<div v-if="isK8s && isEdit && deployConfig.kubernetes" class="k8s-info">
208+
<h4>{{ t('app_api', 'Kubernetes settings') }}</h4>
209+
<p><b>{{ t('app_api', 'Expose type') }}: </b>{{ deployConfig.kubernetes.expose_type }}</p>
210+
<p v-if="deployConfig.kubernetes.node_port">
211+
<b>{{ t('app_api', 'Node port') }}: </b>{{ deployConfig.kubernetes.node_port }}
212+
</p>
213+
<p v-if="deployConfig.kubernetes.upstream_host">
214+
<b>{{ t('app_api', 'Upstream host') }}: </b>{{ deployConfig.kubernetes.upstream_host }}
215+
</p>
216+
<p v-if="deployConfig.kubernetes.external_traffic_policy">
217+
<b>{{ t('app_api', 'External traffic policy') }}: </b>{{ deployConfig.kubernetes.external_traffic_policy }}
218+
</p>
219+
<p v-if="deployConfig.kubernetes.load_balancer_ip">
220+
<b>{{ t('app_api', 'Load balancer IP') }}: </b>{{ deployConfig.kubernetes.load_balancer_ip }}
221+
</p>
222+
<p><b>{{ t('app_api', 'Node address type') }}: </b>{{ deployConfig.kubernetes.node_address_type }}</p>
223+
</div>
199224
<template v-if="additionalOptions.length > 0">
200225
<div class="row" style="flex-direction: column;">
201226
<div
@@ -539,6 +564,9 @@ export default {
539564
isPureManual() {
540565
return this.acceptsDeployId === 'manual-install' && !this.isHarp
541566
},
567+
isK8s() {
568+
return this.acceptsDeployId === 'kubernetes-install'
569+
},
542570
},
543571
watch: {
544572
configurationTab(newConfigurationTab) {
@@ -784,6 +812,10 @@ export default {
784812
margin-bottom: 10px;
785813
}
786814
815+
.k8s-info {
816+
margin-top: 16px;
817+
}
818+
787819
.additional-options {
788820
padding: 10px 0;
789821
}

0 commit comments

Comments
 (0)