diff --git a/lib/nodes/addon/components/driver-harvester/component.js b/lib/nodes/addon/components/driver-harvester/component.js index b3f995ac0..8c1c71e24 100644 --- a/lib/nodes/addon/components/driver-harvester/component.js +++ b/lib/nodes/addon/components/driver-harvester/component.js @@ -176,6 +176,7 @@ export default Component.extend(NodeDriver, { networks: get(this, 'globalStore').rawRequest({ url: `${ url }/v1/k8s.cni.cncf.io.networkattachmentdefinition` }), namespaces: get(this, 'globalStore').rawRequest({ url: `${ url }/v1/namespace` }), configmaps: get(this, 'globalStore').rawRequest({ url: `${ url }/v1/configmap` }), + storageClass: get(this, 'globalStore').rawRequest({ url: `${ url }/v1/storage.k8s.io.storageclasses` }), systemNamespace: get(this, 'globalStore').rawRequest({ url: `${ url }/v1/management.cattle.io.settings/system-namespaces` }), }).then((resp) => { const images = resp.images.body.data || []; @@ -254,24 +255,37 @@ export default Component.extend(NodeDriver, { } }) + const storageClass = resp.storageClass.body.data || []; + const storageClassContent = storageClass.map((s) => { + const isDefault = s.metadata?.annotations?.['storageclass.kubernetes.io/is-default-class'] === 'true'; + const label = isDefault ? `${ s.metadata.name } (${ this.intl.t('generic.default') })` : s.metadata.name; + + return { + label, + value: s.metadata.name, + }; + }) || []; + setProperties(this, { imageContent, networkContent, namespaceContent, userDataContent, networkDataContent, + storageClassContent }); }).catch((err) => { setProperties(this, { - imageContent: [], - networkContent: [], - namespaceContent: [], - userDataContent: [], - networkDataContent: [], - namespaces: [], - vmAffinity: [], - nodeSchedulings: [], - podSchedulings: [], + imageContent: [], + networkContent: [], + namespaceContent: [], + userDataContent: [], + networkDataContent: [], + namespaces: [], + vmAffinity: [], + nodeSchedulings: [], + podSchedulings: [], + storageClassContent: [], }) const message = err.statusText || err.message; @@ -292,15 +306,6 @@ export default Component.extend(NodeDriver, { return (get(this, 'cloudCredentials') || []).find((C) => C.id === get(this, 'model.cloudCredentialId')); }), - - isImported: computed('currentCredential.harvestercredentialConfig.clusterType', function() { - if (get(this, 'currentCredential') && get(this, 'currentCredential').harvestercredentialConfig) { - return get(this, 'currentCredential').harvestercredentialConfig.clusterType === 'imported'; - } - - return false; - }), - isSystemNamespace(namespace) { if ( namespace.metadata && namespace.metadata.annotations && namespace.metadata.annotations['management.cattle.io/system-namespace'] === 'true' ) { return true; diff --git a/lib/nodes/addon/components/driver-harvester/template.hbs b/lib/nodes/addon/components/driver-harvester/template.hbs index f6e91fdfe..cd797c2df 100644 --- a/lib/nodes/addon/components/driver-harvester/template.hbs +++ b/lib/nodes/addon/components/driver-harvester/template.hbs @@ -74,100 +74,19 @@