initial commit
Change-Id: I3b5927ebd95850e39277c110434ca77965cb953f
This commit is contained in:
commit
985fffcb8b
24
.tekton/pipeline.yaml
Normal file
24
.tekton/pipeline.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
# Reuses the cluster-wide build-sign-deploy Pipeline in the demo-secure namespace.
|
||||
# To run on every push, install OpenShift Pipelines as Code or fire the EventListener
|
||||
# in demo-secure with the right git-revision.
|
||||
apiVersion: tekton.dev/v1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
generateName: new-go-app-
|
||||
namespace: new-go-app
|
||||
spec:
|
||||
pipelineRef:
|
||||
name: build-sign-deploy
|
||||
namespace: demo-secure
|
||||
serviceAccountName: pipeline
|
||||
params:
|
||||
- name: image
|
||||
value: image-registry.openshift-image-registry.svc:5000/new-go-app/new-go-app:latest
|
||||
workspaces:
|
||||
- name: source
|
||||
volumeClaimTemplate:
|
||||
spec:
|
||||
accessModes: [ReadWriteOnce]
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM registry.access.redhat.com/ubi9/go-toolset:1.22 AS build
|
||||
WORKDIR /opt/app-root/src
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o /tmp/app .
|
||||
|
||||
FROM registry.access.redhat.com/ubi9-minimal:latest
|
||||
COPY --from=build /tmp/app /usr/local/bin/app
|
||||
USER 1001
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/usr/local/bin/app"]
|
||||
28
argocd-app.yaml
Normal file
28
argocd-app.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: new-go-app
|
||||
namespace: openshift-gitops
|
||||
labels:
|
||||
category: app
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL:
|
||||
targetRevision: master
|
||||
path: deploy
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: new-go-app
|
||||
ignoreDifferences:
|
||||
- group: apps
|
||||
kind: Deployment
|
||||
jsonPointers:
|
||||
- /spec/template/spec/containers/0/image
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
- ServerSideApply=true
|
||||
14
catalog-info.yaml
Normal file
14
catalog-info.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: new-go-app
|
||||
description: new demo go app
|
||||
annotations:
|
||||
backstage.io/kubernetes-id: new-go-app
|
||||
backstage.io/kubernetes-namespace: new-go-app
|
||||
janus-idp.io/tekton: new-go-app
|
||||
argocd/app-name: new-go-app
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: experimental
|
||||
owner: platform
|
||||
23
main.go
Normal file
23
main.go
Normal file
@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
|
||||
fmt.Fprintf(w, "hello from new-go-app\n")
|
||||
})
|
||||
http.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
log.Printf("new-go-app listening on :%s", port)
|
||||
log.Fatal(http.ListenAndServe(":"+port, nil))
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user