Skip to content

Commit

Permalink
Add Kubernetes deployment to the release assets
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Jan 17, 2022
1 parent 2ddc11e commit 1bb3715
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- uses: docker/setup-buildx-action@v1
- uses: sigstore/cosign-installer@main
- uses: anchore/sbom-action/download-syft@v0
- uses: fluxcd/pkg/actions/kustomize@main
- name: Docker login ghcr.io
uses: docker/login-action@v1
with:
Expand Down Expand Up @@ -68,6 +69,9 @@ jobs:
COSIGN_EXPERIMENTAL: 1
run: |
cosign sign --recursive ghcr.io/fluxcd/${{ env.CONTROLLER }}:${GITHUB_REF/refs\/tags\//}
- name: Generate deployment manifest
run: |
IMG=ghcr.io/fluxcd/${{ env.CONTROLLER }}:${GITHUB_REF/refs\/tags\//} make manifests-release
- name: GoReleaser publish signed SBOM
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
# Local build output dir
bin/
testbin/
build/
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ release:
```
Supported architectures: `linux/amd64`, `linux/arm64` and `linux/arm/v7`.
extra_files:
- glob: build/source-watcher.deployment.yaml

changelog:
use: github-native
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ docker-build:
docker-push:
docker push ${IMG}

manifests-release:
mkdir -p ./build
mkdir -p config/release-tmp && cp config/release/* config/release-tmp
cd config/release-tmp && kustomize edit set image fluxcd/source-watcher=${IMG}
kustomize build config/release-tmp > ./build/source-watcher.deployment.yaml
rm -rf config/release-tmp

# Find or download controller-gen
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
.PHONY: controller-gen
Expand Down
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace: source-system
resources:
- ../rbac
- ../manager
- github.com/fluxcd/source-controller/config//crd?ref=v0.2.0
- github.com/fluxcd/source-controller/config//manager?ref=v0.2.0
- github.com/fluxcd/source-controller/config//crd?ref=main
- github.com/fluxcd/source-controller/config//manager?ref=main
- namespace.yaml
2 changes: 1 addition & 1 deletion config/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
terminationGracePeriodSeconds: 10
containers:
- name: manager
image: ghcr.io/fluxcd/source-watcher
image: fluxcd/source-watcher
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
Expand Down
4 changes: 0 additions & 4 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
images:
- name: ghcr.io/fluxcd/source-watcher
newName: ghcr.io/fluxcd/source-watcher
newTag: v0.10.0
19 changes: 19 additions & 0 deletions config/release-tmp/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: flux-system
resources:
- ../manager
patchesStrategicMerge:
- |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: source-watcher
spec:
template:
spec:
serviceAccountName: source-controller
images:
- name: fluxcd/source-watcher
newName: ghcr.io/fluxcd/source-watcher
newTag: v0.10.0
15 changes: 15 additions & 0 deletions config/release/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: flux-system
resources:
- ../manager
patchesStrategicMerge:
- |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: source-watcher
spec:
template:
spec:
serviceAccountName: source-controller

0 comments on commit 1bb3715

Please sign in to comment.