diff options
author | Amit Rathi <amit.juschill@gmail.com> | 2018-12-07 21:40:03 +0530 |
---|---|---|
committer | Amit Rathi <amit.juschill@gmail.com> | 2018-12-07 21:40:03 +0530 |
commit | 1cdcf4026529a26480d801e2b8417ecaba627b9e (patch) | |
tree | a9136a106091d5beba8fd76ea4b0b8ce05a07008 /app | |
parent | a445aa0a9267f191fab1c46d438b42fbec549da5 (diff) | |
download | gitlab-ce-1cdcf4026529a26480d801e2b8417ecaba627b9e.tar.gz |
Allows user to override default issuer email for cert manager
Diffstat (limited to 'app')
7 files changed, 71 insertions, 27 deletions
diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index a37cb4def28..28a91f63bb5 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -84,6 +84,9 @@ export default { ingressExternalIp() { return this.applications.ingress.externalIp; }, + certManagerInstalled() { + return this.applications.cert_manager.status === APPLICATION_STATUS.INSTALLED; + }, ingressDescription() { const extraCostParagraph = sprintf( _.escape( @@ -130,9 +133,9 @@ export default { return sprintf( _.escape( s__( - `ClusterIntegration|cert-manager is a native Kubernetes certificate management controller that helps with issuing certificates. - Installing cert-manager on your cluster will issue a certificate by %{letsEncrypt} and ensure that certificates - are valid and up to date.`, + `ClusterIntegration|Cert-Manager is a native Kubernetes certificate management controller that helps with issuing certificates. + Installing Cert-Manager on your cluster will issue a certificate by %{letsEncrypt} and ensure that certificates + are valid and up-to-date.`, ), ), { @@ -259,6 +262,16 @@ export default { </span> </div> <input v-else type="text" class="form-control js-ip-address" readonly value="?" /> + <p class="form-text text-muted"> + {{ + s__(`ClusterIntegration|Point a wildcard DNS to this + generated IP address in order to access + your application after it has been deployed.`) + }} + <a :href="ingressDnsHelpPath" target="_blank" rel="noopener noreferrer"> + {{ __('More information') }} + </a> + </p> </div> <p v-if="!ingressExternalIp" class="settings-message js-no-ip-message"> @@ -272,17 +285,6 @@ export default { {{ __('More information') }} </a> </p> - - <p> - {{ - s__(`ClusterIntegration|Point a wildcard DNS to this - generated IP address in order to access - your application after it has been deployed.`) - }} - <a :href="ingressDnsHelpPath" target="_blank" rel="noopener noreferrer"> - {{ __('More information') }} - </a> - </p> </template> <div v-html="ingressDescription"></div> </div> @@ -295,11 +297,42 @@ export default { :status-reason="applications.cert_manager.statusReason" :request-status="applications.cert_manager.requestStatus" :request-reason="applications.cert_manager.requestReason" + :install-application-request-params="{ email: applications.cert_manager.email }" :disabled="!helmInstalled" class="hide-bottom-border rounded-bottom" title-link="https://cert-manager.readthedocs.io/en/latest/#" > - <div slot="description" v-html="certManagerDescription"></div> + <template> + <div slot="description"> + <p v-html="certManagerDescription"></p> + <div class="form-group"> + <label for="cert-manager-issuer-email"> + {{ s__('ClusterIntegration|Issuer Email') }} + </label> + <div class="input-group"> + <input + v-model="applications.cert_manager.email" + :readonly="certManagerInstalled" + type="text" + class="form-control js-email" + /> + </div> + <p class="form-text text-muted"> + {{ + s__(`ClusterIntegration|Issuers represent a certificate authority. + You must provide an email address for your Issuer. `) + }} + <a + href="http://docs.cert-manager.io/en/latest/reference/issuers.html?highlight=email" + target="_blank" + rel="noopener noreferrer" + > + {{ __('More information') }} + </a> + </p> + </div> + </div> + </template> </application-row> <application-row v-if="isProjectCluster" @@ -382,16 +415,17 @@ export default { /> </span> </div> + + <p v-if="ingressInstalled" class="form-text text-muted"> + {{ + s__(`ClusterIntegration|Replace this with your own hostname if you want. + If you do so, point hostname to Ingress IP Address from above.`) + }} + <a :href="ingressDnsHelpPath" target="_blank" rel="noopener noreferrer"> + {{ __('More information') }} + </a> + </p> </div> - <p v-if="ingressInstalled"> - {{ - s__(`ClusterIntegration|Replace this with your own hostname if you want. - If you do so, point hostname to Ingress IP Address from above.`) - }} - <a :href="ingressDnsHelpPath" target="_blank" rel="noopener noreferrer"> - {{ __('More information') }} - </a> - </p> </template> </div> </application-row> diff --git a/app/assets/javascripts/clusters/constants.js b/app/assets/javascripts/clusters/constants.js index 15cf4a56138..e31afadf186 100644 --- a/app/assets/javascripts/clusters/constants.js +++ b/app/assets/javascripts/clusters/constants.js @@ -24,3 +24,4 @@ export const REQUEST_FAILURE = 'request-failure'; export const INGRESS = 'ingress'; export const JUPYTER = 'jupyter'; export const KNATIVE = 'knative'; +export const CERT_MANAGER = 'cert_manager'; diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 2d69da8eaec..c750daab112 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -1,5 +1,5 @@ import { s__ } from '../../locale'; -import { INGRESS, JUPYTER, KNATIVE } from '../constants'; +import { INGRESS, JUPYTER, KNATIVE, CERT_MANAGER } from '../constants'; export default class ClusterStore { constructor() { @@ -30,6 +30,7 @@ export default class ClusterStore { statusReason: null, requestStatus: null, requestReason: null, + email: null, }, runner: { title: s__('ClusterIntegration|GitLab Runner'), @@ -103,6 +104,9 @@ export default class ClusterStore { if (appId === INGRESS) { this.state.applications.ingress.externalIp = serverAppEntry.external_ip; + } else if (appId === CERT_MANAGER) { + this.state.applications.cert_manager.email = + this.state.applications.cert_manager.email || serverAppEntry.email; } else if (appId === JUPYTER) { this.state.applications.jupyter.hostname = serverAppEntry.hostname || diff --git a/app/controllers/clusters/applications_controller.rb b/app/controllers/clusters/applications_controller.rb index 250f42f3096..c4e7fc950f9 100644 --- a/app/controllers/clusters/applications_controller.rb +++ b/app/controllers/clusters/applications_controller.rb @@ -23,6 +23,6 @@ class Clusters::ApplicationsController < Clusters::BaseController end def create_cluster_application_params - params.permit(:application, :hostname) + params.permit(:application, :hostname, :email) end end diff --git a/app/models/clusters/applications/cert_manager.rb b/app/models/clusters/applications/cert_manager.rb index 077e2bda143..74ef7c7e145 100644 --- a/app/models/clusters/applications/cert_manager.rb +++ b/app/models/clusters/applications/cert_manager.rb @@ -14,6 +14,10 @@ module Clusters default_value_for :version, VERSION + default_value_for :email do |cert_manager| + cert_manager.cluster&.user&.email + end + validates :email, presence: true def chart diff --git a/app/serializers/cluster_application_entity.rb b/app/serializers/cluster_application_entity.rb index 2bd17e58086..7b1a0be75ca 100644 --- a/app/serializers/cluster_application_entity.rb +++ b/app/serializers/cluster_application_entity.rb @@ -6,4 +6,5 @@ class ClusterApplicationEntity < Grape::Entity expose :status_reason expose :external_ip, if: -> (e, _) { e.respond_to?(:external_ip) } expose :hostname, if: -> (e, _) { e.respond_to?(:hostname) } + expose :email, if: -> (e, _) { e.respond_to?(:email) } end diff --git a/app/services/clusters/applications/create_service.rb b/app/services/clusters/applications/create_service.rb index a89772e82dc..92c2c1b9834 100644 --- a/app/services/clusters/applications/create_service.rb +++ b/app/services/clusters/applications/create_service.rb @@ -20,7 +20,7 @@ module Clusters end if application.has_attribute?(:email) - application.email = current_user.email + application.email = params[:email] end if application.respond_to?(:oauth_application) |