adding pvc template to statefulset

This commit is contained in:
Nancy Butler 2020-09-16 15:54:32 -07:00
parent 2cfc90ca63
commit bc5bec82b0
3 changed files with 79 additions and 41 deletions

View File

@ -1317,9 +1317,13 @@ workload:
parallelism:
label: Parallelism
tip: The maximum number of pods the job should run at any given time.
startingDeadlineSeconds:
label: Starting Deadline Seconds
tip: The deadline in seconds for starting the job if it misses scheduled time
successfulJobsHistoryLimit:
label: Successful Job History Limit
tip: The number of successful finished jobs to retain.
suspend: Suspend
networking:
dnsPolicy:
label: DNS Policy
@ -1489,7 +1493,6 @@ workload:
title: 'Storage'
volumeName: Volume Name
volumePath: Volume Path
typeDescriptions:
apps.daemonset: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/" target="_blank" rel="noopener nofollow" >DaemonSets</a> run exactly one pod on every eligible node. When new nodes are added to the cluster, DaemonSets automatically deploy to them. Recommended for system-wide or vertically-scalable workloads that never need more than one pod per node.
apps.deployment: '<a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" target="_blank" rel="noopener nofollow" >Deployments</a> run a scalable number of replicas of a pod distributed among the eligible nodes. Changes are rolled out incrementally and can be rolled back to the previous revision when needed. Recommended for stateless & horizontally-scalable workloads.'
@ -1500,6 +1503,12 @@ workload:
activeDeadlineSeconds:
label: Pod Active Deadline
tip: The duration the pod may be active before the system will try to mark it failed and kill associated containers.
concurrencyPolicy:
label: Concurrency
options:
allow: Allow CronJobs to run concurrently
forbid: Skip next run if current run hasn't finished
replace: Replace run if current run hasn't finished
maxSurge:
label: Max Surge
tip: The maximum number of pods allowed beyond the desired scale at any given time.

View File

@ -29,19 +29,20 @@ export default {
},
data() {
const {
failedJobsHistoryLimit, successfulJobsHistoryLimit, suspend, schedule
failedJobsHistoryLimit, successfulJobsHistoryLimit, suspend = false, schedule
} = this.value;
if (this.type === WORKLOAD_TYPES.CRON_JOB) {
if (!this.value.jobTemplate) {
this.$set(this.value, 'jobTemplate', { spec: {} });
}
const { concurrencyPolicy = 'Allow', startingDeadlineSeconds } = this.value;
const {
completions, parallelism, backoffLimit, activeDeadlineSeconds
} = this.value.jobTemplate.spec;
return {
completions, parallelism, backoffLimit, activeDeadlineSeconds, failedJobsHistoryLimit, successfulJobsHistoryLimit, suspend, schedule
completions, parallelism, backoffLimit, activeDeadlineSeconds, failedJobsHistoryLimit, successfulJobsHistoryLimit, suspend, schedule, concurrencyPolicy, startingDeadlineSeconds
};
} else {
const {
@ -70,7 +71,6 @@ export default {
parallelism: this.parallelism,
backoffLimit: this.backoffLimit,
activeDeadlineSeconds: this.activeDeadlineSeconds,
};
this.$emit('input', spec);
@ -80,7 +80,8 @@ export default {
failedJobsHistoryLimit: this.failedJobsHistoryLimit,
successfulJobsHistoryLimit: this.successfulJobsHistoryLimit,
suspend: this.suspend,
schedule: this.schedule,
concurrencyPolicy: this.concurrencyPolicy,
startingDeadlineSeconds: this.startingDeadlineSeconds,
jobTemplate: {
...this.value.jobTemplate,
completions: this.completions,
@ -103,7 +104,7 @@ export default {
<div class="col span-6">
<UnitInput v-model="completions" :mode="mode" :suffix="completions===1 ? 'Time' : 'Times'">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.completions.label') }}
<i v-tooltip="t('workload.job.completions.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -113,7 +114,7 @@ export default {
<div class="col span-6">
<UnitInput v-model="parallelism" :mode="mode" class="col span-6" :suffix="parallelism===1 ? 'Time' : 'Times'">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.parallelism.label') }}
<i v-tooltip="t('workload.job.parallelism.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -125,7 +126,7 @@ export default {
<div class="col span-6">
<UnitInput v-model="backoffLimit" :mode="mode" :suffix="backoffLimit===1 ? 'Time' : 'Times'">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.backoffLimit.label') }}
<i v-tooltip="t('workload.job.backoffLimit.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -135,7 +136,7 @@ export default {
<div class="col span-6">
<UnitInput v-model="activeDeadlineSeconds" :mode="mode" :suffix="activeDeadlineSeconds===1 ? 'Second' : 'Seconds'">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.activeDeadlineSeconds.label') }}
<i v-tooltip="t('workload.job.activeDeadlineSeconds.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -148,7 +149,7 @@ export default {
<div class="col span-6">
<LabeledInput v-model.number="successfulJobsHistoryLimit" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.successfulJobsHistoryLimit.label') }}
<i v-tooltip="t('workload.job.successfulJobsHistoryLimit.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -158,7 +159,7 @@ export default {
<div class="col span-6">
<LabeledInput v-model.number="failedJobsHistoryLimit" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.failedJobsHistoryLimit.label') }}
<i v-tooltip="t('workload.job.failedJobsHistoryLimit.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -166,8 +167,42 @@ export default {
</LabeledInput>
</div>
</div>
<span>Suspend</span>
<RadioGroup v-model="suspend" name="suspend" row :options="[true, false]" :labels="['Yes', 'No']" />
<div class="row mb-20">
<div class="col span-6">
<UnitInput v-model="startingDeadlineSeconds" :mode="mode" :suffix="startingDeadlineSeconds===1 ? 'Second' : 'Seconds'">
<template #label>
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.job.startingDeadlineSeconds.label') }}
<i v-tooltip="t('workload.job.startingDeadlineSeconds.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
</template>
</UnitInput>
</div>
<div class="col span-6">
<RadioGroup
v-model="suspend"
:mode="mode"
:label="t('workload.job.suspend')"
name="suspend"
:options="[true, false]"
:labels="['Yes', 'No']"
@input="update"
/>
</div>
</div>
<div class="row">
<div class="col span-6">
<RadioGroup
v-model="concurrencyPolicy"
:mode="mode"
:label="t('workload.upgrading.concurrencyPolicy.label')"
name="concurrency"
:options="['Allow', 'Forbid', 'Replace']"
:labels="[t('workload.upgrading.concurrencyPolicy.options.allow'), t('workload.upgrading.concurrencyPolicy.options.forbid'), t('workload.upgrading.concurrencyPolicy.options.replace')]"
@input="update"
/>
</div>
</div>
</template>
</form>
</template>

View File

@ -29,7 +29,7 @@ export default {
},
data() {
const {
strategy:strategyObj = {}, minReadySeconds = 0, progressDeadlineSeconds = 600, revisionHistoryLimit = 10
strategy:strategyObj = {}, minReadySeconds = 0, progressDeadlineSeconds = 600, revisionHistoryLimit = 10, podManagementPolicy = 'OrderedReady'
} = this.value;
const strategy = strategyObj.type || 'RollingUpdate';
let maxSurge = '25';
@ -54,7 +54,6 @@ export default {
unavaiableUnits = 'Pods';
}
}
const partition = get(strategyObj, `${ strategy }.partition`) || 0;
const podSpec = get(this.value, 'template.spec');
@ -69,8 +68,8 @@ export default {
maxSurge,
maxUnavailable,
revisionHistoryLimit,
partition,
terminationGracePeriodSeconds,
podManagementPolicy
};
},
computed: {
@ -111,7 +110,7 @@ export default {
update() {
const podSpec = this.value?.template?.spec;
const {
minReadySeconds, revisionHistoryLimit, progressDeadlineSeconds, terminationGracePeriodSeconds, partition
minReadySeconds, revisionHistoryLimit, progressDeadlineSeconds, terminationGracePeriodSeconds
} = this;
let { maxSurge, maxUnavailable } = this;
@ -160,15 +159,11 @@ export default {
break;
}
case WORKLOAD_TYPES.STATEFUL_SET: {
let updateStrategy;
const updateStrategy = { type: this.strategy };
if (this.strategy === 'RollingUpdate') {
updateStrategy = { rollingUpdate: { partition }, type: this.strategy };
} else {
updateStrategy = { type: this.strategy };
}
Object.assign(this.value, { updateStrategy, revisionHistoryLimit });
Object.assign(this.value, {
updateStrategy, revisionHistoryLimit, podManagementPolicy: this.podManagementPolicy
});
break;
}
default:
@ -210,15 +205,14 @@ export default {
</div>
<div v-if="isStatefulSet" class="row mb-20">
<div class="col span-6">
<RadioGroup v-model="value.podManagementPolicy" :label="t('workload.upgrading.podManagementPolicy.label')" :options="['OrderedReady', 'Parallel']" />
<!-- <UnitInput v-model="partition" :suffix="partition == 1 ? 'Pod' : 'Pods'" :label="t('workload.upgrading.partition.label')" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.partition.label') }}
<i v-tooltip="t('workload.upgrading.partition.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
</template>
</UnitInput> -->
<RadioGroup
v-model="podManagementPolicy"
name="podManagement"
:mode="mode"
:label="t('workload.upgrading.podManagementPolicy.label')"
:options="['OrderedReady', 'Parallel']"
@input="update"
/>
</div>
</div>
<template v-if="strategy === 'RollingUpdate'">
@ -235,7 +229,7 @@ export default {
@input="e=>updateWithUnits(e, 'maxSurge')"
>
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.maxSurge.label') }}
<i v-tooltip="t('workload.upgrading.maxSurge.label')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -254,7 +248,7 @@ export default {
@input="e=>updateWithUnits(e, 'maxUnavailable')"
>
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.maxUnavailable.label') }}
<i v-tooltip="t('workload.upgrading.maxUnavailable.label')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -269,7 +263,7 @@ export default {
<div v-if="!isStatefulSet" class="col span-6">
<UnitInput v-model="minReadySeconds" :suffix="minReadySeconds == 1 ? 'Second' : 'Seconds'" :label="t('workload.upgrading.minReadySeconds.label')" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.minReadySeconds.label') }}
<i v-tooltip="t('workload.upgrading.minReadySeconds.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -279,7 +273,7 @@ export default {
<div v-if="isDeployment || isStatefulSet || isDaemonSet" class="col span-6">
<UnitInput v-model="revisionHistoryLimit" :suffix="revisionHistoryLimit == 1 ? 'Set' : 'Sets'" :label="t('workload.upgrading.revisionHistoryLimit.label')" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.revisionHistoryLimit.label') }}
<i v-tooltip="t('workload.upgrading.revisionHistoryLimit.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
@ -291,9 +285,9 @@ export default {
<div class="col span-6">
<UnitInput v-model="progressDeadlineSeconds" :suffix="progressDeadlineSeconds == 1 ? 'Second' : 'Seconds'" label="Progress Deadline" :mode="mode">
<template #label>
<label :style="{'color':'var(--input-label)'}">
Progress Deadline
<i v-tooltip="'How long to wait without seeing progress before marking the deployment as stalled.'" class="icon icon-info" style="font-size: 14px" />
<label class="has-tooltip" :style="{'color':'var(--input-label)'}">
{{ t('workload.upgrading.progressDeadlineSeconds.label') }}
<i v-tooltip="t('workload.upgrading.progressDeadlineSeconds.tip')" class="icon icon-info" style="font-size: 14px" />
</label>
</template>
</UnitInput>