{{#if hasLegacySnapshotSettings}}
  <section class="mt-20 mb-20">
    <BannerMessage
      @color="bg-warning m-0"
      @message={{t "clusterNew.rke.etcd.backupConfig.legacy" duration=legacyRetention}}
    />
  </section>
{{/if}}

<section class="header mt-20 clearfix">
  <div class="pull-left">
    <h2 class="mb-0">
      {{t "clusterNew.rke.customize.label"}}
    </h2>
  </div>
  <div class="right-buttons">
    {{#if (or (not applyClusterTemplate) (and (eq step 1) (not applyClusterTemplate)))}}
      {{#if pasteOrUpload}}
        <button class="btn btn-sm bg-primary" {{action "cancel"}}>
          {{#if notView}}
            {{t "clusterNew.advanced.cancel"}}
          {{else}}
            {{t "clusterNew.advanced.viewCancel"}}
          {{/if}}
        </button>
      {{else}}
        <button class="btn btn-sm bg-primary" {{action "showPaste"}}>
          {{#if notView}}
            {{t "clusterNew.advanced.yaml"}} <span class="icon icon-copy"></span>
          {{else}}
            {{t "clusterNew.advanced.viewYaml"}} <span class="icon icon-copy"></span>
          {{/if}}
        </button>
      {{/if}}
    {{/if}}
  </div>
</section>

{{#if (and (not clusterTemplateCreate) notView) }}
  {{#if (or isEdit (eq step 1))}}
    <section class="cluster-template-select mb-5">
      <div class="row">
        {{#if (or (or model.clusterTemplateRevisions model.clusterTemplateRevision) clusterTemplatesEnforced)}}
          <div>
            <label class="acc-label" for="use-existing-cluster-template">
              {{input
                class="input-lg"
                type="checkbox"
                checked=useClusterTemplate
                id="use-existing-cluster-template"
                disabled=(or isEdit (or clusterTemplatesEnforced pasteOrUpload))
              }}
              {{t "clusterNew.rke.clustersSelectTemplate.label"}}
            </label>
          </div>
          {{#if useClusterTemplate}}
            <div class="col span-6">
              {{#if filteredClusterTemplates}}
                {{new-select
                  id="input-cluster-template-select"
                  classNames="form-control"
                  optionValuePath="id"
                  optionLabelPath="name"
                  content=filteredClusterTemplates
                  value=selectedClusterTemplateId
                  prompt=(t "clusterNew.rke.clustersSelectTemplate.select.prompt")
                  localizedPrompt=true
                  disabled=isEdit
                }}
              {{else}}
                {{selectedClusterTemplateId}}
              {{/if}}
            </div>
            <div class="col span-6">
              {{#if filteredClusterTemplates}}
                {{new-select
                  classNames="form-control"
                  optionValuePath="id"
                  optionLabelPath="name"
                  content=filteredTemplateRevisions
                  value=clusterTemplateRevisionId
                  disabled=(not selectedClusterTemplateId)
                  prompt=(t "clusterNew.rke.clustersSelectTemplateRevision.select.prompt")
                  localizedPrompt=true
                }}
              {{else}}
                {{clusterTemplateRevisionId}}
              {{/if}}
            </div>
          {{/if}}
        {{/if}}
      </div>
    </section>
  {{/if}}
{{/if}}

{{#if (or clusterTemplateCreate (or (not clusterTemplatesEnforced) (and clusterTemplatesEnforced clusterTemplateRevisionId)))}}
  {{#if (or isEdit (eq step 1))}}
    {{#accordion-list
       expandAll=(mut forceExpandAll)
       showExpandAll=true
       as |al expandFn|
    }}
      {{#if pasteOrUpload}}
        {{!-- EDIT YAML  --}}
        <div class="accordion">
          <div class="accordion-header">
            <div class="expand"></div>
            <div class="title">
              <span class="m-0">{{t "clusterNew.kubernetesOptions.title" }}</span>
              <p class="help-block">{{t "clusterNew.kubernetesOptions.detail" }}</p>
            </div>
          </div>
          <div class="accordion-content">
            <div class="mt-25">
              {{input-yaml
                showDownload=false
                canChangeName=false
                autoResize=true
                value=yamlValue
                readOnly=(eq mode "view")
                showUpload=(not-eq mode "view")
                valueUpdated=(action "yamlValUpdated")
              }}
            </div>
            {{copy-to-clipboard
              tooltipText=""
              buttonText="copyToClipboard.tooltip"
              clipboardText=yamlValue
              class="with-clip"
            }}
          </div>
        </div>
      {{else}}
        {{!-- EDIT FORM  --}}
        {{#accordion-list-item
           title=(t "clusterNew.kubernetesOptions.title")
           detail=(t "clusterNew.kubernetesOptions.detail")
           expandOnInit=true
           expandAll=al.expandAll
           expand=(action expandFn)
        }}
          <div class="row">
            <div class="col span-6">
              <label class="acc-label">
                {{t "clusterNew.rke.version.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.kubernetesVersion"
                    @configVariable={{config.kubernetesVersion}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>

              <CheckOverrideAllowed
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @paramName="rancherKubernetesEngineConfig.kubernetesVersion"
                @questions={{model.clusterTemplateRevision.questions}}
              >
                <FormVersions
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @cluster={{cluster}}
                  @clusterTemplateCreate={{clusterTemplateCreate}}
                  @mode={{mode}}
                  @initialVersion={{initialVersion}}
                  @value={{config.kubernetesVersion}}
                  @versions={{versionChoices}}
                  @clusterTemplateQuestions={{clusterTemplateQuestions}}
                />
              </CheckOverrideAllowed>
            </div>
          </div>

          <FormNetworkConfig
            @config={{config}}
            @mode={{mode}}
            @isCustom={{isCustom}}
            @cluster={{cluster}}
            @enableNetworkPolicy={{primaryResource.enableNetworkPolicy}}
            @clusterTemplateCreate={{clusterTemplateCreate}}
            @clusterTemplateRevision={{model.clusterTemplateRevision}}
            @applyClusterTemplate={{applyClusterTemplate}}
            @addOverride={{action "addOverride"}}
          />

          <div class="row">
            <div class="col span-12">
              <CruCloudProvider
                @cluster={{cluster}}
                @driver={{nodeWhich}}
                @setCpFields={{action "setCpFields"}}
                @mode={{mode}}
                @clusterTemplateCreate={{clusterTemplateCreate}}
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision}}
                @questions={{model.clusterTemplateRevision.questions}}
                @addOverride={{action "addOverride"}}
              />
            </div>
          </div>
        {{/accordion-list-item}}

        {{#accordion-list-item
           title=(t "cruPrivateRegistry.title.label")
           detail=(t "cruPrivateRegistry.title.detail")
           expandOnInit=(or (or (eq mode "edit" true false) forceExpandOnInit) applyClusterTemplate)
           expandAll=al.expandAll
           expand=(action expandFn)
        }}
          <CruPrivateRegistry
            @mode={{mode}}
            @cluster={{cluster}}
            @addRegistry={{action "addRegistry"}}
            @removeRegistry={{action "removeRegistry"}}
            @addOverride={{action "addOverride"}}
            @clusterTemplateCreate={{clusterTemplateCreate}}
            @clusterTemplateRevision={{model.clusterTemplateRevision}}
            @applyClusterTemplate={{applyClusterTemplate}}
          />
        {{/accordion-list-item}}

        {{#accordion-list-item
           title=(t "clusterNew.rke.advanced.label")
           detail=(t "clusterNew.rke.advanced.detail")
           expandOnInit=(or (or (eq mode "edit" true false) forceExpandOnInit) applyClusterTemplate)
           expandAll=al.expandAll
           expand=(action expandFn)
        }}
          <div class="row">
            <div class="col span-4">
              <label class="acc-label">
                {{t "clusterNew.rke.ingress.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.ingress.provider"
                    @configVariable={{config.ingress.provider}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @applyClusterTemplate={{applyClusterTemplate}}
                @paramName="rancherKubernetesEngineConfig.ingress.provider"
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.ingress.provider
                }}
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.ingress.provider
                        value="nginx"
                      }}
                      {{t "generic.enabled"}}
                    </label>
                  </div>
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.ingress.provider
                        value="none"
                      }}
                      {{t "generic.disabled"}}
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
            <div class="col span-4">
              <label class="acc-label">
                {{t "clusterNew.rke.serviceNodePortRange.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange"
                    @configVariable={{config.services.kubeApi.serviceNodePortRange}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.services.kubeApi.serviceNodePortRange
                }}
                  {{input
                    type="text"
                    value=config.services.kubeApi.serviceNodePortRange
                    className="form-control"
                    placeholder=(t "clusterNew.rke.serviceNodePortRange.placeholder")
                  }}
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
            <div class="col span-4">
              <label class="acc-label">
                {{t "clusterNew.rke.monitoring.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.monitoring.provider"
                    @configVariable={{config.monitoring.provider}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.monitoring.provider"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.monitoring.provider
                }}
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.monitoring.provider
                        value="metrics-server"
                      }}
                      {{t "generic.enabled"}}
                    </label>
                  </div>
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.monitoring.provider
                        value="none"
                      }}
                      {{t "generic.disabled"}}
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
          </div>
          <div class="row">
            <div class="col span-4">
              <label class="acc-label">
                {{t "clusterNew.rke.podSecurityPolicy.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.services.kubeApi.podSecurityPolicy"
                    @configVariable={{config.services.kubeApi.podSecurityPolicy}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.services.kubeApi.podSecurityPolicy"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.services.kubeApi.podSecurityPolicy
                }}
                  <div class="radio">
                    <label class={{unless model.psps.length "text-muted"}}>
                      {{radio-button
                        selection=config.services.kubeApi.podSecurityPolicy
                        value=true
                        disabled=(not model.psps.length)
                      }}
                      {{t "generic.enabled"}}
                      {{#unless model.psps.length}}
                        &mdash; {{t "clusterNew.psp.none"}}
                      {{/unless}}
                    </label>
                  </div>
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.services.kubeApi.podSecurityPolicy
                        value=false
                        disabled=(not model.psps.length)
                      }}
                      {{t "generic.disabled"}}
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
            <div class="col span-4">
              {{#if config.services.kubeApi.podSecurityPolicy}}
                <label class="acc-label">
                  {{t "clusterNew.psp.label"}}{{field-required}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="defaultPodSecurityPolicyTemplateId"
                      @configVariable={{cluster.defaultPodSecurityPolicyTemplateId}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="defaultPodSecurityPolicyTemplateId"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=cluster.defaultPodSecurityPolicyTemplateId
                  }}
                    {{new-select
                      content=model.psps
                      optionLabelPath="displayName"
                      optionValuePath="id"
                      prompt="clusterNew.psp.prompt"
                      localizedPrompt=true
                      value=cluster.defaultPodSecurityPolicyTemplateId
                      disabled=(not config.services.kubeApi.podSecurityPolicy)
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              {{else}}
                <label class="acc-label">
                  {{t "clusterNew.psp.label"}}
                </label>
                <div class="form-control-static">{{t "generic.none"}}</div>
              {{/if}}
            </div>
          </div>
          <div class="row">
            <div class="col span-4">
              <label class="acc-label">
                {{t "clusterNew.rke.ignoreDockerVersion.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.ignoreDockerVersion"
                    @configVariable={{cluster.ignoreDockerVersion}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.ignoreDockerVersion"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.ignoreDockerVersion
                }}
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.ignoreDockerVersion
                        value=false
                      }}
                      {{t "clusterNew.rke.ignoreDockerVersion.disabled"}}
                    </label>
                  </div>
                  <div class="radio">
                    <label>
                      {{radio-button
                        selection=config.ignoreDockerVersion
                        value=true
                      }}
                      {{t "clusterNew.rke.ignoreDockerVersion.enabled"}}
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>

            <div class="col span-4">
              <label class="acc-label">
                {{t "loggingPage.dockerRootDir.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="dockerRootDir"
                    @configVariable={{cluster.dockerRootDir}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="dockerRootDir"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=cluster.dockerRootDir
                }}
                  {{input
                    type="text"
                    value=cluster.dockerRootDir
                    className="form-control"
                    placeholder=(t "clusterNew.rke.dockerRootDir.placeholder" dir=defaultDockerRootDir)
                  }}
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>

          </div>
          <div class="row">
            <div class="col span-12">

              <label class="acc-label">
                {{t "clusterNew.rke.etcd.location.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="uiOverrideBackupStrategy"
                    @configVariable={{backupStrategy}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="uiOverrideBackupStrategy"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=backupStrategy
                }}
                  <div>
                    <label class="radio mt-0">
                      {{radio-button selection=backupStrategy value="local"}}
                      {{t "clusterNew.rke.etcd.location.local.label"}}
                      <p class="help-block">
                        {{t "clusterNew.rke.etcd.location.local.help"}}
                      </p>
                    </label>
                  </div>
                  <div>
                    <label class="radio">
                      {{radio-button selection=backupStrategy value="s3"}}
                      {{t "clusterNew.rke.etcd.location.s3.label"}}
                      <p class="help-block">
                        {{t "clusterNew.rke.etcd.location.s3.help"}}
                      </p>
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
          </div>

          {{#unless (eq backupStrategy "local")}}
            <div class="row">
              <div class="col span-3">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.bucketName.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.bucketName"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.bucketName}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.bucketName"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=config.services.etcd.backupConfig.s3BackupConfig.bucketName
                  }}
                    {{input
                      type="text"
                      value=config.services.etcd.backupConfig.s3BackupConfig.bucketName
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.bucketName.placeholder")
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>

              <div class="col span-3 offset-1">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.region.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.region"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.region}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.region"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=config.services.etcd.backupConfig.s3BackupConfig.region
                  }}
                    {{input
                      type="text"
                      value=config.services.etcd.backupConfig.s3BackupConfig.region
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.region.placeholder")
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>

              <div class="col span-3 offset-1">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.endpoint.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.endpoint"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.endpoint}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.endpoint"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=config.services.etcd.backupConfig.s3BackupConfig.endpoint
                  }}
                    {{input
                      type="text"
                      value=config.services.etcd.backupConfig.s3BackupConfig.endpoint
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.endpoint.placeholder")
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>
            </div>

            <div class="row">
              <div class="col span-3">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.folder.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.folder"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.folder}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.folder"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=config.services.etcd.backupConfig.s3BackupConfig.folder
                  }}
                    {{input
                      type="text"
                      name="folder"
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.folder.placeholder")
                      value=config.services.etcd.backupConfig.s3BackupConfig.folder
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>

              <div class="col span-3 offset-1">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.accessKey.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.accessKey"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.accessKey}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.accessKey"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     value=config.services.etcd.backupConfig.s3BackupConfig.accessKey
                  }}
                    {{input
                      type="text"
                      name="accessKey"
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.accessKey.placeholder")
                      value=config.services.etcd.backupConfig.s3BackupConfig.accessKey
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>

              <div class="col span-3 offset-1">
                <label class="acc-label">
                  {{t "clusterNew.rke.etcd.backupConfig.secretKey.label"}}
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.secretKey"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.secretKey}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.secretKey"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     obfuscate=true
                     value=config.services.etcd.backupConfig.s3BackupConfig.secretKey
                  }}
                    {{input
                      type="password"
                      name="password"
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.secretKey.placeholder")
                      value=config.services.etcd.backupConfig.s3BackupConfig.secretKey
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>
            </div>
            <div class="row">
              <div class="col span-7">
                <label class="acc-label" for="s3-config-custom-ca">
                  {{#if clusterTemplateCreate}}
                    <ClusterTemplateOverrideToggle
                      @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.customCa"
                      @configVariable={{config.services.etcd.backupConfig.s3BackupConfig.customCa}}
                      @addOverride={{action "addOverride"}}
                      @questions={{model.clusterTemplateRevision.questions}}
                    />
                  {{/if}}
                  {{t "clusterNew.rke.etcd.backupConfig.customCa.label"}}
                </label>
                <CheckOverrideAllowed
                  @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.customCa"
                  @applyClusterTemplate={{applyClusterTemplate}}
                  @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                  @questions={{model.clusterTemplateRevision.questions}}
                >
                  {{#input-or-display
                     editable=notView
                     obfuscate=true
                     value=cluster.rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.customCa
                  }}
                    {{input-text-file
                      accept="application/x-x509-ca-cert,text/plain,.pem,.crt"
                      canChangeName=false
                      classNames="box"
                      id="s3-config-custom-ca"
                      minHeight=60
                      multiple=true
                      placeholder="clusterNew.rke.etcd.backupConfig.customCa.placeholder"
                      shouldChangeName=false
                      value=cluster.rancherKubernetesEngineConfig.services.etcd.backupConfig.s3BackupConfig.customCa
                    }}
                  {{/input-or-display}}
                </CheckOverrideAllowed>
              </div>
            </div>
          {{/unless}}

          <div class="row">
            <div class="col span-3">
              <label class="acc-label">
                {{t "clusterNew.rke.etcd.enabled.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.enabled"
                    @configVariable={{config.services.etcd.backupConfig.enabled}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.enabled"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.services.etcd.backupConfig.enabled
                }}
                  <div class="text-muted">
                    <label>
                      {{radio-button
                        selection=config.services.etcd.backupConfig.enabled
                        value=true
                      }}
                      {{t "generic.yes"}}
                    </label>
                    <label>
                      {{radio-button
                        selection=config.services.etcd.backupConfig.enabled
                        value=false
                      }}
                      {{t "generic.no"}}
                    </label>
                  </div>
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>

            <div class="col span-3 offset-1">
              <label class="acc-label">
                {{t "clusterNew.rke.etcd.backupConfig.interval.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.intervalHours"
                    @configVariable={{config.services.etcd.backupConfig.intervalHours}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.intervalHours"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                <div class="input-group">
                  {{#input-or-display
                     editable=notView
                     value=(concat config.services.etcd.backupConfig.intervalHours (concat " " (t "generic.hours")))
                  }}
                    {{input-integer
                      value=config.services.etcd.backupConfig.intervalHours
                      min=1
                      classNames="form-control"
                      placeholder=(t "clusterNew.rke.etcd.backupConfig.interval.placeholder")
                      disabled=(if (not config.services.etcd.backupConfig.enabled) true)
                    }}
                    <span class="input-group-addon bg-default">{{t "generic.hours"}}</span>
                  {{/input-or-display}}
                </div>
              </CheckOverrideAllowed>
            </div>

            <div class="col span-3 offset-1">
              <label class="acc-label">
                {{t "clusterNew.rke.etcd.backupConfig.retention.label"}}
                {{#if clusterTemplateCreate}}
                  <ClusterTemplateOverrideToggle
                    @path="rancherKubernetesEngineConfig.services.etcd.backupConfig.retention"
                    @configVariable={{config.services.etcd.backupConfig.retention}}
                    @addOverride={{action "addOverride"}}
                    @questions={{model.clusterTemplateRevision.questions}}
                  />
                {{/if}}
              </label>
              <CheckOverrideAllowed
                @paramName="rancherKubernetesEngineConfig.services.etcd.backupConfig.retention"
                @applyClusterTemplate={{applyClusterTemplate}}
                @clusterTemplateRevision={{model.clusterTemplateRevision.clusterConfig}}
                @questions={{model.clusterTemplateRevision.questions}}
              >
                {{#input-or-display
                   editable=notView
                   value=config.services.etcd.backupConfig.retention
                }}
                  {{input-integer
                    value=config.services.etcd.backupConfig.retention
                    min=1
                    classNames="form-control"
                    placeholder=(t "clusterNew.rke.etcd.backupConfig.retention.placeholder")
                    disabled=(if (not config.services.etcd.backupConfig.enabled) true)
                  }}
                {{/input-or-display}}
              </CheckOverrideAllowed>
            </div>
          </div>
        {{/accordion-list-item}}

        {{#accordion-list-item
           title=(t "clusterNew.rke.authorizedEndpoint.title")
           detail=(t "clusterNew.rke.authorizedEndpoint.detail")
           expandOnInit=(or (or (eq mode "edit" true false) forceExpandOnInit) applyClusterTemplate)
           expandAll=al.expandAll
           expand=(action expandFn)
        }}
          <AuthorizedEndpoint
            @mode={{mode}}
            @addOverride={{action "addOverride"}}
            @cluster={{cluster}}
            @clusterTemplateCreate={{clusterTemplateCreate}}
            @clusterTemplateRevision={{model.clusterTemplateRevision}}
            @applyClusterTemplate={{applyClusterTemplate}}
          />
        {{/accordion-list-item}}

      {{/if}}
    {{/accordion-list}}
  {{/if}} {{!-- endif (or isEdit (eq step 1)) --}}


  {{#if (and isCustom (eq step 2)) }}
    {{#accordion-list
       expandAll=(mut forceExpandAll)
       showExpandAll=false
       as |al expandFn|
    }}
      {{#if cluster.windowsPreferedCluster}}
        {{#accordion-list-item
           title=(t "clusterNew.rke.system.title")
           detail=(t "clusterNew.rke.system.detail")
           expandOnInit=true
           expandAll=al.expandAll
           expand=(action expandFn)
        }}
          <div class="row">
            <div class="col span-6 text-center mt-0 mb-0">
              <div class="radio">
                <label>
                  {{radio-button selection=isLinux value=true}}
                  {{t "clusterNew.rke.system.linux"}}
                </label>
              </div>
            </div>
            <div class="col span-6 text-center mt-0 mb-0">
              <div class="radio">
                <label>
                  {{radio-button selection=isLinux value=false}}
                  {{t "clusterNew.rke.system.windows"}}
                </label>
              </div>
            </div>
          </div>
        {{/accordion-list-item}}
      {{/if}}
      {{#accordion-list-item
         title=(t "clusterNew.rke.role.pageheader")
         detail=(t "clusterNew.rke.info.text")
         expandOnInit=true
         expandAll=al.expandAll
         expand=(action expandFn)
      }}
        <section>
          <p>
            <ol class="alphalist ml-40 list-unstyled">
              <li>
                <ul class="list-unstyled">
                  <div class="pb-10">
                    <h3 class="mb-0">{{t "clusterNew.rke.role.sectionheader"}}</h3>
                    <p class="help-block">{{t "clusterNew.rke.role.detail"}}</p>
                  </div>
                  <li>
                    {{t "clusterNew.rke.role.title"}}
                  </li>
                  <li>
                    <div class="row">
                      <div class="col span-4 text-center mt-0 mb-0">
                        <label class="p-10 pl-30 pr-30 {{unless isLinux "text-muted"}}">
                          {{input
                            type="checkbox"
                            checked=etcd
                            disabled=(not isLinux)
                          }} {{t "clusterNew.rke.role.header.etcd"}}
                        </label>
                      </div>
                      <div class="col span-4 text-center mt-0 mb-0">
                        <label class="p-10 pl-30 pr-30 {{unless isLinux "text-muted"}}">
                          {{input
                            type="checkbox"
                            checked=controlplane
                            disabled=(not isLinux)
                          }} {{t "clusterNew.rke.role.header.controlplane"}}
                        </label>
                      </div>
                      <div class="col span-4 text-center mt-0 mb-0">
                        <label class="p-10 pl-30 pr-30">
                          {{input
                            type="checkbox"
                            checked=worker
                            disabled=(not isLinux)
                          }} {{t "clusterNew.rke.role.header.worker"}}
                        </label>
                      </div>
                    </div>
                    {{#advanced-section advanced=commandAdvanced}}
                      <div class="row mt-20">
                        {{t "clusterNew.rke.address.title"}}
                        <p class="help-block">{{t "clusterNew.rke.address.detail"}}</p>
                        <ul class="list-unstyled">
                          <li>
                            <div class="row">
                              <div class="col span-6">
                                <label class="acc-label">
                                  {{t "clusterNew.rke.address.public.label"}}
                                </label>
                                {{input
                                  type="text"
                                  value=address
                                  placeholder=(t "clusterNew.rke.address.public.placeholder")
                                }}
                                {{#unless isAddressValid}}
                                  <div class="banner bg-warning">
                                    <div class="banner-icon"><span class="icon icon-alert"></span></div>
                                    <div class="banner-message">
                                      <p>{{t "clusterNew.rke.address.warning"}}</p>
                                    </div>
                                  </div>
                                {{/unless}}
                              </div>
                              <div class="col span-6">
                                <label class="acc-label">
                                  {{t "clusterNew.rke.address.private.label"}}
                                </label>
                                {{input
                                  type="text"
                                  value=internalAddress
                                  placeholder=(t "clusterNew.rke.address.private.placeholder")
                                }}
                                {{#unless isInternalAddressValid}}
                                  <div class="banner bg-warning">
                                    <div class="banner-icon"><span class="icon icon-alert"></span></div>
                                    <div class="banner-message">
                                      <p>{{t "clusterNew.rke.address.warning"}}</p>
                                    </div>
                                  </div>
                                {{/unless}}
                              </div>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="row mt-20">
                        {{t "clusterNew.rke.nodeName.title"}}
                        <p class="help-block">
                          {{t "clusterNew.rke.nodeName.detail"}}
                        </p>
                        <ul class="list-unstyled">
                          <li>
                            <div class="row">
                              <div class="col span-6">
                                {{input
                                  type="text"
                                  value=nodeName
                                  placeholder=(t "clusterNew.rke.nodeName.placeholder")
                                }}
                                {{#unless isNodeNameValid}}
                                  {{top-errors errors=nodeNameErrors}}
                                {{/unless}}
                              </div>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="row mt-20">
                        {{t "clusterNew.rke.labels.title"}}
                        <p class="help-block">
                          {{t "clusterNew.rke.labels.detail"}}
                        </p>
                        <ul class="list-unstyled">
                          <li>
                            {{#form-user-labels
                               setLabels=(action "setLabels")
                               expandAll=al.expandAll
                               expand=(action expandFn)
                               detailKey="formUserLabels.nodeDetail"
                               as | userLabelArray removeLabel addUserLabel |
                            }}
                              {{#if userLabelArray.length}}
                                <table class="table fixed no-lines mt-20">
                                  <tr class="hidden-xs hidden-sm">
                                    <th>{{t "formUserLabels.key.label"}}{{field-required}}</th>
                                    <th width="30">&nbsp;</th>
                                    <th>{{t "formUserLabels.value.label"}}</th>
                                    <th width="40">&nbsp;</th>
                                  </tr>
                                  {{#each userLabelArray as |label|}}
                                    <tr>
                                      <td data-title="key">
                                        {{input-paste
                                          pasted=(action "pastedLabels")
                                          class="form-control input-sm key"
                                          type="text"
                                          value=label.key
                                          placeholder="formUserLabels.key.placeholder"
                                          disabled=(eq label.readonly true)
                                        }}
                                      </td>

                                      <td class="text-center">
                                        <p class="input-sm">
                                          {{t "formUserLabels.separator"}}
                                        </p>
                                      </td>

                                      <td data-title="label">
                                        {{input
                                          class="form-control input-sm"
                                          type="text"
                                          value=label.value
                                          placeholder=(t "formUserLabels.value.placeholder")
                                          disabled=(eq label.readonly true)
                                        }}
                                      </td>

                                      <td class="text-right">
                                        <button class="btn bg-primary btn-sm" {{action removeLabel label}} disabled={{eq label.readonly true}}>
                                          <i class="icon icon-minus"/>
                                          <span class="sr-only">
                                            {{t "generic.remove"}}
                                          </span>
                                        </button>
                                      </td>
                                    </tr>
                                  {{/each}}
                                </table>
                                <div class="protip pt-10">
                                  {{t "formUserLabels.protip"}}
                                </div>
                              {{/if}}

                              <button class="btn bg-link icon-btn" {{action addUserLabel}}>
                                <span class="darken">
                                  <i class="icon icon-plus text-small"/>
                                </span>
                                <span>
                                  {{t "formUserLabels.addAction"}}
                                </span>
                              </button>
                            {{/form-user-labels}}

                            {{#unless cluster.windowsPreferedCluster}}
                              <div class="row mt-20 mb-20">
                                {{t "clusterNew.rke.taints.title"}}
                                <p class="help-block">
                                  {{t "clusterNew.rke.taints.detail"}}
                                </p>
                                {{node-taints setTaints=(action "setTaints")}}
                              </div>
                            {{/unless}}
                          </li>
                        </ul>
                      </div>
                    {{/advanced-section}}
                  </li>
                </ul>
              </li>
              <li>
                {{t (if isLinux "clusterNew.rke.command.instructions" "clusterNew.rke.command.winInstructions") htmlSafe=true version="1809"}}
                {{!-- <p class="help-block">{{t "clusterNew.rke.labels.detail"}}</p> --}}
                <ul class="list-unstyled">
                  <li>
                    <div class="copy-pre mt-20 mb-20">
                      {{#if loading}}
                        <div class="text-center"><i class="icon icon-spinner icon-spin"></i> {{t "generic.loading"}}</div>
                      {{else if command}}
                        {{copy-to-clipboard
                          clipboardText=command
                          tagName="div"
                          classNames="copy-to-pre"
                        }}
                        <pre id="registration-command" style="font-size: 14px;">{{command}}</pre>
                      {{/if}}
                    </div>
                  </li>
                </ul>
              </li>
            </ol>
          </p>

        </section>
      {{/accordion-list-item}}
    {{/accordion-list}}

    {{#if newNodeCount}}
      <div class="banner bg-success">
        <div class="banner-icon"><span class="icon icon-success"></span></div>
        <div class="banner-message">
          <p>{{t "clusterNew.rke.detected" count=newNodeCount}}</p>
        </div>
      </div>
    {{/if}}
  {{/if}} {{!-- endif (and isCustom (eq step 2)) --}}


  {{#if (or clusterTemplateCreate applyClusterTemplate)}}
    {{#if (or isEdit (eq step 1))}}
      {{#accordion-list
         expandAll=(mut forceExpandAll)
         showExpandAll=false
         as |al expandFn|
      }}
        {{#accordion-list-item
           title=(t "clusterTemplateQuestions.label")
           detail=(t "clusterTemplateQuestions.detail")
           expandAll=al.expandAll
           expand=(action expandFn)
           expandOnInit=true
        }}
          <CruClusterTemplateQuestions
            @addQuestion={{addQuestion}}
            @removeQuestion={{removeQuestion}}
            @allQuestions={{clusterTemplateQuestions}}
            @applyClusterTemplate={{applyClusterTemplate}}
            @clusterTemplateCreate={{clusterTemplateCreate}}
          />
        {{/accordion-list-item}}
      {{/accordion-list}}
    {{/if}}
  {{/if}}

  {{top-errors errors=allErrors}}

  {{#if (or (and notView (eq step 1)) (and isEdit (eq step 2)))}}
    {{save-cancel
      createLabel=(or overrideCreateLabel (if isCustom "saveCancel.next" "saveCancel.create"))
      editing=isEdit
      save=(action "driverSave")
      cancel=(action "close")
      saveDisabled=canSave
    }}
  {{else}}
    <div class="footer-actions">
      <button {{action "close"}} class="btn bg-primary">
        {{t "clusterNew.rke.done"}}
      </button>
    </div>
  {{/if}}
{{/if}}

<input
  type="file"
  accept="{{actualAccept}}"
  class="hide"
>
