Install cluster templates into fleet-default

This commit is contained in:
Vincent Fiduccia 2021-06-08 15:14:15 -07:00
parent bb393202e5
commit ac458cf3c0
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
1 changed files with 18 additions and 15 deletions

View File

@ -31,6 +31,7 @@ import { clone, diff, get, set } from '@/utils/object';
import { findBy, insertAt } from '@/utils/array';
import Vue from 'vue';
import { saferDump } from '@/utils/create-yaml';
import { DEFAULT_WORKSPACE } from '@/models/provisioning.cattle.io.cluster';
const VALUES_STATE = {
FORM: 'FORM',
@ -78,26 +79,28 @@ export default {
id: 'server-url'
});
this.value = await this.$store.dispatch('cluster/create', {
type: 'chartInstallAction',
metadata: {
namespace: this.existing ? this.existing.spec.namespace : this.query.appNamespace,
name: this.existing ? this.existing.spec.name : this.query.appName,
}
});
if ( this.existing ) {
this.forceNamespace = this.existing.metadata.namespace;
this.nameDisabled = true;
} else if (this.$route.query[FROM_CLUSTER] === _FLAGGED) {
this.forceNamespace = DEFAULT_WORKSPACE;
} else if ( this.chart?.targetNamespace ) {
this.forceNamespace = this.chart.targetNamespace;
} else if ( this.query.appNamespace ) {
this.forceNamespace = this.query.appNamespace;
} else {
if ( this.chart?.targetNamespace ) {
this.forceNamespace = this.chart.targetNamespace;
} else if ( this.query.appNamespace ) {
this.forceNamespace = this.query.appNamespace;
} else {
this.forceNamespace = null;
}
this.forceNamespace = null;
}
this.value = await this.$store.dispatch('cluster/create', {
type: 'chartInstallAction',
metadata: {
namespace: this.forceNamespace || this.$store.getters['defaultNamespace'],
name: this.existing?.spec?.name || this.query.appName || '',
}
});
if ( !this.existing) {
if ( this.chart?.targetName ) {
this.value.metadata.name = this.chart.targetName;
this.nameDisabled = true;