Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
2c4d395
init
gozdan-lordz May 21, 2025
19f32a9
webhooks + crds bases
gozdan-lordz May 21, 2025
2f5cf44
crd specs
gozdan-lordz May 21, 2025
06ed5e0
samples
gozdan-lordz May 21, 2025
171870d
webhook realization
gozdan-lordz May 22, 2025
5ba39ca
port utils
gozdan-lordz May 22, 2025
4195257
fix namesapce resolving and deletion by rules of creation policy
gozdan-lordz May 22, 2025
d6c45db
doc: сценарии использования и правила
gozdan-lordz May 22, 2025
c6a813e
feat: ServiceAlias wip
gozdan-lordz May 23, 2025
e37ba54
feat: ServiceAlias wip
gozdan-lordz May 23, 2025
d31e201
feat: RuleS2S wip
gozdan-lordz May 23, 2025
4dc01b1
feat: Alias implementation
gozdan-lordz May 23, 2025
1b2e655
doc: s2srule doc
gozdan-lordz May 23, 2025
4b1ca4a
feat: rules
gozdan-lordz May 25, 2025
f2e7145
add provider
gozdan-lordz May 25, 2025
be45a5b
rules realization
gozdan-lordz May 25, 2025
6df4028
AG to netguard
gozdan-lordz May 25, 2025
ff77a7d
wip
gozdan-lordz May 26, 2025
6bcfe59
build
gozdan-lordz May 26, 2025
a4042fb
build
gozdan-lordz May 26, 2025
b2882b5
build
gozdan-lordz May 26, 2025
45781e3
build
gozdan-lordz May 26, 2025
a74745a
fix port
gozdan-lordz May 26, 2025
6155800
fix provider
gozdan-lordz May 26, 2025
926524d
fix mapping
gozdan-lordz May 26, 2025
11b3825
fix mapping
gozdan-lordz May 27, 2025
effc96d
fix s2s rule
gozdan-lordz May 27, 2025
fa4564c
fix port duplicate
gozdan-lordz May 27, 2025
2d35dbf
fix port duplicate
gozdan-lordz May 27, 2025
a09ff99
fixes
gozdan-lordz May 27, 2025
89b9844
fixes
gozdan-lordz May 27, 2025
fbe930d
fixes
gozdan-lordz May 27, 2025
3639464
fixes
gozdan-lordz May 27, 2025
d41d53d
fixes
gozdan-lordz May 27, 2025
f608192
fixes
gozdan-lordz May 27, 2025
fec2562
fixes
gozdan-lordz May 27, 2025
da0529b
fixes
gozdan-lordz May 27, 2025
bc52a55
fix: concurrent access issue
gozdan-lordz May 28, 2025
b551fb0
find me if you can: зацикливание реконсила биндингов
gozdan-lordz May 28, 2025
f6042d1
find me if you can: зацикливание реконсила биндингов, меняем условие …
gozdan-lordz May 28, 2025
7681482
разрешаем модификацию ресурсов если condition ready == false
gozdan-lordz May 29, 2025
d325355
не разрешаем модификацию или создание ресурса если в ссылках на Ref c…
gozdan-lordz May 29, 2025
c835624
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
eea5bd7
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
3ed8d1e
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
245700d
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
8a5f150
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
a995a60
логи для разбора создания IE правил
gozdan-lordz May 29, 2025
d83d84e
запуск вебхуков
gozdan-lordz May 29, 2025
39b1572
запуск вебхуков
gozdan-lordz May 30, 2025
4699f1e
биндинг без дублей
gozdan-lordz May 30, 2025
b4816aa
удаление IEAgAg rule
gozdan-lordz May 30, 2025
3f94f43
формат удаления алиаса
gozdan-lordz May 30, 2025
901c2d2
убираем периодическую проверку правил, теперь все через вотчеры
gozdan-lordz May 30, 2025
bfa66f8
для случая нет АГ или портов - это валидная история - ставим кондишен…
gozdan-lordz May 30, 2025
3f69284
форматный кондишен
gozdan-lordz May 30, 2025
8114ecb
форматный кондишен
gozdan-lordz May 30, 2025
7b7da79
delete webhook service
gozdan-lordz May 30, 2025
bb8362c
Удаление IEAgAg ghfdbk
gozdan-lordz May 30, 2025
8c58c46
feat: добавил проверки на отсутствие АГ в юбом из сервисов при удален…
gozdan-lordz Jun 10, 2025
d1d088e
Update docker-build.yml
pointpu Jun 10, 2025
86e6494
fix
gozdan-lordz Jun 10, 2025
ce5943a
fix: remove finalizer before deletion S2S rule
gozdan-lordz Jun 10, 2025
089a447
fix
gozdan-lordz Jun 10, 2025
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
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Kubebuilder DevContainer",
"image": "docker.io/golang:1.23",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {}
},

"runArgs": ["--network=host"],

"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-azuretools.vscode-docker"
]
}
},

"onCreateCommand": "bash .devcontainer/post-install.sh"
}

23 changes: 23 additions & 0 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -x

curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/kind

curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
chmod +x kubebuilder
mv kubebuilder /usr/local/bin/

KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/kubectl

docker network create -d=bridge --subnet=172.19.0.0/24 kind

kind version
kubebuilder version
docker --version
go version
kubectl version --client
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
50 changes: 50 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release
on:
push:
branches:
- '**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Generate vendor directory
run: go mod vendor

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create sanitized branch name
id: sanitize
run: echo "branch=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')" >> $GITHUB_OUTPUT

- name: Build and push sgroups.k8s.np
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/sgroups.k8s.netguard:${{ github.head_ref || github.ref_name }}-${{ steps.short-sha.outputs.sha }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sgroups.k8s.netguard:${{ steps.sanitize.outputs.branch }}-${{ steps.short-sha.outputs.sha }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
Dockerfile.cross

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Go workspace file
go.work

# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
47 changes: 47 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
run:
timeout: 5m
allow-parallel-runners: true

issues:
# don't skip warning about doc comments
# don't exclude the default set of lint
exclude-use-default: false
# restore some of the defaults
# (fill in the rest as needed)
exclude-rules:
- path: "api/*"
linters:
- lll
- path: "internal/*"
linters:
- dupl
- lll
linters:
disable-all: true
enable:
- dupl
- errcheck
- copyloopvar
- ginkgolinter
- goconst
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- typecheck
- unconvert
- unparam
- unused

linters-settings:
revive:
rules:
- name: comment-spacings
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Build the manager binary
FROM docker.io/golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY cmd/main.go cmd/main.go
COPY api/ api/
COPY internal/ internal/
COPY deps/ deps/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

ENTRYPOINT ["/manager"]
Loading