Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
feat: list the topic and dates for a dlq-bucket (#64)
Browse files Browse the repository at this point in the history
* feat: list the topic and dates for a dlq-bucket

* feat: remove importing models from entropy

* chore: fix linting in previous files

* test: add a handler test

* lint: added exclusion rule for generated method

* test: add more handler tests

* chore: go version fix

* chore: add a constant

* fix: fix prefixing issue

* fix: review comments

* refactor: take interface on routes to test it later

* refactor: changed payload type

* refactor: naming of strcut

* fix: revert back swagger

---------

Co-authored-by: Stewart Jingga <[email protected]>
  • Loading branch information
lavkesh and StewartJingga authored Sep 18, 2023
1 parent 2917ddf commit c1f98ef
Show file tree
Hide file tree
Showing 26 changed files with 1,338 additions and 674 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ issues:
- forbidigo
- contextcheck
severity:
default-severity: error
default-severity: error
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ generate-mocks:
@mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/siren/v1beta1/sirenv1beta1grpc --name=SirenServiceClient
@mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/shield/v1beta1/shieldv1beta1grpc --name=ShieldServiceClient
@mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/optimus/core/v1beta1/corev1beta1grpc --name=JobSpecificationServiceClient
@mockery --srcpkg=buf.build/gen/go/gotocompany/proton/grpc/go/gotocompany/entropy/v1beta1/entropyv1beta1grpc --name=ResourceServiceClient
@mockery --srcpkg=./internal/server/gcs --name=BlobStorageClient
@mockery --srcpkg=./internal/server/gcs --name=BlobObjectClient
@mockery --srcpkg=./internal/server/gcs --name=ObjectIterator

clean: tidy
@echo "Cleaning up build directories..."
Expand All @@ -64,3 +68,4 @@ download:
setup:
@go install github.com/vektra/mockery/[email protected]
@go install mvdan.cc/[email protected]
@go install github.com/daixiang0/[email protected]
5 changes: 3 additions & 2 deletions cli/server/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ type optimusConfig struct {
}

type serveConfig struct {
Host string `mapstructure:"host" default:""`
Port int `mapstructure:"port" default:"8080"`
Host string `mapstructure:"host" default:""`
Port int `mapstructure:"port" default:"8080"`
GCSKeyFilePath string `mapstructure:"gcs_key_file_path"`
}

func (serveCfg serveConfig) Addr() string {
Expand Down
6 changes: 6 additions & 0 deletions cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"google.golang.org/grpc/credentials/insecure"

"github.com/goto/dex/internal/server"
"github.com/goto/dex/internal/server/gcs"
"github.com/goto/dex/pkg/logger"
"github.com/goto/dex/pkg/telemetry"
)
Expand Down Expand Up @@ -99,12 +100,17 @@ func runServer(baseCtx context.Context, nrApp *newrelic.Application, zapLog *zap
if err != nil {
return err
}
gcsClient, err := gcs.NewClient(cfg.Service.GCSKeyFilePath)
if err != nil {
return err
}
return server.Serve(ctx, cfg.Service.Addr(), nrApp, zapLog,
shieldv1beta1.NewShieldServiceClient(shieldConn),
entropyv1beta1.NewResourceServiceClient(entropyConn),
sirenv1beta1.NewSirenServiceClient(sirenConn),
compassv1beta1grpc.NewCompassServiceClient(compassConn),
optimusv1beta1.NewJobSpecificationServiceClient(optimusConn),
&gcs.Client{StorageClient: gcsClient},
cfg.Odin.Addr,
cfg.StencilAddr,
)
Expand Down
8 changes: 7 additions & 1 deletion dex_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ shield:

# [Entropy](https://github.com/goto/entropy) client related configurations
entropy:
addr: localhost:8010
addr: http://g-godata-systems-dex.golabs.io
firehose_version: v0.5.0

# [Siren](https://github.com/goto/siren) client related configurations
Expand All @@ -62,3 +62,9 @@ siren:

odin:
addr: localhost:8030

compass:
addr: compass-grpc.integration.golabs.io:80

optimus:
addr: optimus.staging.golabs.io:80
81 changes: 81 additions & 0 deletions entropy/entropy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package entropy

import "time"

type Config struct {
// Stopped flag when set forces the firehose to be stopped on next sync.
Stopped bool `json:"stopped"`

// StopTime can be set to schedule the firehose to be stopped at given time.
StopTime *time.Time `json:"stop_time,omitempty"`

// Replicas is the number of firehose instances to run.
Replicas int `json:"replicas"`

// Namespace is the target namespace where firehose should be deployed.
// Inherits from driver config.
Namespace string `json:"namespace,omitempty"`

// DeploymentID will be used as the release-name for the deployment.
// Must be shorter than 53 chars if set. If not set, one will be generated
// automatically.
DeploymentID string `json:"deployment_id,omitempty"`

// EnvVariables contains all the firehose environment config values.
EnvVariables map[string]string `json:"env_variables,omitempty"`

// ResetOffset represents the value to which kafka consumer offset was set to
ResetOffset string `json:"reset_offset,omitempty"`

Limits UsageSpec `json:"limits,omitempty"`
Requests UsageSpec `json:"requests,omitempty"`
Telegraf *Telegraf `json:"telegraf,omitempty"`
ChartValues *ChartValues `json:"chart_values,omitempty"`
InitContainer InitContainer `json:"init_container,omitempty"`
}

type UsageSpec struct {
CPU string `json:"cpu,omitempty" validate:"required"`
Memory string `json:"memory,omitempty" validate:"required"`
}

type InitContainer struct {
Enabled bool `json:"enabled"`

Args []string `json:"args"`
Command []string `json:"command"`

Repository string `json:"repository"`
ImageTag string `json:"image_tag"`
PullPolicy string `json:"pull_policy"`
}

type Telegraf struct {
Enabled bool `json:"enabled,omitempty"`
Image map[string]any `json:"image,omitempty"`
Config TelegrafConf `json:"config,omitempty"`
}

type TelegrafConf struct {
Output map[string]any `json:"output"`
AdditionalGlobalTags map[string]string `json:"additional_global_tags"`
}

type ChartValues struct {
ImageTag string `json:"image_tag" validate:"required"`
ChartVersion string `json:"chart_version" validate:"required"`
ImagePullPolicy string `json:"image_pull_policy" validate:"required"`
}

type ScaleParams struct {
Replicas int `json:"replicas"`
}

type StartParams struct {
StopTime *time.Time `json:"stop_time"`
}

type ResetParams struct {
To string `json:"to"`
Datetime string `json:"datetime"`
}
81 changes: 0 additions & 81 deletions generated/models/dlq.go

This file was deleted.

57 changes: 57 additions & 0 deletions generated/models/dlq_metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1f98ef

Please sign in to comment.