-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
365 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=${TARGETPLATFORM} golang:1.21 as builder | ||
ARG TARGETARCH | ||
ARG TARGETOS | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY * /workspace/ | ||
# 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 | ||
|
||
# Build work-creator binary | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GO111MODULE=on go build -a main.go | ||
|
||
FROM --platform=${TARGETPLATFORM} alpine | ||
# Use rancher/kubectl to get ./kubeconfig | ||
WORKDIR / | ||
|
||
COPY --from=builder /workspace/main ./server | ||
|
||
|
||
ENTRYPOINT ["/server"] |
10 changes: 10 additions & 0 deletions
10
hack/kratix-promise-release-test-hoster-image/build_and_push.sh
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,10 @@ | ||
#!/usr/bin/env sh | ||
|
||
export IMG="syntassodev/kratix-promise-release-test-hoster:v0.0.2" | ||
|
||
if ! docker buildx ls | grep -q "kratix-image-builder"; then \ | ||
docker buildx create --name kratix-image-builder; \ | ||
fi; | ||
|
||
docker buildx build --builder kratix-image-builder --push --platform linux/arm64,linux/amd64 -t ${IMG} . | ||
|
42 changes: 42 additions & 0 deletions
42
hack/kratix-promise-release-test-hoster-image/deployment.yaml
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,42 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
kratix-promise-release: pod | ||
name: kratix-promise-release-test-hoster | ||
namespace: kratix-platform-system | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
kratix-promise-release: pod | ||
template: | ||
metadata: | ||
labels: | ||
kratix-promise-release: pod | ||
spec: | ||
containers: | ||
- image: syntassodev/kratix-promise-release-test-hoster:v0.0.2 | ||
name: test | ||
resources: {} | ||
env: | ||
- name: PROMISE_ENCODED | ||
value: "REPLACEME" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kratix-promise-release-test-hoster | ||
namespace: kratix-platform-system | ||
spec: | ||
ports: | ||
- port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
kratix-promise-release: pod | ||
sessionAffinity: None | ||
type: ClusterIP |
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,8 @@ | ||
module github.com/syntasso/kratix/kratix-promise-release-test-hoster-image | ||
|
||
go 1.21.6 | ||
|
||
require ( | ||
github.com/gorilla/mux v1.8.1 | ||
sigs.k8s.io/yaml v1.4.0 | ||
) |
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,8 @@ | ||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= | ||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= | ||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= | ||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= |
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,36 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
gohttp "net/http" | ||
|
||
"encoding/base64" | ||
|
||
"github.com/gorilla/mux" | ||
) | ||
|
||
func main() { | ||
router := mux.NewRouter() | ||
router.HandleFunc("/promise/{name}", func(w gohttp.ResponseWriter, r *gohttp.Request) { | ||
vars := mux.Vars(r) | ||
name := vars["name"] | ||
fmt.Println("fetching promise: " + name) | ||
promiseContent, err := base64.StdEncoding.DecodeString(os.Getenv(name)) | ||
if err != nil { | ||
panic(err) | ||
} | ||
w.Write([]byte(promiseContent)) | ||
}).Methods("GET") | ||
|
||
srv := &gohttp.Server{ | ||
Addr: ":8080", | ||
Handler: router, | ||
} | ||
|
||
if err := srv.ListenAndServe(); err != nil && err != gohttp.ErrServerClosed { | ||
log.Fatalf("listen: %s\n", err) | ||
} | ||
} |
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,42 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
kratix-promise-release: pod | ||
name: kratix-promise-release-test-hoster | ||
namespace: kratix-platform-system | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
kratix-promise-release: pod | ||
template: | ||
metadata: | ||
labels: | ||
kratix-promise-release: pod | ||
spec: | ||
containers: | ||
- image: syntassodev/kratix-promise-release-test-hoster:v0.0.2 | ||
name: test | ||
resources: {} | ||
env: | ||
- name: PROMISE_ENCODED | ||
value: "REPLACEME" | ||
ports: | ||
- containerPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kratix-promise-release-test-hoster | ||
namespace: kratix-platform-system | ||
spec: | ||
ports: | ||
- port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
kratix-promise-release: pod | ||
sessionAffinity: None | ||
type: ClusterIP |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ spec: | |
version: v1.0.0 | ||
sourceRef: | ||
type: http | ||
url: http://LOCALHOST:REPLACEPORT/promise | ||
url: REPLACEURL |
Oops, something went wrong.