-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/gateway updates #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
8bd88b2
61961bb
8dde96f
4238c75
6a7d566
3dc0062
af4a92e
0ae1782
56439ab
1932760
382e4c3
cab5ceb
59ecd9f
ee02cae
3a707cc
1bccfff
ad29c79
9360472
b08d271
54b73e9
bc505ba
7ea8c0f
c8a7208
7387a1d
1ee00c5
be1d737
71b1f26
5274ec8
d8cb7fe
cc5b125
e94a771
244e206
88c9596
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,13 @@ | ||
| connexion[swagger-ui,flask,uvicorn]>=3.0.0,<4.0.0 | ||
| swagger-ui-bundle>=1.1.0 | ||
| python_dateutil>=2.9.0 | ||
| setuptools>=21.0.0 | ||
| uvicorn | ||
| # Following some unnecessary requirements to make sure they can be installed | ||
| psycopg2-binary | ||
| sqlalchemy<2.0.0 | ||
| scipy | ||
| connexion[swagger-ui] >= 2.6.0; python_version>="3.6" | ||
| # 2.3 is the last version that supports python 3.4-3.5 | ||
| connexion[swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=="3.4" | ||
| # prevent breaking dependencies from advent of connexion>=3.0 | ||
| connexion[swagger-ui] <= 2.14.2; python_version>"3.4" | ||
| # connexion requires werkzeug but connexion < 2.4.0 does not install werkzeug | ||
| # we must peg werkzeug versions below to fix connexion | ||
| # https://github.com/zalando/connexion/pull/1044 | ||
| werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4" | ||
| swagger-ui-bundle >= 0.0.2 | ||
| python_dateutil >= 2.6.0 | ||
| setuptools >= 21.0.0 | ||
| Flask == 2.1.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import connexion | ||
| from typing import Dict | ||
filippomc marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
|
||
| from typing import Tuple | ||
filippomc marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
|
||
| from typing import Union | ||
filippomc marked this conversation as resolved.
Dismissed
Show dismissed
Hide dismissed
|
||
|
|
||
| from samples.models.get_db_connect_string200_response import GetDbConnectString200Response # noqa: E501 | ||
github-code-quality[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
| from samples import util | ||
github-code-quality[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
github-code-quality[bot] marked this conversation as resolved.
Fixed
Show fixed
Hide fixed
|
||
|
|
||
|
|
||
| def get_db_connect_string(): # noqa: E501 | ||
| """Get database connection string | ||
|
|
||
| Returns the database connection string for the current application. # noqa: E501 | ||
|
|
||
|
|
||
| :rtype: Union[GetDbConnectString200Response, Tuple[GetDbConnectString200Response, int], Tuple[GetDbConnectString200Response, int, Dict[str, str]] | ||
| """ | ||
| from cloudharness.applications import get_current_configuration | ||
| config = get_current_configuration() | ||
| return config.get_db_connection_string() | ||
filippomc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| from typing import List | ||
|
|
||
|
|
||
| def info_from_bearerAuth(token): | ||
| """ | ||
| Check and retrieve authentication information from custom bearer token. | ||
| Returned value will be passed in 'token_info' parameter of your operation function, if there is one. | ||
| 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. | ||
|
|
||
| :param token Token provided by Authorization header | ||
| :type token: str | ||
| :return: Decoded token information or None if token is invalid | ||
| :rtype: dict | None | ||
| """ | ||
| return {'uid': 'user_id'} | ||
|
|
||
|
|
||
| def info_from_cookieAuth(api_key, required_scopes): | ||
| """ | ||
| Check and retrieve authentication information from api_key. | ||
| Returned value will be passed in 'token_info' parameter of your operation function, if there is one. | ||
| 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. | ||
|
|
||
| :param api_key API key provided by Authorization header | ||
| :type api_key: str | ||
| :param required_scopes Always None. Used for other authentication method | ||
| :type required_scopes: None | ||
| :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API | ||
| :rtype: dict | None | ||
| """ | ||
| return {'uid': 'user_id'} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| from datetime import date, datetime # noqa: F401 | ||
|
|
||
| from typing import List, Dict # noqa: F401 | ||
|
|
||
| from samples.models.base_model import Model | ||
| from samples import util | ||
|
|
||
|
|
||
| class GetDbConnectString200Response(Model): | ||
| """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
|
||
| Do not edit the class manually. | ||
| """ | ||
|
|
||
| def __init__(self, connect_string=None): # noqa: E501 | ||
| """GetDbConnectString200Response - a model defined in OpenAPI | ||
|
|
||
| :param connect_string: The connect_string of this GetDbConnectString200Response. # noqa: E501 | ||
| :type connect_string: str | ||
| """ | ||
| self.openapi_types = { | ||
| 'connect_string': str | ||
| } | ||
|
|
||
| self.attribute_map = { | ||
| 'connect_string': 'connect_string' | ||
| } | ||
|
|
||
| self._connect_string = connect_string | ||
|
|
||
| @classmethod | ||
| def from_dict(cls, dikt) -> 'GetDbConnectString200Response': | ||
| """Returns the dict as a model | ||
|
|
||
| :param dikt: A dict. | ||
| :type: dict | ||
| :return: The get_db_connect_string_200_response of this GetDbConnectString200Response. # noqa: E501 | ||
| :rtype: GetDbConnectString200Response | ||
| """ | ||
| return util.deserialize_model(dikt, cls) | ||
|
|
||
| @property | ||
| def connect_string(self) -> str: | ||
| """Gets the connect_string of this GetDbConnectString200Response. | ||
|
|
||
|
|
||
| :return: The connect_string of this GetDbConnectString200Response. | ||
| :rtype: str | ||
| """ | ||
| return self._connect_string | ||
|
|
||
| @connect_string.setter | ||
| def connect_string(self, connect_string: str): | ||
| """Sets the connect_string of this GetDbConnectString200Response. | ||
|
|
||
|
|
||
| :param connect_string: The connect_string of this GetDbConnectString200Response. | ||
| :type connect_string: str | ||
| """ | ||
|
|
||
| self._connect_string = connect_string |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ data: | |
| forbidden-page: /templates/access-denied.html.tmpl | ||
| enable-default-deny: {{ $noWildcards }} | ||
| listen: 0.0.0.0:8080 | ||
| enable-encrypted-token: false | ||
| enable-refresh-tokens: true | ||
| server-write-timeout: {{ .app.harness.proxy.timeout.send | default .root.Values.proxy.timeout.send | default 180 }}s | ||
| upstream-timeout: {{ .app.harness.proxy.timeout.read | default .root.Values.proxy.timeout.read | default 180 }}s | ||
|
|
@@ -38,7 +39,6 @@ data: | |
| tls-cert: | ||
| tls-private-key: | ||
| redirection-url: {{ ternary "https" "http" $tls }}://{{ .subdomain }}.{{ .root.Values.domain }} | ||
| encryption-key: AgXa7xRcoClDEU0ZDSH4X0XhL5Qy2Z2j | ||
| upstream-url: http://{{ .app.harness.service.name }}.{{ .app.namespace | default .root.Release.Namespace }}:{{ .app.harness.service.port | default 80}} | ||
| {{ if .app.harness.secured }} | ||
| {{ with .app.harness.uri_role_mapping }} | ||
|
|
@@ -100,6 +100,34 @@ data: | |
| </body> | ||
| </html> | ||
| --- | ||
| {{- $gkSecretName := printf "%s-gk" .subdomain }} | ||
| {{- $existingGkSecret := (lookup "v1" "Secret" .root.Values.namespace $gkSecretName) }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ $gkSecretName }} | ||
| namespace: {{ .root.Values.namespace }} | ||
| labels: | ||
| app: {{ $gkSecretName }} | ||
| type: Opaque | ||
| stringData: | ||
| updated: {{ now | quote }} | ||
| {{- if .root.Values.proxy.gatekeeper.secret }} | ||
| encryption-key: {{ .root.Values.proxy.gatekeeper.secret | quote }} | ||
| {{- else }} | ||
| {{- $hasExisting := false }} | ||
| {{- if $existingGkSecret }} | ||
| {{- if eq (typeOf $existingGkSecret.data) (typeOf dict) }} | ||
| {{- if hasKey $existingGkSecret.data "encryption-key" }} | ||
| {{- $hasExisting = true }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if not $hasExisting }} | ||
| encryption-key: {{ randAlphaNum 32 | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
Comment on lines
+103
to
+129
|
||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
|
|
@@ -135,7 +163,7 @@ spec: | |
| {{ include "deploy_utils.etcHosts" .root | indent 6 }} | ||
| containers: | ||
| - name: {{ .app.harness.service.name | quote }} | ||
| image: {{ .app.harness.proxy.gatekeeper.image | default .root.Values.proxy.gatekeeper.image | default "quay.io/gogatekeeper/gatekeeper:2.14.3" }} | ||
| image: {{ .app.harness.proxy.gatekeeper.image | default .root.Values.proxy.gatekeeper.image | default "quay.io/gogatekeeper/gatekeeper:4.6.0" }} | ||
| imagePullPolicy: IfNotPresent | ||
| {{ if .root.Values.local }} | ||
| securityContext: | ||
|
|
@@ -147,6 +175,11 @@ spec: | |
| value: /opt/proxy.yml | ||
| - name: PROXY_ENABLE_METRICS | ||
| value: "true" | ||
| - name: PROXY_ENCRYPTION_KEY | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: "{{ .subdomain }}-gk" | ||
| key: encryption-key | ||
| volumeMounts: | ||
| - name: "{{ .subdomain }}-gk-proxy-config" | ||
| mountPath: /opt/proxy.yml | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,5 +12,5 @@ spec: | |
| solvers: | ||
| - http01: | ||
| ingress: | ||
| class: nginx | ||
| class: {{ .Values.ingress.ingressClass }} | ||
| {{ end }} | ||
Uh oh!
There was an error while loading. Please reload this page.