Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
**/build
**/bin
**/charts/*.tgz
**/charts/.*
**/Chart.lock
uv.lock
**/.task/
# macOS artifacts
.DS_Store
oss-values.yaml
kubeconfig.yaml
/values.yaml
.task/
.build
.helmpreview
10 changes: 10 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,43 @@ includes:
radar-ui:
taskfile: ./radar-ui/Taskfile.yml
dir: ./radar-ui
optional: true
reverse-proxy:
taskfile: ./reverse-proxy/Taskfile.yml
dir: ./reverse-proxy
optional: true
cluster-manager:
taskfile: ./cluster-manager/Taskfile.yml
dir: ./cluster-manager
optional: true
history-api:
taskfile: ./history-api/Taskfile.yml
dir: ./history-api
optional: true
policy-enforcer:
taskfile: ./policy-enforcer/Taskfile.yml
dir: ./policy-enforcer
optional: true
notifier:
taskfile: ./notifier/Taskfile.yml
dir: ./notifier
optional: true
event-processor:
taskfile: ./event-processor/Taskfile.yml
dir: ./event-processor
optional: true
runtime-monitor:
taskfile: ./runtime-monitor/Taskfile.yml
dir: ./runtime-monitor
optional: true
auth-center:
taskfile: ./auth-center/Taskfile.yml
dir: ./auth-center
optional: true
public-api:
taskfile: ./public-api/Taskfile.yml
dir: ./public-api
optional: true
cs-manager:
taskfile: ./cs-manager/Taskfile.yml
dir: ./cs-manager
Expand Down
1 change: 1 addition & 0 deletions auth-center/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ docker-compose*.yml
.dockerignore
/.helm
/.task
.build

# Misc
.env*
Expand Down
4 changes: 2 additions & 2 deletions auth-center/.helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: auth-center
description: A Helm chart for Kubernetes
type: application
version: v0.0.1
version: 0.0.1
dependencies:
- name: common
repository: file://../../install/helm/charts/common
version: 0.x.x
version: 0.x.x
9 changes: 7 additions & 2 deletions auth-center/.helm/templates/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
{{- if ne (include "common.cs.isChildCluster" .) "true" }}
{{ include "common.cs.deployment" . }}
---
{{ include "common.cs.service" . }}
{{- end }}
{{- end }}
{{- $isChild := eq (include "common.cs.isChildCluster" .) "true" }}
{{- $ctx := . }}
{{- if $isChild }}
{{- $ctx = dict "Chart" .Chart "Release" .Release "Values" (.Values | merge (dict "selectorLabels" (dict "app.kubernetes.io/name" "reverse-proxy"))) }}
{{- end }}
{{ include "common.cs.service" $ctx }}
6 changes: 5 additions & 1 deletion auth-center/.helm/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ metadata:
name: auth-center-account
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with (include "common.annotations" .) }}
annotations:
{{- . | nindent 4 }}
{{- end }}
type: Opaque
data:
username: {{ required "administrator username is required!" .Values.administrator.username | b64enc | quote }}
password: {{ required "administrator password is required!" .Values.administrator.password | b64enc | quote }}
{{- end }}
{{- end }}
20 changes: 11 additions & 9 deletions auth-center/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM golang:1.25.0 AS tools
ARG GO_VERSION=1.26.0

FROM golang:${GO_VERSION} AS tools

RUN CGO_ENABLED=0 GOBIN=/usr/bin go install github.com/go-task/task/v3/cmd/task@v3.38.0

FROM golang:1.25.0 AS builder
FROM golang:${GO_VERSION} AS builder

ARG BUILD_RELEASE
ARG BUILD_BRANCH
Expand All @@ -11,17 +13,17 @@ ARG BUILD_COMMIT
WORKDIR /go/src/repo
COPY go.mod go.sum ./
COPY vendor/ vendor/
COPY pkg/tools/tools.go pkg/tools/

ENV GOCACHE=/root/.cache/go-build

RUN --mount=type=cache,target="/root/.cache/go-build" \
mkdir -p bin && \
GOBIN=/go/src/repo/bin go install github.com/google/gops

COPY --from=tools /usr/bin/task /usr/bin
COPY . /go/src/repo
COPY auth-center/ auth-center/
COPY lib/ lib/

RUN task build
RUN --mount=type=cache,target="/root/.cache/go-build" task -d auth-center build

FROM debian:12.0-slim AS runner

Expand All @@ -31,9 +33,9 @@ LABEL org.opencontainers.image.licenses="Apache-2.0"

ARG APP_NAME=auth-center

COPY --from=builder /go/src/repo/cmd/${APP_NAME}/${APP_NAME} /app
COPY --from=builder /go/src/repo/cmd/${APP_NAME}/*.pem /
COPY --from=builder /go/src/repo/*.txt /
COPY --from=builder /go/src/repo/${APP_NAME}/cmd/${APP_NAME}/${APP_NAME} /app
COPY --from=builder /go/src/repo/${APP_NAME}/cmd/${APP_NAME}/*.pem /
COPY --from=builder /go/src/repo/${APP_NAME}/*.txt /
COPY --from=builder /go/src/repo/bin/gops /usr/bin/gops

EXPOSE 8000 9000
Expand Down
46 changes: 29 additions & 17 deletions auth-center/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ env:
tasks:
proto:
deps: [protoc-plugins]
vars:
PROTO_DIR: api
cmds:
- |
PATH="{{.TOOLS_BIN}}{{if eq OS "windows"}};{{else}}:{{end}}$PATH"
protoc -I api \
--go_opt=paths=source_relative \
--go_out={{.PROTO_DIR}} \
--go_out=api \
--go-grpc_opt=paths=source_relative \
--go-grpc_out={{.PROTO_DIR}} \
--go-grpc_out=api \
--grpc-gateway_opt=paths=source_relative \
--grpc-gateway_opt=logtostderr=true \
--grpc-gateway_out={{.PROTO_DIR}} \
--grpc-gateway_out=api \
--openapiv2_opt=logtostderr=true \
--openapiv2_out={{.PROTO_DIR}}/openapiv2 \
{{.PROTO_DIR}}/*.proto
--openapiv2_out=api/openapiv2 \
api/*.proto
sources:
- "{{.PROTO_DIR}}/**/*.proto"
- "api/**/*.proto"
- "go.mod"
generates:
- "{{.PROTO_DIR}}/**/*pb*.go"
- "api/**/*pb*.go"

build:
vars:
Expand All @@ -44,9 +42,9 @@ tasks:
sh: echo "${BUILD_COMMIT:-$(git rev-parse --short HEAD)}"
BUILD_DATE: '{{now.Format "2006-01-02_15:04:05"}}'
MODULE_NAME:
sh: go list -m
sh: 'echo "$(go list -m)/{{.APP_NAME}}"'
cmds:
- |
- |
CGO_ENABLED=0 go build -ldflags "-X {{.MODULE_NAME}}/pkg/build.Release={{.BUILD_RELEASE}} -X {{.MODULE_NAME}}/pkg/build.Branch={{.BUILD_BRANCH}} -X {{.MODULE_NAME}}/pkg/build.Commit={{.BUILD_COMMIT}} -X {{.MODULE_NAME}}/pkg/build.Date={{.BUILD_DATE}}" \
-o cmd/{{.APP_NAME}}/ ./cmd/{{.APP_NAME}}

Expand All @@ -56,10 +54,14 @@ tasks:
- go test -race -count=1 -vet=off ./cmd/{{.APP_NAME}}
- go test -race -count=1 ./pkg/...

test-docker-cleanup:
cmds:
- docker compose -f docker-compose.test.yml down -v

test-docker:
cmds:
- defer: {task: test-docker-cleanup}
- docker compose -f docker-compose.test.yml up --build --abort-on-container-exit test
- defer: docker compose -f docker-compose.test.yml down

lint:
deps: [tools]
Expand All @@ -82,11 +84,11 @@ tasks:

tidy:
cmds:
- go mod tidy
- cd .. && go mod tidy

vendor:
cmds:
- go mod vendor
- cd .. && go mod vendor

generate:
cmds:
Expand All @@ -99,15 +101,23 @@ tasks:
- cp cmd/{{.APP_NAME}}/cert.pem cmd/{{.APP_NAME}}/ca.pem

docker-build:
dir: ..
vars:
BUILD_RELEASE:
sh: git describe --tags 2> /dev/null || echo "v0.0.0"
BUILD_BRANCH:
sh: git rev-parse --abbrev-ref HEAD
BUILD_COMMIT:
sh: git rev-parse --short HEAD
sources:
- go.mod
- go.sum
- lib/**
- "{{.APP_NAME}}/**"
generates:
- "{{.APP_NAME}}/.build"
cmds:
- docker build --build-arg BUILD_RELEASE={{.BUILD_RELEASE}} --build-arg BUILD_BRANCH={{.BUILD_BRANCH}} --build-arg BUILD_COMMIT={{.BUILD_COMMIT}} --tag {{.DOCKER_IMAGE}} .
- docker build --iidfile {{.APP_NAME}}/.build -f {{.APP_NAME}}/Dockerfile --build-arg BUILD_RELEASE={{.BUILD_RELEASE}} --build-arg BUILD_BRANCH={{.BUILD_BRANCH}} --build-arg BUILD_COMMIT={{.BUILD_COMMIT}} --tag {{.DOCKER_IMAGE}} .

docker-push:
vars:
Expand All @@ -125,8 +135,8 @@ tasks:
- test -e {{.TOOLS_BIN}}/golangci-lint{{exeExt}}
- test -e {{.TOOLS_BIN}}/govulncheck{{exeExt}}
cmds:
- GOBIN={{.TOOLS_BIN}} go install github.com/golangci/golangci-lint/cmd/golangci-lint
- GOBIN={{.TOOLS_BIN}} go install golang.org/x/vuln/cmd/govulncheck
- GOBIN={{.TOOLS_BIN}} go install github.com/golangci/golangci-lint/cmd/golangci-lint
- GOBIN={{.TOOLS_BIN}} go install golang.org/x/vuln/cmd/govulncheck

protoc-plugins:
generates:
Expand All @@ -145,9 +155,11 @@ tasks:
- vendor/modules.txt
- go.mod
- go.sum
- "*.go"
- cmd/**/*.go
- pkg/**/*.go
- internal/**/*.go
- api/**/*.go
- Dockerfile
vars:
DEPLOY_TAG: |-
Expand Down
4 changes: 2 additions & 2 deletions auth-center/api/auth.pb.go

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

Loading
Loading