Merge pull request #4102 from westlywright/enhancement.select.cluster.type

Rework Cluster Import/Register Experience
This commit is contained in:
Westly Wright 2020-07-28 12:02:31 -07:00 committed by GitHub
commit 2c1fac8c64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 24 deletions

View File

@ -6,10 +6,11 @@ export default Controller.extend({
growl: service(), growl: service(),
settings: service(), settings: service(),
queryParams: ['clusterTemplateRevision', 'importProvider'], queryParams: ['clusterTemplateRevision', 'importProvider', 'register'],
clusterTemplateRevision: null, clusterTemplateRevision: null,
importProvider: null, importProvider: null,
register: false,
cluster: alias('model.cluster'), cluster: alias('model.cluster'),

View File

@ -103,7 +103,8 @@ export default Route.extend({
if (isExiting && transition.targetName !== 'error') { if (isExiting && transition.targetName !== 'error') {
controller.setProperties({ controller.setProperties({
clusterTemplateRevision: null, clusterTemplateRevision: null,
importProvider: null importProvider: null,
register: false,
}); });
} }
}, },
@ -125,5 +126,6 @@ export default Route.extend({
queryParams: { queryParams: {
clusterTemplateRevision: { refreshModel: true }, clusterTemplateRevision: { refreshModel: true },
importProvider: { refreshModel: true }, importProvider: { refreshModel: true },
register: { refreshModel: true },
} }
}); });

View File

@ -1,4 +1,7 @@
<div class="launch-cluster"> <div class="launch-cluster">
<h2>
{{t "clusterNew.register.title"}}
</h2>
<div class="row mb-20"> <div class="row mb-20">
{{#if disabledAddCluster}} {{#if disabledAddCluster}}
<BannerMessage <BannerMessage
@ -10,22 +13,22 @@
<div class="row-same-height row-full-height"> <div class="row-same-height row-full-height">
<a <a
class="col span-6 cluster-driver-box span-height full-height" class="col span-6 cluster-driver-box span-height full-height"
href="{{href-to "global-admin.clusters.new.launch" "custom"}}" href="{{href-to "global-admin.clusters.new.launch" "import" (query-params register=true)}}"
disabled={{disabledAddCluster}} disabled={{disabledAddCluster}}
> >
<div class="machine-driver custom-driver"></div> <div class="machine-driver custom-driver"></div>
<div class="driver-content"> <div class="driver-content">
<h3> <h3>
{{t "clusterNew.custom.label"}} {{t "clusterNew.register.label"}}
</h3> </h3>
<p class="help-block"> <p class="help-block">
{{t "clusterNew.custom.helpBlock"}} {{t "clusterNew.register.helpBlock" htmlSafe=true}}
</p> </p>
</div> </div>
</a> </a>
<a <a
class="col span-6 cluster-driver-box span-height full-height" class="col span-6 cluster-driver-box span-height full-height"
href="{{href-to "global-admin.clusters.new.launch" "import"}}" href="{{href-to "global-admin.clusters.new.launch" "import" (query-params importProvider='other')}}"
disabled={{disabledAddCluster}} disabled={{disabledAddCluster}}
> >
<div class="machine-driver import-driver"></div> <div class="machine-driver import-driver"></div>
@ -44,6 +47,33 @@
</a> </a>
</div> </div>
</div> </div>
<div class="row">
<h2>
{{t "clusterNew.custom.title"}}
</h2>
<div class="col span-12 mt-0">
<div>
<label class="acc-label">
{{t "clusterNew.custom.subtitle"}}
</label>
</div>
<a
class="col span-6 cluster-driver-box span-height full-height"
href="{{href-to "global-admin.clusters.new.launch" "custom"}}"
disabled={{disabledAddCluster}}
>
<div class="machine-driver custom-driver"></div>
<div class="driver-content">
<h3>
{{t "clusterNew.custom.label"}}
</h3>
<p class="help-block">
{{t "clusterNew.custom.helpBlock"}}
</p>
</div>
</a>
</div>
</div>
{{#if (gt (get (get providerGroups "rkeGroup") "length") 0)}} {{#if (gt (get (get providerGroups "rkeGroup") "length") 0)}}
<div class="row"> <div class="row">
<div class="col span-12"> <div class="col span-12">

View File

@ -4,12 +4,14 @@
{{t "clustersPage.select.provider.label"}} {{t "clustersPage.select.provider.label"}}
{{else if (eq router.currentRoute.localName "cluster-template")}} {{else if (eq router.currentRoute.localName "cluster-template")}}
{{t "clustersPage.select.template.label"}} {{t "clustersPage.select.template.label"}}
{{else}} {{else if (or (eq provider "import") (eq provider "importeks"))}}
{{#if (or (eq provider "import") (eq provider "importeks"))}} {{#if router.currentRoute.queryParams.register}}
{{t "clustersPage.launch.import"}} - {{driver-name provider}} {{t "clustersPage.launch.register"}}
{{else}}
{{t "clustersPage.launch.import"}}
{{/if}}
{{else}} {{else}}
{{t "clustersPage.launch.new"}} - {{driver-name provider}} {{t "clustersPage.launch.new"}} - {{driver-name provider}}
{{/if}}
{{/if}} {{/if}}
</h1> </h1>
</section> </section>

View File

@ -1,4 +1,4 @@
{{#if (eq provider "import")}} {{#if (and (eq provider "import") router.currentRoute.queryParams.register)}}
<div class="launch-cluster"> <div class="launch-cluster">
<div class="row mb-20"> <div class="row mb-20">
<div class="row-same-height row-full-height"> <div class="row-same-height row-full-height">

View File

@ -1367,6 +1367,7 @@ clustersPage:
launch: launch:
new: Add Cluster new: Add Cluster
import: Import Cluster import: Import Cluster
register: Register Cluster
cluster: cluster:
label: Cluster Name label: Cluster Name
templateRevision: templateRevision:
@ -3451,12 +3452,12 @@ clusterNew:
import: import:
clusterSelect: clusterSelect:
title: Choose Cluster title: Choose Cluster
detail: Choose an EKS cluster to import detail: Choose an EKS cluster to register
select: select:
label: Cluster To Import label: Cluster To register
input: input:
label: Cluster Name To Import label: Cluster Name To register
createLabel: Import Cluster createLabel: Register Cluster
tencenttke: tencenttke:
label: Tencent Kubernetes Engine label: Tencent Kubernetes Engine
shortLabel: Tencent TKE shortLabel: Tencent TKE
@ -4413,31 +4414,36 @@ clusterNew:
title: Authorized Endpoint title: Authorized Endpoint
detail: "Enabling the authorized cluster endpoint allows direct communication with the cluster, bypassing the API proxy. Authorized endpoints can be retrieved by generating a kubeconfig for the cluster." detail: "Enabling the authorized cluster endpoint allows direct communication with the cluster, bypassing the API proxy. Authorized endpoints can be retrieved by generating a kubeconfig for the cluster."
label: Authorized Cluster Endpoint label: Authorized Cluster Endpoint
register:
title: Bring an existing Kubernetes cluster
label: Register
shortLabel: Registered
helpBlock: Register an existing Rancher, <a href='https://k3s.io/' target='_blank' rel='nofollow noreferrer'>K3s</a> or EKS cluster.
custom: custom:
title: Create a new Kubernetes cluster
subtitle: With RKE and existing nodes
label: From existing nodes (Custom) label: From existing nodes (Custom)
shortLabel: Custom shortLabel: Custom
helpBlock: Create a new Kubernetes cluster using RKE, out of existing bare-metal servers or virtual machines. helpBlock: Create a new Kubernetes cluster using RKE, out of existing bare-metal servers or virtual machines.
import: import:
label: Import an existing cluster label: Import an existing cluster
shortLabel: Imported shortLabel: Imported
helpBlock: "Import an existing Kubernetes cluster." helpBlock: Import an existing CNCF certified Kubernetes cluster. Kubernetes configuration and infrastructure management is managed outside of Rancher.
command: command:
instructionsAdminRole: "<b>Note:</b> If you want to import a Google Kubernetes Engine (GKE) cluster (or any cluster that does not supply you with a kubectl configuration file with the ClusterRole <b>cluster-admin</b> bound to it), you need to bind the ClusterRole <b>cluster-admin</b> using the command below.<br/><br/>Replace <b>[USER_ACCOUNT]</b> with your Google account address (you can retrieve this using <b>gcloud config get-value account</b>). If you are not importing a Google Kubernetes Engine cluster, replace <b>[USER_ACCOUNT]</b> with the executing user configured in your kubectl configuration file." instructionsAdminRole: "<b>Note:</b> If you want to import a Google Kubernetes Engine (GKE) cluster (or any cluster that does not supply you with a kubectl configuration file with the ClusterRole <b>cluster-admin</b> bound to it), you need to bind the ClusterRole <b>cluster-admin</b> using the command below.<br/><br/>Replace <b>[USER_ACCOUNT]</b> with your Google account address (you can retrieve this using <b>gcloud config get-value account</b>). If you are not importing a Google Kubernetes Engine cluster, replace <b>[USER_ACCOUNT]</b> with the executing user configured in your kubectl configuration file."
instructions: "Run the kubectl command below on an existing Kubernetes cluster running a supported Kubernetes version to import it into {appName}:" instructions: "Run the kubectl command below on an existing Kubernetes cluster running a supported Kubernetes version to import it into {appName}:"
instructionsInsecure: "If you get an error about 'certificate signed by unknown authority' because your {appName} installation is running with an untrusted/self-signed SSL certificate, run the command below instead to bypass the certificate check:" instructionsInsecure: "If you get an error about 'certificate signed by unknown authority' because your {appName} installation is running with an untrusted/self-signed SSL certificate, run the command below instead to bypass the certificate check:"
select: select:
other: other:
title: Other title: Rancher or K3s
helpBlock: "For <a id='k3s-info-external-link' href='https://k3s.io/' target='_blank' rel='nofollow noreferrer'>K3S backed clusters</a>, {appName} can manage some aspects of the cluster configuration, such as version upgrades. For standard Kubernetes clusters, the provider will manage provisioning and configuration." helpBlock: "Register existing Rancher or <a id='k3s-info-external-link' href='https://k3s.io/' target='_blank' rel='nofollow noreferrer'>K3s</a> backed cluster."
eks: eks:
title: Amazon EKS title: Amazon EKS
helpBlock: "Register an existing Amazon EKS cluster."
importEks: importEks:
label: Import an existing Amazon EKS cluster label: Register an existing Amazon EKS cluster
shortLabel: Imported shortLabel: Registered
helpBlock: "Import an existing Amazon EKS Kubernetes cluster." helpBlock: "Register an existing Amazon EKS Kubernetes cluster."
command:
instructions: "Run the kubectl command below on an existing Kubernetes cluster running a supported Kubernetes version to import it into {appName}:"
instructionsInsecure: "If you get an error about 'certificate signed by unknown authority' because your {appName} installation is running with an untrusted/self-signed SSL certificate, run the command below instead to bypass the certificate check:"
clusterTemplateNew: clusterTemplateNew:
members: members: