-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* switch to connectrpc from grpc-go Signed-off-by: Artem Bortnikov <[email protected]> * machine service endpoints Signed-off-by: Artem Bortnikov <[email protected]> * machinetype service endpoints Signed-off-by: Artem Bortnikov <[email protected]> * fix timestamps Signed-off-by: Artem Bortnikov <[email protected]> * update tests Signed-off-by: Artem Bortnikov <[email protected]> * cleanup Signed-off-by: Artem Bortnikov <[email protected]> * deployment Signed-off-by: Artem Bortnikov <[email protected]> * update logging Signed-off-by: Artem Bortnikov <[email protected]> * linter Signed-off-by: Artem Bortnikov <[email protected]> * update dockerfiles Signed-off-by: Artem Bortnikov <[email protected]> --------- Signed-off-by: Artem Bortnikov <[email protected]>
- Loading branch information
Showing
74 changed files
with
3,211 additions
and
2,381 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
# Build the manager binary | ||
FROM golang:1.22.0 as builder | ||
|
||
ARG GOARCH | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY cmd/lifecycle-service/ cmd/lifecycle-service | ||
COPY api/ api/ | ||
COPY clientgo/applyconfiguration clientgo/applyconfiguration | ||
COPY clientgo/lifecycle clientgo/lifecycle | ||
COPY lcmi/ lcmi/ | ||
COPY util/ util/ | ||
|
||
# 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=linux GOARCH=${GOARCH} go build -a -o manager cmd/lifecycle-service/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"] |
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,32 @@ | ||
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and IronCore contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package app | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"os/signal" | ||
"syscall" | ||
) | ||
|
||
var ( | ||
shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} | ||
onlyOneSignalHandler = make(chan struct{}) | ||
) | ||
|
||
// SetupSignalHandler registers for SIGTERM and SIGINT. A context is returned | ||
// which is canceled on one of these signals. | ||
func SetupSignalHandler() context.Context { | ||
close(onlyOneSignalHandler) // panics when called twice | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
c := make(chan os.Signal, 1) | ||
signal.Notify(c, shutdownSignals...) | ||
go func() { | ||
<-c | ||
cancel() | ||
}() | ||
|
||
return ctx | ||
} |
Oops, something went wrong.