Skip to content

Commit

Permalink
Merge pull request #920 from pyrra-dev/openshift-manifests
Browse files Browse the repository at this point in the history
Generate OpenShift manifests
  • Loading branch information
metalmatze authored Sep 20, 2023
2 parents 091d90e + a2685b8 commit 9b40aa8
Show file tree
Hide file tree
Showing 59 changed files with 933 additions and 354 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ builds:
- -v
ldflags:
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
- -w -extldflags '-static' -X main.version={{.Version}} -X main.commit={{.Commit}}
- -extldflags '-static' -X main.version={{.Version}} -X main.commit={{.Commit}}
archives:
# e.g. parca_0.15.0_Darwin_arm64.tar.gz, parca_0.15.0_Darwin_x86_64.tar.gz, parca_0.15.0_Linux_arm64.tar.gz, parca_0.15.0_Linux_x86_64.tar.gz
- name_template: >-
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/golang:1.21.1-alpine as go-builder

# renovate: datasource=go depName=github.com/go-delve/delve
ARG DLV_VERSION=v1.21.0

# hadolint ignore=DL3018
RUN apk update && apk add --no-cache build-base
RUN go install "github.com/go-delve/delve/cmd/dlv@${DLV_VERSION}"

FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/busybox:1.36.1 as builder

ARG TARGETOS TARGETARCH TARGETVARIANT

WORKDIR /app
COPY dist dist

# NOTICE: See goreleaser.yml for the build paths.
RUN if [ "${TARGETARCH}" = 'amd64' ]; then \
cp "dist/pyrra_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT:-v1}/pyrra" . ; \
elif [ "${TARGETARCH}" = 'arm' ]; then \
cp "dist/pyrra_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT##v}/pyrra" . ; \
else \
cp "dist/pyrra_${TARGETOS}_${TARGETARCH}/pyrra" . ; \
fi
RUN chmod +x pyrra

FROM --platform="${TARGETPLATFORM:-linux/amd64}" docker.io/alpine:3.18.3 AS runner
WORKDIR /
COPY --chown=0:0 --from=builder /app/pyrra /usr/bin/pyrra
COPY --chown=0:0 --from=go-builder /go/bin/dlv /usr/bin/dlv
USER 65533

ENTRYPOINT ["/usr/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "--continue", "--", "/usr/bin/pyrra"]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ ui/node_modules:
ui/build:
cd ui && npm run build

examples: examples/kubernetes/manifests examples/kubernetes/manifests-webhook examples/openshift/manifests

examples/kubernetes/manifests: examples/kubernetes/main.jsonnet jsonnet/controller-gen/pyrra.dev_servicelevelobjectives.json jsonnet/pyrra/kubernetes.libsonnet
jsonnetfmt -i examples/kubernetes/main.jsonnet
jsonnet -m examples/kubernetes/manifests examples/kubernetes/main.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
Expand All @@ -92,3 +94,8 @@ examples/kubernetes/manifests-webhook: examples/kubernetes/main-webhook.jsonnet
jsonnetfmt -i examples/kubernetes/main-webhook.jsonnet
jsonnet -m examples/kubernetes/manifests-webhook examples/kubernetes/main-webhook.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
find examples/kubernetes/manifests-webhook -type f ! -name '*.yaml' -delete

examples/openshift/manifests: examples/openshift/main.jsonnet jsonnet/controller-gen/pyrra.dev_servicelevelobjectives.json jsonnet/pyrra/kubernetes.libsonnet
jsonnetfmt -i examples/openshift/main.jsonnet
jsonnet -m examples/openshift/manifests examples/openshift/main.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
find examples/openshift/manifests -type f ! -name '*.yaml' -delete
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
Expand All @@ -14,7 +13,6 @@ spec:
matchLabels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -24,7 +22,6 @@ spec:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
spec:
containers:
Expand All @@ -41,3 +38,4 @@ spec:
readOnlyRootFilesystem: true
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: pyrra-api
2 changes: 0 additions & 2 deletions examples/kubernetes/manifests-webhook/pyrra-apiService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
Expand All @@ -16,4 +15,3 @@ spec:
selector:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
19 changes: 19 additions & 0 deletions examples/kubernetes/manifests-webhook/pyrra-apiServiceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
spec:
endpoints:
- port: http
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand All @@ -14,7 +13,6 @@ spec:
matchLabels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -24,7 +22,6 @@ spec:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
spec:
ports:
- name: metrics
port: 8080
targetPort: 8080
- name: http
port: 9444
targetPort: 9444
Expand All @@ -19,4 +21,3 @@ spec:
selector:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
spec:
endpoints:
- port: metrics
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
4 changes: 1 addition & 3 deletions examples/kubernetes/manifests/pyrra-apiDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
Expand All @@ -14,7 +13,6 @@ spec:
matchLabels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -24,7 +22,6 @@ spec:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
spec:
containers:
Expand All @@ -41,3 +38,4 @@ spec:
readOnlyRootFilesystem: true
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: pyrra-api
2 changes: 0 additions & 2 deletions examples/kubernetes/manifests/pyrra-apiService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
Expand All @@ -16,4 +15,3 @@ spec:
selector:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
9 changes: 9 additions & 0 deletions examples/kubernetes/manifests/pyrra-apiServiceAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
19 changes: 19 additions & 0 deletions examples/kubernetes/manifests/pyrra-apiServiceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-api
namespace: monitoring
spec:
endpoints:
- port: http
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/component: api
app.kubernetes.io/name: pyrra
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand Down
3 changes: 0 additions & 3 deletions examples/kubernetes/manifests/pyrra-kubernetesDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
Expand All @@ -14,7 +13,6 @@ spec:
matchLabels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -24,7 +22,6 @@ spec:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
spec:
containers:
Expand Down
5 changes: 3 additions & 2 deletions examples/kubernetes/manifests/pyrra-kubernetesService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
spec:
ports:
- name: metrics
port: 8080
targetPort: 8080
- name: http
port: 9444
targetPort: 9444
Expand All @@ -19,4 +21,3 @@ spec:
selector:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/part-of: kube-prometheus
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
19 changes: 19 additions & 0 deletions examples/kubernetes/manifests/pyrra-kubernetesServiceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
app.kubernetes.io/version: 0.7.0-rc.1
name: pyrra-kubernetes
namespace: monitoring
spec:
endpoints:
- port: metrics
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app.kubernetes.io/component: kubernetes
app.kubernetes.io/name: pyrra
Loading

0 comments on commit 9b40aa8

Please sign in to comment.