From 1e7054d869a1a9a5384d095bb54675087370bae3 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ahmed Date: Mon, 27 Feb 2023 22:52:20 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Update=20helm=20chart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/chart/.helmignore | 6 + deploy/chart/Chart.yaml | 32 +++-- deploy/chart/README.md | 38 ++++++ deploy/chart/templates/_helpers.tpl | 65 ++++++++-- deploy/chart/templates/configmap.yaml | 77 +----------- deploy/chart/templates/deployment.yaml | 136 ++++++--------------- deploy/chart/templates/rbac.yaml | 84 +------------ deploy/chart/templates/serviceaccount.yaml | 16 +-- deploy/chart/values.yaml | 105 ++++------------ 9 files changed, 193 insertions(+), 366 deletions(-) create mode 100644 deploy/chart/README.md diff --git a/deploy/chart/.helmignore b/deploy/chart/.helmignore index 21846e96..0e8a0eb3 100644 --- a/deploy/chart/.helmignore +++ b/deploy/chart/.helmignore @@ -1,4 +1,8 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. .DS_Store +# Common VCS dirs .git/ .gitignore .bzr/ @@ -6,11 +10,13 @@ .hg/ .hgignore .svn/ +# Common backup files *.swp *.bak *.tmp *.orig *~ +# Various IDEs .project .idea/ *.tmproj diff --git a/deploy/chart/Chart.yaml b/deploy/chart/Chart.yaml index aaa52288..f3ffd9ce 100644 --- a/deploy/chart/Chart.yaml +++ b/deploy/chart/Chart.yaml @@ -1,16 +1,26 @@ ---- apiVersion: v2 -appVersion: v0.8.0 -version: 0.2.0 name: kwatch -description: |4 - Helm chart to deploy Kwatch on Your kubernetes cluster. +version: "0.8.0" +appVersion: "v0.8.0" +description: monitor all changes in your Kubernetes(K8s) cluster, detects crashes + in your running apps in realtime, and publishes notifications to your channels (Slack, + Discord, etc.) instantly type: application +home: https://kwatch.dev +icon: https://kwatch.dev/img/kwatch-logo.png +sources: + - https://github.com/abahmed/kwatch keywords: -- kwatch + - kwatch + - kubernetes + - monitoring + - crash-reporting + - event-notifier maintainers: -- name: yaser - email: [email protected] - url: github.com/yaskinny -home: https://github.com/abahmed/kwatch -... + - email: [email protected] + name: Abdelrahman Ahmed + url: github.com/abahmed + - email: [email protected] + name: yaser + url: github.com/yaskinny + diff --git a/deploy/chart/README.md b/deploy/chart/README.md new file mode 100644 index 00000000..b06c2c45 --- /dev/null +++ b/deploy/chart/README.md @@ -0,0 +1,38 @@ +# kwatch Helm Chart + +monitor all changes in your Kubernetes(K8s) cluster, detects crashes in your running apps in realtime, and publishes notifications to your channels (Slack, +Discord, etc.) instantly + +## Add Repository + +```console +helm repo add kwatch https://kwatch.dev/charts +helm repo update +``` + +## Install Chart + +```console +helm install [RELEASE_NAME] kwatch/kwatch --version 0.8.0 +``` + +## Uninstall Chart + +```console +helm delete --purge [RELEASE_NAME] +``` + +## Configuration + +| Parameter | Description | Default | +|-----------|-------------|---------| +| `podAnnotations` | Pod annotations | {} | +| `securityContext.runAsNonRoot` | Container runs as a non-root user | true | +| `securityContext.runAsUser` | Container processes' UID to run the entrypoint | 101 | +| `securityContext.runAsGroup` | Container processes' GID to run the entrypoint | 101 | +| `securityContext.readOnlyRootFilesystem` | Container's root filesystem is read-only | true | +| `resources` | CPU/Memory resource requests/limits | {limits: memory: 128Mi cpu: 100m} | +| `nodeSelector` | Node labels for pod assignment | {} | +| `tolerations` | Tolerations for pod assignment | [] | +| `affinity` | affinity for pod | {} | +| `config` | [kwatch configuration](https://github.com/abahmed/kwatch#configuration) | {} | diff --git a/deploy/chart/templates/_helpers.tpl b/deploy/chart/templates/_helpers.tpl index c8d38ac8..5f290843 100644 --- a/deploy/chart/templates/_helpers.tpl +++ b/deploy/chart/templates/_helpers.tpl @@ -1,13 +1,62 @@ {{/* - Kubernetes common labels +Expand the name of the chart. */}} +{{- define "kwatch.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} -{{- define "kwatch.commonLabels" -}} -app.kubernetes.io/name: kwatch -app.kubernetes.io/version: {{ .Chart.AppVersion }} -{{- end -}} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "kwatch.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kwatch.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kwatch.labels" -}} +helm.sh/chart: {{ include "kwatch.chart" . }} +{{ include "kwatch.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} +{{/* +Selector labels +*/}} +{{- define "kwatch.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kwatch.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} -{{- define "kwatch.matchLabels" -}} -app.kubernetes.io/name: kwatch -{{- end -}} +{{/* +Create the name of the service account to use +*/}} +{{- define "kwatch.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "kwatch.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/deploy/chart/templates/configmap.yaml b/deploy/chart/templates/configmap.yaml index 7d3a9538..007b0b8a 100644 --- a/deploy/chart/templates/configmap.yaml +++ b/deploy/chart/templates/configmap.yaml @@ -1,79 +1,8 @@ -{{- $c := .Values.kwatch.config -}} -{{- if $c.create -}} -{{- $conf := $c.configTemplate -}} -{{- $conftpl := $c.configTemplate.alert -}} ---- apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-kwatch + name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} data: - config: |4 - maxRecentLogLines: {{ default 0 $conf.maxRecentLogLines }} - ignoreFailedGracefulShutdown: {{ default false $conf.ignoreFailedGracefulShutdown }} - disableUpdateCheck: {{ default false $conf.disableUpdateCheck }} - {{- with $conftpl.namespaces }} - namespaces: {{ toYaml . | indent 8 }} - {{- end }} - {{- if or $conftpl.slack.webhook $conftpl.telegram.token $conftpl.pagerduty.integrationKey $conftpl.discord.webhook $conftpl.teams.webhook $conftpl.rocketchat.webhook $conftpl.mattermost.webhook $conftpl.opsgenie.apiKey $conftpl.namespaces }} - alert: - {{- if $conftpl.slack.webhook }} - slack: - webhook: {{ $conftpl.slack.webhook | quote }} - title: {{ default "" $conftpl.slack.title | quote }} - text: {{ default "" $conftpl.slack.text | quote }} - {{- end }} - {{- if $conftpl.pagerduty.integrationKey }} - pagerduty: - integrationKey: {{ $conftpl.pagerduty.integrationKey | quote }} - {{- end }} - {{- if $conftpl.discord.webhook }} - discord: - webhook: {{ $conftpl.discord.webhook }} - title: {{ default "" $conftpl.discord.title | quote }} - text: {{ default "" $conftpl.discord.text | quote }} - {{- end }} - {{- if and $conftpl.telegram.token $conftpl.telegram.chatId }} - telegram: - token: {{ $conftpl.telegram.token }} - chatId: {{ $conftpl.telegram.chatId }} - {{- end }} - {{- if $conftpl.teams.webhook }} - teams: - webhook: {{ $conftpl.teams.webhook }} - title: {{ default "" $conftpl.teams.title | quote }} - text: {{ default "" $conftpl.teams.text | quote }} - {{- end }} - {{- if $conftpl.rocketchat.webhook }} - rocketchat: - webhook: {{ $conftpl.rocketchat.webhook }} - text: {{ default "" $conftpl.rocketchat.text | quote }} - {{- end }} - {{- if $conftpl.mattermost.webhook }} - mattermost: - webhook: {{ $conftpl.mattermost.webhook | quote }} - title: {{ default "" $conftpl.mattermost.title | quote }} - text: {{ default "" $conftpl.mattermost.text | quote }} - {{- end }} - {{- if $conftpl.opsgenie.apiKey }} - opsgenie: - apiKey: {{ $conftpl.opsgenie.apiKey | quote}} - title: {{ default "" $conftpl.opsgenie.title | quote }} - text: {{ default "" $conftpl.opsgenie.text | quote }} - {{- end }} - {{- end }} -... -{{- end }} + config.yaml: | + {{- toYaml .Values.config | nindent 4 }} \ No newline at end of file diff --git a/deploy/chart/templates/deployment.yaml b/deploy/chart/templates/deployment.yaml index d256e3e2..b547254f 100644 --- a/deploy/chart/templates/deployment.yaml +++ b/deploy/chart/templates/deployment.yaml @@ -1,117 +1,53 @@ -{{- $k := .Values.kwatch -}} ---- apiVersion: apps/v1 kind: Deployment metadata: + name: {{ include "kwatch.fullname" . }} namespace: {{ .Release.Namespace }} - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} + {{- include "kwatch.labels" . | nindent 4 }} spec: - replicas: {{ default 1 $k.replicas }} - strategy: - {{- if and $k.strategy.type (eq $k.strategy.type "RollingUpdate") }} - type: RollingUpdate - rollingUpdate: - maxUnavailable: {{ default 0 $k.strategy.maxUnavailable }} - maxSurge: {{ default 0 $k.strategy.maxSurge }} - {{- else }} - type: Recreate - {{- end }} + replicas: {{ default 1 }} selector: matchLabels: - {{- include "kwatch.matchLabels" . | nindent 6 }} - {{- if .Values.commonLabels }} - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 6 }} - {{- end }} - {{- end }} + {{- include "kwatch.selectorLabels" . | nindent 6 }} template: metadata: - labels: - {{- include "kwatch.commonLabels" . | nindent 8 }} - {{- if .Values.commonLabels }} - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} + {{- with .Values.podAnnotations }} annotations: - {{- with .Values.commonAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} - {{- end }} + labels: + {{- include "kwatch.selectorLabels" . | nindent 8 }} spec: - serviceAccountName: {{ .Release.Name }}-kwatch - {{- if .Values.privateRegistries }} - {{- range .Values.privateRegistries }} - imagePullSecrets: - - name: {{ . | quote }} + restartPolicy: Always + serviceAccountName: {{ .Release.Name }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: config-volume + mountPath: /config + env: + - name: CONFIG_FILE + value: "/config/config.yaml" + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} {{- end }} - containers: - - name: kwatch - image: {{ tpl $k.image . | quote }} - imagePullPolicy: {{ default "IfNotPresent" $k.imagePullPolicy }} - volumeMounts: - - name: config - mountPath: /config.yaml - subPath: config.yaml - readOnly: true - env: - - name: CONFIG_FILE - value: "/config.yaml" - {{- with $k.envFrom }} - envFrom: {{ toYaml . | nindent 10 }} - {{- end }} - resources: - {{- if $k.resources.requests }} - requests: - memory: {{ default "128Mi" $k.resources.requests.memory }} - cpu: {{ default "100m" $k.resources.requests.cpu }} - {{- end }} - limits: - memory: {{ default "128Mi" $k.resources.limits.memory }} - cpu: {{ default "100m" $k.resources.limits.cpu }} - securityContext: - {{- with $k.securityContext }} - {{- toYaml . | nindent 10 }} - {{- end }} volumes: - - name: config - {{- if not $k.config.create }} - {{- if $k.config.secret }} - {{- if and $k.config.secret.name $k.config.secret.key }} - secret: - secretName: {{ $k.config.secret.name }} - items: - - key: {{ $k.config.secret.key }} - path: config.yaml - {{- end }} - {{- else if $k.config.configMap }} - {{- if and $k.config.configMap.name $k.config.configMap.key }} - configMap: - name: {{ $k.config.configMap.name }} - items: - - key: {{ $k.config.configMap.key }} - path: config.yaml - {{- end }} - {{- end }} - {{- else }} - configMap: - name: {{ .Release.Name }}-kwatch - items: - - key: config - path: config.yaml - {{- end }} -... + - name: config-volume + configMap: + name: {{ .Release.Name }} diff --git a/deploy/chart/templates/rbac.yaml b/deploy/chart/templates/rbac.yaml index 59eb8efc..3f8334e1 100644 --- a/deploy/chart/templates/rbac.yaml +++ b/deploy/chart/templates/rbac.yaml @@ -1,68 +1,7 @@ -{{ if .Values.kwatch.namespaced }} ---- -kind: Role -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} -rules: - - apiGroups: [""] - resources: ["pods", "pods/log", "events"] - verbs: ["get", "watch", "list"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: {{ .Release.Name }}-kwatch -subjects: - - kind: ServiceAccount - name: {{ .Release.Name }}-kwatch - namespace: {{ .Release.Namespace }} -{{ else }} ---- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} + name: {{ .Release.Name }} rules: - apiGroups: [""] resources: ["pods", "pods/log", "events"] @@ -71,25 +10,12 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} + name: {{ .Release.Name }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: {{ .Release.Name }}-kwatch + name: {{ .Release.Name }} subjects: - kind: ServiceAccount - name: {{ .Release.Name }}-kwatch - namespace: {{ .Release.Namespace }} -{{ end }} \ No newline at end of file + name: {{ .Release.Name }} + namespace: {{ .Release.Namespace }} \ No newline at end of file diff --git a/deploy/chart/templates/serviceaccount.yaml b/deploy/chart/templates/serviceaccount.yaml index 234eda5c..81c0d7ed 100644 --- a/deploy/chart/templates/serviceaccount.yaml +++ b/deploy/chart/templates/serviceaccount.yaml @@ -1,19 +1,5 @@ ---- apiVersion: v1 kind: ServiceAccount metadata: + name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} - name: {{ .Release.Name }}-kwatch - {{- if .Values.commonLabels }} - labels: - {{- with .Values.commonLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: - {{- with .Values.commonAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - {{- end }} -... diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index bf00d39e..0cd85e69 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -1,82 +1,29 @@ ---- -commonLabels: {} -commonAnnotations: {} +# Default values for kwatch. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. -privateRegistries: [] +image: + repository: ghcr.io/abahmed/kwatch + pullPolicy: Always + +securityContext: + runAsUser: 101 + runAsGroup: 101 + runAsNonRoot: true + readOnlyRootFilesystem: true + +resources: + limits: + memory: 128Mi + cpu: 100m + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +# kwatch configuration +config: {} -kwatch: - ## if true kwatch will be deployed with permissions only - ## for the namepsace it is deployed to. - namespaced: false - strategy: - type: Recreate - # type: RollingUpdate - # maxSurge: 1 - # maxUnavailable: 0 - image: ghcr.io/abahmed/kwatch:{{ .Chart.AppVersion }} - imagePullPolicy: Always - resources: - # requests: - # memory: 128Mi - # cpu: 100m - limits: - memory: 128Mi - cpu: 100m - securityContext: - runAsUser: 65534 - runAsGroup: 65534 - runAsNonRoot: true - privileged: false - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - capabilities: - drop: - - ALL - envFrom: [] - config: - ## if You want to provide your own config as a secret or configMap - ## set create to false and set appropriate values - # configMap: - # name: my-config - # key: kwatch - ## OR for secret - # secret: - # name: my-secret-config - # key: secret-kwatch - create: true - configTemplate: - namespaces: [] - maxRecentLogLines: 0 - ignoreFailedGracefulShutdown: false - disableUpdateCheck: false - alert: - slack: - webhook: "" - title: "" - text: "" - pagerduty: - integrationKey: "" - discord: - webhook: "" - title: "" - text: "" - telegram: - token: "" - chatId: "" - teams: - webhook: "" - title: "" - text: "" - rocketchat: - webhook: "" - text: "" - mattermost: - webhook: "" - title: "" - text: "" - opsgenie: - apiKey: "" - title: "" - text: "" -... From 65cbf28216f8c1a2a66cac8df12aa0a9d3aa4871 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ahmed Date: Mon, 27 Feb 2023 22:54:55 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Update=20helm=20chart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 38001a47..440ee8c5 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,17 @@ ### Install +#### Using Helm + +```shell +helm repo add kwatch https://kwatch.dev/charts +helm install [RELEASE_NAME] kwatch/kwatch --namespace kwatch --create-namespace --version 0.8.0 +``` + +To get more details, please check [chart's configuration](https://github.com/abahmed/kwatch/blob/main/deploy/chart/README.md) + +### Using kubectl + You need to get config template to add your configs ```shell From e263ffac4daca2652489815da86ba73ed22b12c4 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ahmed Date: Mon, 27 Feb 2023 22:55:43 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Update=20helm=20chart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 440ee8c5..a7adddfa 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ helm install [RELEASE_NAME] kwatch/kwatch --namespace kwatch --create-namespace To get more details, please check [chart's configuration](https://github.com/abahmed/kwatch/blob/main/deploy/chart/README.md) -### Using kubectl +#### Using kubectl You need to get config template to add your configs From f3416ba5b7e4606cb095ae70a83fdf94c8674bf2 Mon Sep 17 00:00:00 2001 From: Abdelrahman Ahmed Date: Mon, 6 Mar 2023 11:11:32 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=80=20support=20multi=20arch=20doc?= =?UTF-8?q?ker=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 14 +++++--------- .github/workflows/publish.yml | 16 +++++++++------- Dockerfile | 4 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 61eec556..79ccd05c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,22 +10,18 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.20' - - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.ref }} - + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' - name: Build run: go build - - name: Test run: go test -race --coverprofile=coverage.txt --covermode=atomic ./... - - name: Upload coverage to Codecov if: success() && github.ref == 'refs/heads/main' uses: codecov/codecov-action@v1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 567caaaf..caa6ea7d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,24 +10,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 - + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4 with: images: ghcr.io/abahmed/kwatch - - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 context: . push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 5423ac51..e4c9b556 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:alpine AS builder ARG RELEASE_VERSION="nothing" -LABEL maintainer="Abdelrahman Ahmed