From 079865d2ad899cc6a05f1ffd53329fe86cb4ff47 Mon Sep 17 00:00:00 2001 From: akochari Date: Tue, 19 Sep 2023 17:00:23 +0200 Subject: [PATCH 01/16] add new app and project limits --- .../templates/studio-settings-configmap.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 1e3c70d..3db330a 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -347,14 +347,18 @@ data: # Defines how many apps a user is allowed to create within one project APPS_PER_PROJECT_LIMIT = { - "vscode": 1, - "volumeK8s": 5, - "pytorch-serve": 1, - "tensorflow-serve": 1, - "mlflow-serve": 1, + "dashapp": 10, + "shinyapp": 10, + "standardapp": 10, + "pytorch-serve": 10, + "tensorflow-serve": 10, + "mlflow-serve": 10, + "rstudio": 3, + "vscode": 3, + "jupyter-lab": 3, "mlflow": 1, + "volumeK8s": 1, "minio": 1, - "jupyter-lab": 1, "mongo-express": 1, "reducer": 2, "docker-registry": 1, @@ -362,7 +366,7 @@ data: "mongodb": 1, } - PROJECTS_PER_USER_LIMIT = 3 + PROJECTS_PER_USER_LIMIT = 5 STUDIO_ACCESSMODE = os.environ.get("STUDIO_ACCESSMODE", "") {{ if .Values.studio.enable_project_extra_settings }} From fa03347f15cefe6898d967f07253cd2454c88759 Mon Sep 17 00:00:00 2001 From: sandstromviktor Date: Thu, 21 Sep 2023 15:21:33 +0200 Subject: [PATCH 02/16] changed standard app -> custom app --- scaleout/stackn/templates/studio-settings-configmap.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 3db330a..786218c 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -349,7 +349,7 @@ data: APPS_PER_PROJECT_LIMIT = { "dashapp": 10, "shinyapp": 10, - "standardapp": 10, + "customapp": 10, "pytorch-serve": 10, "tensorflow-serve": 10, "mlflow-serve": 10, @@ -376,4 +376,4 @@ data: {{ end }} {{ if .Values.studio.disabledAppInstanceFields.enabled }} DISABLED_APP_INSTANCE_FIELDS = [{{- range .Values.studio.disabledAppInstanceFields.fields }}{{. | quote }},{{- end }}] - {{- end }} \ No newline at end of file + {{- end }} From 0ee27ee359d47e2c5edd8b37d986eb0d123f6990 Mon Sep 17 00:00:00 2001 From: sandstromviktor Date: Fri, 29 Sep 2023 10:26:31 +0200 Subject: [PATCH 03/16] removed docker registry from configmap --- scaleout/stackn/templates/studio-settings-configmap.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 786218c..cb64f3a 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -361,7 +361,6 @@ data: "minio": 1, "mongo-express": 1, "reducer": 2, - "docker-registry": 1, "combiner": 2, "mongodb": 1, } From c501d5fa163abaf6d26e4a82ab81b6fc35400165 Mon Sep 17 00:00:00 2001 From: sandstromviktor Date: Tue, 3 Oct 2023 14:59:25 +0200 Subject: [PATCH 04/16] added service account to deployment --- scaleout/stackn/templates/studio-deployment.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-deployment.yaml b/scaleout/stackn/templates/studio-deployment.yaml index f71cf49..bd08c8b 100644 --- a/scaleout/stackn/templates/studio-deployment.yaml +++ b/scaleout/stackn/templates/studio-deployment.yaml @@ -24,7 +24,8 @@ spec: allow-api-access: "true" networking/allow-internet-egress: "true" spec: - automountServiceAccountToken: false + automountServiceAccountToken: true + serviceAccountName: {{ include "common.names.fullname" .}} securityContext: fsGroup: {{ .Values.studio.securityContext.fsGroup }} initContainers: From ecb36c2b6aa8cd6d4f5e9f9734e235f5afaad4a1 Mon Sep 17 00:00:00 2001 From: akochari Date: Thu, 5 Oct 2023 13:57:59 +0200 Subject: [PATCH 05/16] new app limits to match the change in main repo with PR 77 --- .../templates/studio-settings-configmap.yaml | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index cb64f3a..91c389e 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -347,22 +347,24 @@ data: # Defines how many apps a user is allowed to create within one project APPS_PER_PROJECT_LIMIT = { - "dashapp": 10, - "shinyapp": 10, - "customapp": 10, - "pytorch-serve": 10, - "tensorflow-serve": 10, - "mlflow-serve": 10, - "rstudio": 3, - "vscode": 3, - "jupyter-lab": 3, - "mlflow": 1, - "volumeK8s": 1, - "minio": 1, - "mongo-express": 1, - "reducer": 2, - "combiner": 2, - "mongodb": 1, + "dashapp": 10, + "shinyapp": 10, + "shinyproxyapp": 10, + "customapp": 10, + "pytorch-serve": 10, + "tensorflow-serve": 10, + "mlflow-serve": 10, + "rstudio": 3, + "vscode": 3, + "jupyter-lab": 3, + "mlflow": 1, + "volumeK8s": 0, + "minio": 0, + "mongo-express": 0, + "reducer": 0, + "combiner": 0, + "mongodb": 0, + "netpolicy": 0, } PROJECTS_PER_USER_LIMIT = 5 From 107827e6b2e6d5088d5866e064354d1153f4c22c Mon Sep 17 00:00:00 2001 From: Hamza Imran Saeed Date: Tue, 10 Oct 2023 20:42:23 +0200 Subject: [PATCH 06/16] add role for shinyproxy delete job --- scaleout/stackn/templates/role.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scaleout/stackn/templates/role.yaml b/scaleout/stackn/templates/role.yaml index 4088f6c..ceaa1a2 100644 --- a/scaleout/stackn/templates/role.yaml +++ b/scaleout/stackn/templates/role.yaml @@ -12,7 +12,7 @@ metadata: annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} rules: - - apiGroups: ["", "apps", "networking.k8s.io", "autoscaling"] + - apiGroups: ["", "apps", "networking.k8s.io", "autoscaling","batch"] resources: ["*"] verbs: ["*"] -{{- end }} \ No newline at end of file +{{- end }} From 2c2dd5b22fbb734dbd4786cd8913fd9f83dea784 Mon Sep 17 00:00:00 2001 From: Hamza Imran Saeed Date: Tue, 10 Oct 2023 20:43:00 +0200 Subject: [PATCH 07/16] add policy for shinyproxy and remove cidr to fix cilium issue --- .../stackn/templates/network-policies.yaml | 56 +++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/scaleout/stackn/templates/network-policies.yaml b/scaleout/stackn/templates/network-policies.yaml index 74e6002..b550f89 100644 --- a/scaleout/stackn/templates/network-policies.yaml +++ b/scaleout/stackn/templates/network-policies.yaml @@ -48,10 +48,7 @@ spec: policyTypes: - Egress egress: - - to: - - ipBlock: - cidr: {{ .Values.networkPolicy.kubernetes.cidr }} - ports: + - ports: - protocol: TCP port: {{ .Values.networkPolicy.kubernetes.port }} --- @@ -285,4 +282,53 @@ spec: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingress_controller_namespace }} # <- This should allow traffic from ingress namespace -{{- end }} \ No newline at end of file +--- +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + namespace: {{ .Values.namespace | default "default" }} + name: allow-pod-to-shinyproxy +spec: + podSelector: + matchLabels: + app: shinyproxy-deployment + policyTypes: + - Egress + - Ingress + egress: + - to: + - podSelector: + matchExpressions: + - key: sp.instance + operator: Exists + ingress: + - from: + - podSelector: + matchExpressions: + - key: sp.instance + operator: Exists +--- +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + namespace: {{ .Values.namespace | default "default" }} + name: allow-shinyproxy-to-pod +spec: + podSelector: + matchExpressions: + - key: sp.instance + operator: Exists + policyTypes: + - Egress + - Ingress + egress: + - to: + - podSelector: + matchLabels: + app: shinyproxy-deployment + ingress: + - from: + - podSelector: + matchLabels: + app: shinyproxy-deployment +{{- end }} From 154e7052152ad78b0d75b560726d31968644c17f Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 30 Oct 2023 11:55:27 +0100 Subject: [PATCH 08/16] add static-files-directory --- scaleout/stackn/templates/studio-settings-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 91c389e..2d5e8ac 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -167,7 +167,7 @@ data: STATIC_URL = '/static/' #Use in production and together with Nginx STATIC_ROOT = os.path.join(BASE_DIR, 'static/') - #STATICFILES_DIRS = ( os.path.join('static'), ) + STATICFILES_DIRS = ( os.path.join('static'), ) TEMPLATE_LOADERS = ( From b7874a4f9017267868d8aca62f06efe507898652 Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 30 Oct 2023 12:07:33 +0100 Subject: [PATCH 09/16] add changes for new signup --- .../stackn/templates/studio-settings-configmap.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 2d5e8ac..5d77869 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -167,7 +167,7 @@ data: STATIC_URL = '/static/' #Use in production and together with Nginx STATIC_ROOT = os.path.join(BASE_DIR, 'static/') - STATICFILES_DIRS = ( os.path.join('static'), ) + STATICFILES_DIRS = os.path.join(BASE_DIR, 'static/') TEMPLATE_LOADERS = ( @@ -336,7 +336,8 @@ data: 'models': 'studio.migrations.models', 'monitor': 'studio.migrations.monitor', 'portal': 'studio.migrations.portal', - 'projects': 'studio.migrations.projects' + 'projects': 'studio.migrations.projects', + "common": "common.migrations", } {{ if .Values.studio.custom_migrations.enabled }} @@ -378,3 +379,9 @@ data: {{ if .Values.studio.disabledAppInstanceFields.enabled }} DISABLED_APP_INSTANCE_FIELDS = [{{- range .Values.studio.disabledAppInstanceFields.fields }}{{. | quote }},{{- end }}] {{- end }} + # This was added in SS-507. + # This setting is for django-guardian. + # We had to set it because AnonymousUser was not working properly. + # Specifically, apps.tests.test_user_has_no_access was failing. + # Also anonymous access to pages was not working. + ANONYMOUS_USER_NAME = None From 22a83eb3c265a3a3bb9fce45bd369a1d65417b7a Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 30 Oct 2023 12:11:48 +0100 Subject: [PATCH 10/16] fix static file dirs path --- scaleout/stackn/templates/studio-settings-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 5d77869..ccda775 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -167,7 +167,7 @@ data: STATIC_URL = '/static/' #Use in production and together with Nginx STATIC_ROOT = os.path.join(BASE_DIR, 'static/') - STATICFILES_DIRS = os.path.join(BASE_DIR, 'static/') + STATICFILES_DIRS = os.path.join(BASE_DIR, 'static') TEMPLATE_LOADERS = ( From 16bfce6305b8df0af51a333d68ed9b41a4b71779 Mon Sep 17 00:00:00 2001 From: sandstromviktor Date: Mon, 30 Oct 2023 12:55:17 +0100 Subject: [PATCH 11/16] hotfix/update settings configmap to match stackn-repo setting.py file --- scaleout/stackn/templates/studio-settings-configmap.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index ccda775..ca2fb75 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -167,8 +167,9 @@ data: STATIC_URL = '/static/' #Use in production and together with Nginx STATIC_ROOT = os.path.join(BASE_DIR, 'static/') - STATICFILES_DIRS = os.path.join(BASE_DIR, 'static') - + # SS-507 + # Please keep "static" files first, because common/forms.py expects it + STATICFILES_DIRS = (os.path.join(BASEDIR, "static"),) TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', From 4ab16ab6bfb75fe74ff6c46005aba4b1c5d77462 Mon Sep 17 00:00:00 2001 From: alfredeen Date: Thu, 2 Nov 2023 20:45:21 +0100 Subject: [PATCH 12/16] Added new changes for the OpenAPI REST API drf settings to the settings.py file --- scaleout/stackn/templates/studio-settings-configmap.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index ca2fb75..47b2325 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -126,9 +126,12 @@ data: REST_FRAMEWORK = { - 'DEFAULT_AUTHENTICATION_CLASSES': [ - 'rest_framework.authentication.TokenAuthentication' - ], + "DEFAULT_AUTHENTICATION_CLASSES": ["rest_framework.authentication.TokenAuthentication"], + "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.NamespaceVersioning", + "ALLOWED_VERSIONS": [None, "beta", "v1"], + "DEFAULT_VERSION": "v1", + "DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",), + "DEFAULT_PARSER_CLASSES": ("rest_framework.parsers.JSONParser",), } # Default primary key field type From eb62563325aac65be9bb6cd10a7b1881f35c3080 Mon Sep 17 00:00:00 2001 From: sandstromviktor Date: Fri, 3 Nov 2023 10:22:18 +0100 Subject: [PATCH 13/16] syncing setting with PR SS410 --- scaleout/stackn/templates/studio-settings-configmap.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index ca2fb75..e3f579d 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -101,6 +101,7 @@ data: "apps", "api", "customtags", + "news" ] + DJANGO_WIKI_APPS {{ if .Values.studio.custom_apps.enabled }} @@ -339,6 +340,7 @@ data: 'portal': 'studio.migrations.portal', 'projects': 'studio.migrations.projects', "common": "common.migrations", + "news": "news.migrations", } {{ if .Values.studio.custom_migrations.enabled }} From 14e61c675f95e61656ed436812804b8e987e5350 Mon Sep 17 00:00:00 2001 From: alfredeen Date: Wed, 8 Nov 2023 16:44:04 +0100 Subject: [PATCH 14/16] Synced setting STATICFILES_DIRS with stackn --- scaleout/stackn/templates/studio-settings-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index e410a28..b530fd3 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -173,7 +173,7 @@ data: STATIC_ROOT = os.path.join(BASE_DIR, 'static/') # SS-507 # Please keep "static" files first, because common/forms.py expects it - STATICFILES_DIRS = (os.path.join(BASEDIR, "static"),) + STATICFILES_DIRS = (os.path.join("static"),) TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', From ea0aef8e6943e11bf5a2e698f84dd21c352fe45d Mon Sep 17 00:00:00 2001 From: alfredeen Date: Wed, 8 Nov 2023 17:03:07 +0100 Subject: [PATCH 15/16] Corrected setting STATICFILES_DIRS --- scaleout/stackn/templates/studio-settings-configmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index b530fd3..808bd79 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -173,7 +173,7 @@ data: STATIC_ROOT = os.path.join(BASE_DIR, 'static/') # SS-507 # Please keep "static" files first, because common/forms.py expects it - STATICFILES_DIRS = (os.path.join("static"),) + STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),) TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', From 9cdea9fcbf049926dd555f8a8018926aa9d64e70 Mon Sep 17 00:00:00 2001 From: alfredeen Date: Wed, 8 Nov 2023 17:41:06 +0100 Subject: [PATCH 16/16] Synced STATIC_ROOT with stackn --- scaleout/stackn/templates/studio-settings-configmap.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scaleout/stackn/templates/studio-settings-configmap.yaml b/scaleout/stackn/templates/studio-settings-configmap.yaml index 808bd79..31b042e 100644 --- a/scaleout/stackn/templates/studio-settings-configmap.yaml +++ b/scaleout/stackn/templates/studio-settings-configmap.yaml @@ -170,7 +170,8 @@ data: STATIC_URL = '/static/' #Use in production and together with Nginx - STATIC_ROOT = os.path.join(BASE_DIR, 'static/') + #STATIC_ROOT = os.path.join(BASE_DIR, 'static/') + STATIC_ROOT = "" # SS-507 # Please keep "static" files first, because common/forms.py expects it STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)