Skip to content

Commit 51f0f1f

Browse files
committed
Proposal for disabling terminal scheduling on non-managed seeds
1 parent 20542bf commit 51f0f1f

6 files changed

Lines changed: 61 additions & 15 deletions

File tree

frontend/src/components/GTerminalSettings.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ SPDX-License-Identifier: Apache-2.0
2626
hint="Choose "Cluster" if you want to troubleshoot a worker node of the cluster"
2727
persistent-hint
2828
>
29-
<v-radio
30-
label="Infrastructure (Seed)"
31-
value="seed"
32-
color="primary"
33-
/>
29+
<div>
30+
<v-radio
31+
label="Infrastructure (Seed)"
32+
value="seed"
33+
color="primary"
34+
:disabled="!canScheduleOnSeed"
35+
/>
36+
<v-tooltip
37+
activator="parent"
38+
location="top left"
39+
:disabled="canScheduleOnSeed"
40+
>
41+
Terminals can only be scheduled on managed seeds
42+
</v-tooltip>
43+
</div>
3444
<v-radio
3545
label="Cluster"
3646
value="shoot"
@@ -133,6 +143,7 @@ export default {
133143
shootNodes,
134144
privilegedMode,
135145
runtime,
146+
canScheduleOnSeed,
136147
} = toRefs(state)
137148
138149
const rules = {
@@ -148,6 +159,7 @@ export default {
148159
shootNodes,
149160
privilegedMode,
150161
runtime,
162+
canScheduleOnSeed,
151163
}
152164
},
153165
computed: {

frontend/src/components/GTerminalTarget.vue

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ SPDX-License-Identifier: Apache-2.0
1313
:hint="hint"
1414
persistent-hint
1515
>
16-
<v-radio
17-
v-if="shootItem && hasControlPlaneTerminalAccess"
18-
label="Control Plane"
19-
value="cp"
20-
color="primary"
21-
/>
16+
<div>
17+
<v-radio
18+
v-if="shootItem && hasControlPlaneTerminalAccess"
19+
label="Control Plane"
20+
value="cp"
21+
color="primary"
22+
:disabled="!canScheduleOnSeed"
23+
/>
24+
<v-tooltip
25+
activator="parent"
26+
location="top left"
27+
:disabled="canScheduleOnSeed"
28+
>
29+
Terminals can only be scheduled on managed seeds
30+
</v-tooltip>
31+
</div>
2232
<v-radio
2333
v-if="shootItem && hasShootTerminalAccess"
2434
value="shoot"
@@ -84,12 +94,14 @@ export default {
8494
const {
8595
shootItem,
8696
isShootStatusHibernated,
97+
canScheduleOnSeed,
8798
} = useTerminalSplitpanes()
8899
89100
return {
90101
v$: useVuelidate(),
91102
shootItem,
92103
isShootStatusHibernated,
104+
canScheduleOnSeed,
93105
}
94106
},
95107
validations () {

frontend/src/components/ShootDetails/GShootAccessCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ const isTerminalTileVisible = computed(() => {
236236
})
237237
238238
const isTerminalShortcutsTileVisible = computed(() => {
239-
return isTerminalShortcutsFeatureEnabled.value && !hideTerminalShortcuts.value && isTerminalShortcutsFeatureEnabled.value
239+
return isTerminalShortcutsFeatureEnabled.value && !hideTerminalShortcuts.value && isTerminalShortcutsFeatureEnabled.value
240240
})
241241
242242
function onAddTerminalShortcut (shortcut) {

frontend/src/components/dialogs/GCreateTerminalSessionDialog.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export default {
164164
shootName,
165165
hasShootWorkerGroups,
166166
isShootStatusHibernated,
167+
canScheduleOnSeed,
167168
newTerminalPrompt,
168169
defaultTarget,
169170
setSelections,
@@ -181,6 +182,7 @@ export default {
181182
shootName,
182183
hasShootWorkerGroups,
183184
isShootStatusHibernated,
185+
canScheduleOnSeed,
184186
newTerminalPrompt,
185187
defaultTarget,
186188
setSelections,
@@ -275,6 +277,10 @@ export default {
275277
await this.promptForSelections()
276278
}
277279
},
280+
defaultTarget (value) {
281+
this.targetTab.selectedTarget = value
282+
this.updateSettings()
283+
},
278284
},
279285
methods: {
280286
async promptForSelections () {
@@ -345,6 +351,8 @@ export default {
345351
name: this.shootName,
346352
target: this.targetTab.selectedTarget,
347353
})
354+
config.canScheduleOnSeed = this.canScheduleOnSeed
355+
348356
this.updateState(config)
349357
} catch (err) {
350358
this.targetTab.initializedForTarget = undefined

frontend/src/composables/useTerminalConfig.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function createTerminalConfigComposable () {
2828
currentNode,
2929
privilegedMode,
3030
nodes = [],
31+
canScheduleOnSeed = false,
3132
} = options
3233

3334
const autoSelectNodeItem = {
@@ -37,13 +38,13 @@ export function createTerminalConfigComposable () {
3738
}
3839

3940
state.node = defaultNode
40-
if (!defaultNode) {
41+
if (!defaultNode && nodes.length) {
4142
state.node = authnStore.isAdmin
4243
? get(head(nodes), ['data', 'kubernetesHostname'])
4344
: autoSelectNodeItem.data.kubernetesHostname
4445
}
4546

46-
if (!authnStore.isAdmin) {
47+
if (!authnStore.isAdmin || !canScheduleOnSeed) {
4748
state.runtime = 'shoot'
4849
} else {
4950
const currentNodeIsShootWorker = some(nodes, ['data.kubernetesHostname', currentNode])
@@ -56,6 +57,7 @@ export function createTerminalConfigComposable () {
5657
if (nodes.length) {
5758
state.shootNodes.unshift(autoSelectNodeItem)
5859
}
60+
state.canScheduleOnSeed = canScheduleOnSeed
5961
}
6062

6163
const state = reactive({
@@ -94,6 +96,9 @@ export function createTerminalConfigComposable () {
9496
if (authnStore.isAdmin) {
9597
state.privilegedMode = value === 'shoot'
9698
}
99+
if (!state.canScheduleOnSeed) {
100+
state.privilegedMode = false
101+
}
97102
})
98103

99104
return {

frontend/src/composables/useTerminalSplitpanes.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,21 @@ export function createTerminalSplitpanesComposable () {
8686
return isStatusHibernated(get(shootItem.value, ['status']))
8787
})
8888

89+
const canScheduleOnSeed = computed(() => {
90+
return get(shootItem.value, ['info', 'canLinkToSeed'])
91+
})
92+
8993
const slotItemUUIds = computed(() => {
9094
const slotItems = filter(symbolTree.items(), ['data.type', 'SLOT_ITEM'])
9195
return map(slotItems, 'uuid')
9296
})
9397

9498
const defaultTarget = computed(() => {
95-
return terminalCoordinates.value.target || (authzStore.hasControlPlaneTerminalAccess ? TargetEnum.CONTROL_PLANE : TargetEnum.SHOOT)
99+
return terminalCoordinates.value.target ||
100+
(authzStore.hasControlPlaneTerminalAccess &&
101+
canScheduleOnSeed.value)
102+
? TargetEnum.CONTROL_PLANE
103+
: TargetEnum.SHOOT
96104
})
97105

98106
function addSlotItem ({ data = {}, targetId, position } = {}) {
@@ -250,6 +258,7 @@ export function createTerminalSplitpanesComposable () {
250258
shootName,
251259
hasShootWorkerGroups,
252260
isShootStatusHibernated,
261+
canScheduleOnSeed,
253262
splitpaneTree,
254263
newTerminalPrompt,
255264
defaultTarget,

0 commit comments

Comments
 (0)