Skip to content

Commit a6c8e31

Browse files
committed
Upgrade operator-sdk
1 parent 142a13f commit a6c8e31

File tree

86 files changed

+2972
-4412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2972
-4412
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
bin/

.github/workflows/chart.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
push:
55
branches:
66
- master
7-
- fix/chart-release
7+
paths:
8+
- charts/*
89

910
jobs:
1011
release:

.github/workflows/e2e-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
uses: docker/build-push-action@v4
2323
with:
2424
context: .
25-
file: ./build/Dockerfile.dist
2625
push: false
2726
load: true
2827
tags: |

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
go-version: "1.24.2"
1414
- run: |
15-
go test ./...
15+
make test
1616
build:
1717
runs-on: ubuntu-latest
1818
name: Go build
@@ -22,5 +22,5 @@ jobs:
2222
with:
2323
go-version: "1.24.2"
2424
- run: |
25-
go build -o operator github.com/movetokube/postgres-operator/cmd/manager
26-
file operator
25+
make build
26+
file bin/manager

.gitignore

Lines changed: 19 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,35 @@
1-
# Temporary Build Files
2-
build/_output
3-
build/_test
4-
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
5-
### Emacs ###
6-
# -*- mode: gitignore; -*-
7-
*~
8-
\#*\#
9-
/.emacs.desktop
10-
/.emacs.desktop.lock
11-
*.elc
12-
auto-save-list
13-
tramp
14-
.\#*
15-
# Org-mode
16-
.org-id-locations
17-
*_archive
18-
# flymake-mode
19-
*_flymake.*
20-
# eshell files
21-
/eshell/history
22-
/eshell/lastdir
23-
# elpa packages
24-
/elpa/
25-
# reftex files
26-
*.rel
27-
# AUCTeX auto folder
28-
/auto/
29-
# cask packages
30-
.cask/
31-
dist/
32-
# Flycheck
33-
flycheck_*.el
34-
# server auth directory
35-
/server/
36-
# projectiles files
37-
.projectile
38-
projectile-bookmarks.eld
39-
# directory configuration
40-
.dir-locals.el
41-
# saveplace
42-
places
43-
# url cache
44-
url/cache/
45-
# cedet
46-
ede-projects.el
47-
# smex
48-
smex-items
49-
# company-statistics
50-
company-statistics-cache.el
51-
# anaconda-mode
52-
anaconda-mode/
53-
### Go ###
541
# Binaries for programs and plugins
552
*.exe
563
*.exe~
574
*.dll
585
*.so
596
*.dylib
60-
# Test binary, build with 'go test -c'
7+
bin/*
8+
Dockerfile.cross
9+
10+
# Test binary, built with `go test -c`
6111
*.test
12+
6213
# Output of the go coverage tool, specifically when used with LiteIDE
6314
*.out
64-
### Vim ###
65-
# swap
66-
.sw[a-p]
67-
.*.sw[a-p]
68-
# session
69-
Session.vim
70-
# temporary
71-
.netrwhist
72-
# auto-generated tag files
73-
tags
74-
### VisualStudioCode ###
75-
.vscode/*
76-
.history
77-
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
7815

79-
### MacOS
80-
.DS_Store
16+
# Go workspace file
17+
go.work
18+
19+
# Kubernetes Generated files - skip generated files, except for vendored files
20+
!vendor/**/zz_generated.*
8121

22+
# editor and IDE paraphernalia
8223
.idea
24+
.vscode
25+
*.swp
26+
*.swo
27+
*~
28+
29+
#MacOS
30+
.DS_Store
31+
8332
deploy/secret.yaml
84-
# build artifact
85-
operator
8633
# kuttl/kind
8734
tests/kind-logs-*/
8835
kubeconfig

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Build the manager binary
2+
FROM golang:1.24 AS builder
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
6+
WORKDIR /workspace
7+
# Copy the Go Modules manifests
8+
COPY go.mod go.mod
9+
COPY go.sum go.sum
10+
# cache deps before building and copying source so that we don't need to re-download as much
11+
# and so that source changes don't invalidate our downloaded layer
12+
RUN go mod download
13+
14+
# Copy the go source
15+
COPY cmd/main.go cmd/main.go
16+
COPY api/ api/
17+
COPY internal/controller/ internal/controller/
18+
COPY pkg/ pkg/
19+
20+
# Build
21+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
22+
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
23+
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
24+
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
25+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
26+
27+
# Use distroless as minimal base image to package the manager binary
28+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
29+
FROM gcr.io/distroless/static:nonroot
30+
WORKDIR /
31+
COPY --from=builder /workspace/manager .
32+
USER 65532:65532
33+
34+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)