Skip to content

Commit

Permalink
step 1: move to OSS, update imports
Browse files Browse the repository at this point in the history
Signed-off-by: Sarah Funkhouser <[email protected]>
  • Loading branch information
sfunkhouser committed Sep 30, 2023
1 parent 252025c commit 2f6f253
Show file tree
Hide file tree
Showing 21 changed files with 123 additions and 116 deletions.
2 changes: 0 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ WORKDIR /app
# Setup dependencies to auth inside docker
ARG ACTIONS_BOT_GITHUB_PAT
ENV ACTIONS_BOT_GITHUB_PAT=${ACTIONS_BOT_GITHUB_PAT}
RUN git config --global url."https://${ACTIONS_BOT_GITHUB_PAT}:[email protected]/equinixmetal".insteadOf "https://github.com/equinixmetal"
ENV GOPRIVATE=github.com/equinixmetal/*,go.equinixmetal.net

# Retrieve application dependencies using go modules.
# Allows container builds to reuse downloaded dependencies.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ accordingly in Okta.

`gov-okta-addon` subscribes to the Governor event stream where change events are published. The events published
by Governor contain the group and/or user id that changed and the type of action. Events are published on NATS subjects
dedicated to the resource type ie. `equinixmetal.governor.events.groups` for group events. When `gov-okta-addon` receives
dedicated to the resource type ie. `governor.events.groups` for group events. When `gov-okta-addon` receives
an event, it reacts by requesting information from Governor about the included resource IDs and making the required
changes in Okta.

Expand Down Expand Up @@ -62,7 +62,7 @@ be removed from the group. The groups and users must already exist in governor o

### Prereq to running locally with governor-api devcontainer

Follow the directions [here](https://github.com/equinixmetal/governor/blob/main/README.md#running-governor-locally) for starting the governor-api devcontainer.
Follow the directions [here](https://github.com/metal-toolbox/governor-api#running-governor-api-locally) for starting the governor-api devcontainer.

The **first time** you'll need to create a local hydra client for `gov-okta-addon-governor` and copy the nats creds file. After that you can just export the env variables.

Expand Down Expand Up @@ -102,7 +102,7 @@ Export the following in the terminal where you will run gov-okta-addon:
```sh
export GOA_NATS_URL="nats://127.0.0.1:4222"
export GOA_OKTA_NOCACHE=true
export GOA_OKTA_URL="https://equinixmetal.oktapreview.com"
export GOA_OKTA_URL="https://example.oktapreview.com"
export GOA_GOVERNOR_URL="http://127.0.0.1:3001"
export GOA_GOVERNOR_AUDIENCE="http://api:3001/"
export GOA_GOVERNOR_TOKEN_URL="http://127.0.0.1:4444/oauth2/token"
Expand Down
14 changes: 7 additions & 7 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import (
"time"

"github.com/equinixmetal/addonx/natslock"
"github.com/equinixmetal/gov-okta-addon/internal/okta"
"github.com/equinixmetal/gov-okta-addon/internal/reconciler"
"github.com/equinixmetal/gov-okta-addon/internal/srv"
"github.com/metal-toolbox/auditevent"
audithelpers "github.com/metal-toolbox/auditevent/helpers"
"github.com/nats-io/nats.go"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.equinixmetal.net/gov-okta-addon/internal/okta"
"go.equinixmetal.net/gov-okta-addon/internal/reconciler"
"go.equinixmetal.net/gov-okta-addon/internal/srv"
"golang.org/x/oauth2/clientcredentials"

governor "go.equinixmetal.net/governor-api/pkg/client"
governor "github.com/metal-toolbox/governor-api/pkg/client"
)

const (
Expand Down Expand Up @@ -52,9 +52,9 @@ func init() {
viperBindFlag("nats.url", serveCmd.Flags().Lookup("nats-url"))
serveCmd.PersistentFlags().String("nats-creds-file", "", "Path to the file containing the NATS credentials file")
viperBindFlag("nats.creds-file", serveCmd.PersistentFlags().Lookup("nats-creds-file"))
serveCmd.Flags().String("nats-subject-prefix", "equinixmetal.governor.events", "prefix for NATS subjects")
serveCmd.Flags().String("nats-subject-prefix", "governor.events", "prefix for NATS subjects")
viperBindFlag("nats.subject-prefix", serveCmd.Flags().Lookup("nats-subject-prefix"))
serveCmd.Flags().String("nats-queue-group", "equinixmetal.governor.addons.gov-okta-addon", "queue group for load balancing messages across NATS consumers")
serveCmd.Flags().String("nats-queue-group", "governor.addons.gov-okta-addon", "queue group for load balancing messages across NATS consumers")
viperBindFlag("nats.queue-group", serveCmd.Flags().Lookup("nats-queue-group"))
serveCmd.Flags().Int("nats-queue-size", defaultNATSQueueSize, "queue size for load balancing messages across NATS consumers")
viperBindFlag("nats.queue-size", serveCmd.Flags().Lookup("nats-queue-size"))
Expand All @@ -73,7 +73,7 @@ func init() {
viperBindFlag("audit.log-path", serveCmd.Flags().Lookup("audit-log-path"))

// Okta related flags
serveCmd.Flags().String("okta-url", "https://equinixmetal.okta.com", "url for Okta client calls")
serveCmd.Flags().String("okta-url", "https://example.okta.com", "url for Okta client calls")
viperBindFlag("okta.url", serveCmd.Flags().Lookup("okta-url"))
serveCmd.Flags().String("okta-token", "", "token for access to the Okta API")
viperBindFlag("okta.token", serveCmd.Flags().Lookup("okta-token"))
Expand Down
2 changes: 1 addition & 1 deletion cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func init() {
viperBindFlag("sync.dryrun", syncCmd.PersistentFlags().Lookup("dry-run"))

// Okta related flags
syncCmd.PersistentFlags().String("okta-url", "https://equinixmetal.okta.com", "url for Okta client calls")
syncCmd.PersistentFlags().String("okta-url", "https://example.okta.com", "url for Okta client calls")
viperBindFlag("okta.url", syncCmd.PersistentFlags().Lookup("okta-url"))
syncCmd.PersistentFlags().String("okta-token", "", "token for access to the Okta API")
viperBindFlag("okta.token", syncCmd.PersistentFlags().Lookup("okta-token"))
Expand Down
6 changes: 3 additions & 3 deletions cmd/sync_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"net/url"
"strings"

"github.com/equinixmetal/gov-okta-addon/internal/okta"
"github.com/gosimple/slug"
"github.com/metal-toolbox/governor-api/pkg/api/v1alpha1"
governor "github.com/metal-toolbox/governor-api/pkg/client"
okt "github.com/okta/okta-sdk-golang/v2/okta"
"github.com/okta/okta-sdk-golang/v2/okta/query"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.equinixmetal.net/gov-okta-addon/internal/okta"
"go.equinixmetal.net/governor-api/pkg/api/v1alpha1"
governor "go.equinixmetal.net/governor-api/pkg/client"
"go.uber.org/zap"
"golang.org/x/oauth2/clientcredentials"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/sync_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"net/url"

"github.com/equinixmetal/gov-okta-addon/internal/okta"
"github.com/metal-toolbox/governor-api/pkg/api/v1alpha1"
governor "github.com/metal-toolbox/governor-api/pkg/client"
okt "github.com/okta/okta-sdk-golang/v2/okta"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.equinixmetal.net/gov-okta-addon/internal/okta"
"go.equinixmetal.net/governor-api/pkg/api/v1alpha1"
governor "go.equinixmetal.net/governor-api/pkg/client"

"go.uber.org/zap"
"golang.org/x/oauth2/clientcredentials"
Expand Down
6 changes: 3 additions & 3 deletions cmd/sync_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"net/url"

"github.com/equinixmetal/gov-okta-addon/internal/okta"
"github.com/metal-toolbox/governor-api/pkg/api/v1alpha1"
governor "github.com/metal-toolbox/governor-api/pkg/client"
okt "github.com/okta/okta-sdk-golang/v2/okta"
"github.com/okta/okta-sdk-golang/v2/okta/query"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.equinixmetal.net/gov-okta-addon/internal/okta"
"go.equinixmetal.net/governor-api/pkg/api/v1alpha1"
governor "go.equinixmetal.net/governor-api/pkg/client"
"go.uber.org/zap"
"golang.org/x/oauth2/clientcredentials"
)
Expand Down
51 changes: 26 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module go.equinixmetal.net/gov-okta-addon
module github.com/equinixmetal/gov-okta-addon

go 1.19

Expand All @@ -10,8 +10,9 @@ require (
github.com/gofrs/uuid v4.4.0+incompatible
github.com/gosimple/slug v1.13.1
github.com/metal-toolbox/auditevent v0.8.0
github.com/metal-toolbox/governor-api v0.1.7
github.com/mitchellh/go-homedir v1.1.0
github.com/nats-io/nats.go v1.27.1
github.com/nats-io/nats.go v1.28.0
github.com/okta/okta-sdk-golang/v2 v2.19.0
github.com/prometheus/client_golang v1.16.0
github.com/spf13/cobra v1.7.0
Expand All @@ -20,23 +21,23 @@ require (
github.com/stretchr/testify v1.8.4
github.com/volatiletech/null/v8 v8.1.2
github.com/zsais/go-gin-prometheus v0.1.0
go.equinixmetal.net/governor-api v0.24.0
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.42.0
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel v1.17.0
go.opentelemetry.io/otel/exporters/jaeger v1.16.0
go.opentelemetry.io/otel/sdk v1.16.0
go.opentelemetry.io/otel/sdk v1.17.0
go.uber.org/zap v1.24.0
golang.org/x/oauth2 v0.9.0
golang.org/x/oauth2 v0.10.0
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/bytedance/sonic v1.10.0-rc3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cockroachdb/cockroach-go/v2 v2.3.4 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cockroachdb/cockroach-go/v2 v2.3.5 // indirect
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 // indirect
Expand All @@ -54,12 +55,12 @@ require (
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
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
Expand All @@ -69,7 +70,7 @@ require (
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand All @@ -82,11 +83,11 @@ require (
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // 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.10.1 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
Expand All @@ -96,21 +97,21 @@ require (
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
github.com/volatiletech/randomize v0.0.1 // indirect
github.com/volatiletech/sqlboiler/v4 v4.14.2 // indirect
github.com/volatiletech/strmangle v0.0.4 // indirect
go.hollow.sh/toolbox v0.6.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
github.com/volatiletech/sqlboiler/v4 v4.15.0 // indirect
github.com/volatiletech/strmangle v0.0.5 // indirect
go.hollow.sh/toolbox v0.6.1 // indirect
go.opentelemetry.io/otel/metric v1.17.0 // indirect
go.opentelemetry.io/otel/trace v1.17.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 2f6f253

Please sign in to comment.