-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts for generating manifests
Add a script for generating the kubernetes manifest from a template. This allows for adding manifest files for specific release tags to the github releases. To ensure this is automated, add a release workflow as well. To check if the example manifest is up to date, add it to the validate script. Signed-off-by: Heathcliff <[email protected]>
- Loading branch information
1 parent
4926e61
commit f8018a9
Showing
10 changed files
with
308 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
draft: | ||
description: "Create draft release" | ||
type: boolean | ||
default: true | ||
update: | ||
description: "Update existing release" | ||
type: boolean | ||
default: false | ||
tag: | ||
description: "Release tag to use" | ||
type: string | ||
required: true | ||
latest: | ||
description: "Tag container as latest" | ||
type: boolean | ||
default: false | ||
prerelease: | ||
description: "Mark the release as a prerelease" | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/ci.yaml | ||
permissions: | ||
contents: read | ||
packages: write | ||
with: | ||
tag: ${{ inputs.tag }} | ||
latest: ${{ inputs.latest }} | ||
secrets: inherit | ||
|
||
release: | ||
uses: heathcliff26/ci/.github/workflows/golang-release.yaml@main | ||
needs: build | ||
permissions: | ||
contents: write | ||
with: | ||
draft: ${{ inputs.draft }} | ||
update: ${{ inputs.update }} | ||
tag: ${{ inputs.tag }} | ||
release-artifacts: "release/*" | ||
artifacts: "{manifests}" | ||
prerelease: ${{ inputs.prerelease }} |
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
File renamed without changes.
File renamed without changes.
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,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
base_dir="$(dirname "${BASH_SOURCE[0]}" | xargs realpath)/.." | ||
|
||
export REPOSITORY="${REPOSITORY:-ghcr.io/heathcliff26}" | ||
export TAG="${TAG:-latest}" | ||
export FLEETLOCK_NAMESPACE="${FLEETLOCK_NAMESPACE:-fleetlock}" | ||
|
||
output_dir="${base_dir}/manifests/release" | ||
|
||
if [[ "${RELEASE_VERSION}" != "" ]] && [[ "${TAG}" == "latest" ]]; then | ||
TAG="${RELEASE_VERSION}" | ||
fi | ||
|
||
[ ! -d "${output_dir}" ] && mkdir "${output_dir}" | ||
|
||
echo "Creating deployment.yaml" | ||
envsubst < "${base_dir}/manifests/base/deployment.yaml.template" > "${output_dir}/deployment.yaml" | ||
|
||
echo "Wrote manifests to ${output_dir}" | ||
|
||
if [ "${TAG}" == "latest" ]; then | ||
echo "Tag is latest, syncing manifests with examples" | ||
cp "${output_dir}"/*.yaml "${base_dir}/examples/" | ||
fi |
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,172 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ${FLEETLOCK_NAMESPACE} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: fleetlock-config | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
labels: | ||
app: fleetlock | ||
data: | ||
config.yaml: | | ||
--- | ||
logLevel: info | ||
storage: | ||
type: kubernetes | ||
groups: | ||
default: | ||
slots: 1 | ||
master: | ||
slots: 1 | ||
worker: | ||
slots: 1 | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: fleetlock-leases | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
rules: | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["*"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: fleetlock-leases | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: fleetlock | ||
roleRef: | ||
kind: Role | ||
name: fleetlock-leases | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["list", "patch"] | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["list"] | ||
- apiGroups: [""] | ||
resources: ["pods/eviction"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
roleRef: | ||
kind: ClusterRole | ||
name: fleetlock | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
labels: | ||
app: fleetlock | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: fleetlock | ||
template: | ||
metadata: | ||
labels: | ||
app: fleetlock | ||
spec: | ||
serviceAccountName: fleetlock | ||
containers: | ||
- name: fleetlock | ||
image: ${REPOSITORY}/fleetlock:${TAG} | ||
args: | ||
- "-c" | ||
- "/config/config.yaml" | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: "/healthz" | ||
port: http | ||
initialDelaySeconds: 5 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
readinessProbe: | ||
httpGet: | ||
path: "/healthz" | ||
port: http | ||
initialDelaySeconds: 5 | ||
periodSeconds: 5 | ||
volumeMounts: | ||
- mountPath: /config | ||
name: fleetlock-config | ||
volumes: | ||
- name: fleetlock-config | ||
configMap: | ||
name: fleetlock-config | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
labels: | ||
app: fleetlock | ||
spec: | ||
selector: | ||
app: fleetlock | ||
type: ClusterIP | ||
ports: | ||
- protocol: TCP | ||
port: 8080 | ||
targetPort: 8080 | ||
name: http | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: fleetlock | ||
namespace: ${FLEETLOCK_NAMESPACE} | ||
labels: | ||
app: fleetlock | ||
spec: | ||
rules: | ||
- host: fleetlock.example.org | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: fleetlock | ||
port: | ||
name: http |