-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure: segment code base in different packages
- Loading branch information
1 parent
51970f1
commit 28de9b0
Showing
38 changed files
with
458 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package logger | ||
|
||
import ( | ||
"os" | ||
|
||
"go.uber.org/zap" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
func GetLogger(env string) (logger *zap.Logger, err error) { | ||
if env == "prod" { | ||
logger, err = zap.NewProduction() | ||
if err != nil { | ||
return nil, err | ||
} | ||
} else { | ||
encoderConfig := zap.NewDevelopmentEncoderConfig() | ||
encoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder | ||
encoderConfig.EncodeTime = zapcore.RFC3339TimeEncoder | ||
encoderConfig.EncodeDuration = zapcore.StringDurationEncoder | ||
consoleEncoder := zapcore.NewConsoleEncoder(encoderConfig) | ||
core := zapcore.NewCore(consoleEncoder, zapcore.AddSync(os.Stdout), zapcore.DebugLevel) | ||
logger = zap.New(core) | ||
} | ||
return logger, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package messages | ||
|
||
// Host is the host details | ||
type Host struct { | ||
Namespace string | ||
SourceService string | ||
TargetService string | ||
SourceHost string | ||
TargetHost string | ||
TrafficAllowed bool | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
# Used by the resolver | ||
export POD_NAME=fake-api | ||
export POD_IP=http://localhost:1090/mock/whatever-name-i-want/request | ||
export MaxIdleProxyConns=100 | ||
export MaxIdleProxyConnsPerHost=1000 | ||
|
||
# Used by the target service | ||
export TARGET_URL=http://localhost:1090/mock/whatever-name-i-want/request/ | ||
|
||
export KUBERNETES_SERVICE_HOST=10.96.0.1 | ||
export KUBERNETES_SERVICE_PORT=443 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Used by the resolver | ||
export MaxIdleProxyConns=100 | ||
export MaxIdleProxyConnsPerHost=1000 | ||
|
||
export KUBERNETES_SERVICE_HOST=10.96.0.1 | ||
export KUBERNETES_SERVICE_PORT=443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM golang:1.22 AS builder | ||
|
||
COPY ../pkg ../pkg | ||
WORKDIR /workspace | ||
COPY ./resolver/go.mod go.mod | ||
COPY ./resolver/go.sum go.sum | ||
RUN go mod download | ||
COPY ./resolver/ . | ||
RUN go build -o resolver ./cmd/ | ||
# Break | ||
FROM alpine:latest | ||
WORKDIR / | ||
COPY --from=builder /workspace/resolver . | ||
EXPOSE 8080 | ||
EXPOSE 8012 | ||
EXPOSE 8013 | ||
CMD ["./resolver"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.