diff options
author | Amit Rathi <amit.juschill@gmail.com> | 2019-03-01 15:46:52 +0300 |
---|---|---|
committer | Amit Rathi <amit.juschill@gmail.com> | 2019-03-01 15:46:52 +0300 |
commit | a8e0fcdc7755db9c8549b6d6fa40ae7052976522 (patch) | |
tree | 3ffafbf017f40f221bc721f1baf255f597987d6d | |
parent | c994484d17d6a6da929f6a52f1b64dc15c38835c (diff) |
Project whitelist for JuoyterHub deployment
-rw-r--r-- | app/models/clusters/applications/jupyter.rb | 11 | ||||
-rw-r--r-- | spec/models/clusters/applications/jupyter_spec.rb | 5 |
2 files changed, 11 insertions, 5 deletions
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb index 421a923d386..80205775b6a 100644 --- a/app/models/clusters/applications/jupyter.rb +++ b/app/models/clusters/applications/jupyter.rb @@ -3,7 +3,7 @@ module Clusters module Applications class Jupyter < ActiveRecord::Base - VERSION = 'v0.6'.freeze + VERSION = '0.9-174bbd5'.freeze self.table_name = 'clusters_applications_jupyter' @@ -75,17 +75,22 @@ module Clusters "gitlab" => { "clientId" => oauth_application.uid, "clientSecret" => oauth_application.secret, - "callbackUrl" => callback_url + "callbackUrl" => callback_url, + "gitlabProjectIdWhitelist" => [project_id] } }, "singleuser" => { "extraEnv" => { - "GITLAB_CLUSTER_ID" => cluster.id + "GITLAB_CLUSTER_ID" => cluster.id.to_s } } } end + def project_id + cluster&.project&.id + end + def gitlab_url Gitlab.config.gitlab.url end diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb index 2c22c24c498..6e58f3ad699 100644 --- a/spec/models/clusters/applications/jupyter_spec.rb +++ b/spec/models/clusters/applications/jupyter_spec.rb @@ -39,7 +39,7 @@ describe Clusters::Applications::Jupyter do it 'should be initialized with 4 arguments' do expect(subject.name).to eq('jupyter') expect(subject.chart).to eq('jupyter/jupyterhub') - expect(subject.version).to eq('v0.6') + expect(subject.version).to eq('0.9-174bbd5') expect(subject).to be_rbac expect(subject.repository).to eq('https://jupyterhub.github.io/helm-chart/') expect(subject.files).to eq(jupyter.files) @@ -57,7 +57,7 @@ describe Clusters::Applications::Jupyter do let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') } it 'should be initialized with the locked version' do - expect(subject.version).to eq('v0.6') + expect(subject.version).to eq('0.9-174bbd5') end end end @@ -77,6 +77,7 @@ describe Clusters::Applications::Jupyter do expect(values).to include('singleuser') expect(values).to match(/clientId: '?#{application.oauth_application.uid}/) expect(values).to match(/callbackUrl: '?#{application.callback_url}/) + expect(values).to include("gitlabProjectIdWhitelist:\n - #{application.cluster.project.id}") end context 'when cluster belongs to a project' do |