diff --git a/charts/nais-verification/Feature.yaml b/charts/nais-verification/Feature.yaml index 31b856a..b9cbc61 100644 --- a/charts/nais-verification/Feature.yaml +++ b/charts/nais-verification/Feature.yaml @@ -8,9 +8,6 @@ values: naisTeams.apiToken: computed: template: '"{{.Management.nais_verification_teams_api_key}}"' - naisTeams.apiUrl: - computed: - template: http://teams-backend/query image.pullPolicy: config: type: string diff --git a/charts/nais-verification/templates/netpol.yaml b/charts/nais-verification/templates/netpol.yaml index 4ec9de0..204c315 100644 --- a/charts/nais-verification/templates/netpol.yaml +++ b/charts/nais-verification/templates/netpol.yaml @@ -10,8 +10,7 @@ spec: kubernetes.io/metadata.name: nais-system podSelector: matchLabels: - app.kubernetes.io/instance: teams-backend - app.kubernetes.io/name: teams-backend + app: nais-api podSelector: matchLabels: app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/nais-verification/values.yaml b/charts/nais-verification/values.yaml index 29de245..f794433 100644 --- a/charts/nais-verification/values.yaml +++ b/charts/nais-verification/values.yaml @@ -12,5 +12,5 @@ secretName: nais-verification-deploy-key slackChannel: "#nais" naisTeams: - apiUrl: http://teams-backend # Mapped in fasit + apiUrl: http://nais-api/query apiToken: "" # Mapped in fasit diff --git a/nais_verification/deploy_key.py b/nais_verification/deploy_key.py index 8778641..8c8b5e2 100644 --- a/nais_verification/deploy_key.py +++ b/nais_verification/deploy_key.py @@ -54,7 +54,11 @@ def _get_team_deploy_key(settings: Settings) -> str: query = gql( """ query getDeployKey($slug: Slug!) { - deployKey(slug: $slug) + team(slug: $slug) { + deployKey { + key + } + } } """ ) @@ -65,8 +69,11 @@ def _get_team_deploy_key(settings: Settings) -> str: try: result = client.execute(query, variable_values=params) LOG.debug("result from getDeployKey query: %s", pformat(result)) - deploy_key = result.get("deployKey", "") + deploy_key = result["team"]["deployKey"]["key"] return deploy_key + except KeyError as e: + LOG.error("No deploy key returned:\n\t%s", _format_errors(e)) + raise RuntimeError("Failed to get deploy key") from e except TransportQueryError as e: LOG.error("Failed to get deploy key:\n\t%s", _format_errors(e)) raise RuntimeError("Failed to get deploy key") from e