Skip to content
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

Switch from using teams backend to nais api #199

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.canary-deployer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder

RUN apk add --no-cache git make curl
ENV GOOS=linux
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder

RUN apk add --no-cache git make curl
ENV GOOS=linux
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.deploy-action
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder

RUN apk add --no-cache git make curl
ENV GOOS=linux
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.deployd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder

RUN apk add --no-cache git make curl
ENV GOOS=linux
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.hookd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder

RUN apk add --no-cache git make curl
ENV GOOS=linux
Expand Down
11 changes: 5 additions & 6 deletions charts/hookd/Feature.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- allOf:
- teams-backend
- nais-api
environmentKinds:
- management
values:
Expand Down Expand Up @@ -61,13 +61,12 @@ values:
displayName: Ingress URL
computed:
template: '"{{ subdomain . "deploy" }}"'
teamsAPIKey:
displayName: "teams api key"
computed:
template: "{{.Management.hookd_teams_api_key | quote}}"
description: "API key used for teams integration"
frontendPreSharedKey:
displayName: "console-backend pre-shared key"
computed:
template: "{{.Management.hookd_frontend_pre_shared_key | quote}}"
description: "The pre-shared key used to authenticate the console-backend"
naisAPI.insecure:
displayName: Insecure connection to NAIS API
config:
type: bool
3 changes: 1 addition & 2 deletions charts/hookd/templates/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,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:
{{- include "hookd.selectorLabels" . | nindent 6 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/hookd/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ stringData:
HOOKD_LOG_LINK_FORMATTER: "{{ .Values.logLinkFormatter }}"
HOOKD_OAUTH_ENABLED: "true"
HOOKD_PROVISION_KEY: "{{ .Values.provisionKey }}"
HOOKD_TEAMS_API_KEY: "{{ .Values.teamsAPIKey }}"
HOOKD_TEAMS_URL: "{{ .Values.teamsURL }}"
HOOKD_NAIS_API_TARGET: "{{ .Values.naisAPI.target }}"
HOOKD_NAIS_API_INSECURE: "{{ .Values.naisAPI.insecure }}"
5 changes: 3 additions & 2 deletions charts/hookd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ frontendPreSharedKey: # mapped by fasit

imagePullSecrets: []

teamsAPIKey: # mapped by fasit
teamsURL: "http://teams-backend/query"
naisAPI:
target: "nais-api:3001"
insecure: "false"
9 changes: 6 additions & 3 deletions cmd/hookd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"github.com/nais/deploy/pkg/hookd/logproxy"
"github.com/nais/deploy/pkg/hookd/middleware"
"github.com/nais/deploy/pkg/logging"
"github.com/nais/deploy/pkg/naisapi"
"github.com/nais/deploy/pkg/pb"
"github.com/nais/deploy/pkg/teams"
"github.com/nais/deploy/pkg/version"
)

Expand Down Expand Up @@ -179,8 +179,11 @@ func startGrpcServer(cfg config.Config, db database.DeploymentStore, apikeys dat
return nil, nil, fmt.Errorf("unable to set up github validator: %w", err)
}

teamsClient := teams.New(cfg.TeamsURL, cfg.TeamsAPIKey)
authInterceptor := auth_interceptor.NewServerInterceptor(apikeys, ghValidator, teamsClient)
apiClient, err := naisapi.New(cfg.NaisAPITarget, cfg.NaisAPIInsecure)
if err != nil {
return nil, nil, fmt.Errorf("unable to set up nais-api client: %w", err)
}
authInterceptor := auth_interceptor.NewServerInterceptor(apikeys, ghValidator, apiClient)

interceptor.Add(pb.Deploy_ServiceDesc.ServiceName, authInterceptor)
log.Infof("Authentication enabled for deployment requests")
Expand Down
112 changes: 59 additions & 53 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
module github.com/nais/deploy

go 1.21
go 1.22

toolchain go1.22.0

require (
github.com/aymerick/raymond v2.0.2+incompatible
github.com/ghodss/yaml v1.0.0
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/render v1.0.3
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.1
github.com/google/uuid v1.6.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0
github.com/jackc/pgx/v4 v4.18.1
github.com/lib/pq v1.10.9
github.com/nais/liberator v0.0.0-20230807082713-b3572ceadac6
github.com/prometheus/client_golang v1.16.0
github.com/nais/liberator v0.0.0-20240208114703-a4ddc1dd2ffa
github.com/prometheus/client_golang v1.18.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.14.0 // indirect
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
golang.org/x/oauth2 v0.16.0 // indirect
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.32.0
gopkg.in/sakura-internet/go-rison.v3 v3.2.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.27.4
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.27.4
sigs.k8s.io/controller-runtime v0.15.0
k8s.io/api v0.29.1
k8s.io/apimachinery v0.29.1
k8s.io/client-go v0.29.1
sigs.k8s.io/controller-runtime v0.17.0
)

require (
github.com/google/go-github/v41 v41.0.0
github.com/lestrrat-go/jwx/v2 v2.0.19
github.com/vektra/mockery/v2 v2.38.0
github.com/nais/api v0.0.0-20240221092250-0f2590f0befc
github.com/vektra/mockery/v2 v2.40.1
golang.org/x/vuln v1.0.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
honnef.co/go/tools v0.4.6
Expand All @@ -44,21 +47,21 @@ require (
github.com/ajg/form v1.5.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chigopher/pathlib v0.15.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/chigopher/pathlib v0.19.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.9 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0 // indirect
Expand All @@ -72,7 +75,7 @@ require (
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/puddle v1.3.0 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
Expand All @@ -86,8 +89,7 @@ require (
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -96,40 +98,44 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rs/zerolog v1.30.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
golang.org/x/exp/typeparams v0.0.0-20230213192124-5e25df0256eb // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.4 // indirect
k8s.io/component-base v0.27.4 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
k8s.io/apiextensions-apiserver v0.29.1 // indirect
k8s.io/component-base v0.29.1 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240126223410-2919ad4fcfec // indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading
Loading