diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..bbf22ce2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + 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: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: | + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..3a86f1a1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Test +on: [push, pull_request] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.19 + uses: actions/setup-go@v3 + with: + go-version: 1.19 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Build + run: go build -v . + + - name: Test + run: go test ./... \ No newline at end of file diff --git a/charts/kubernetes-event-exporter/Chart.yaml b/charts/kubernetes-event-exporter/Chart.yaml index 5f753a68..86a586d7 100644 --- a/charts/kubernetes-event-exporter/Chart.yaml +++ b/charts/kubernetes-event-exporter/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: kubernetes-event-exporter description: Export Kubernetes events to multiple destinations with routing and filtering type: application -version: 0.2.3 +version: 0.2.1 appVersion: "v1.1" home: https://github.com/resmoio/kubernetes-event-exporter diff --git a/charts/kubernetes-event-exporter/templates/role.yaml b/charts/kubernetes-event-exporter/templates/role.yaml index bbc034a2..ca487725 100644 --- a/charts/kubernetes-event-exporter/templates/role.yaml +++ b/charts/kubernetes-event-exporter/templates/role.yaml @@ -3,10 +3,12 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: {{ .Values.rbac.namespaced | ternary "Role" "ClusterRole" }} metadata: - namespace: {{ include "kubernetes-event-exporter.namespace" . }} name: {{ include "kubernetes-event-exporter.fullname" . }} labels: {{- include "kubernetes-event-exporter.labels" . | nindent 4 }} + {{- if .Values.rbac.namespaced }} + namespace: {{ include "kubernetes-event-exporter.namespace" . }} + {{- end }} rules: {{ toYaml .Values.rbac.rules }} {{- end -}} diff --git a/charts/kubernetes-event-exporter/templates/rolebinding.yaml b/charts/kubernetes-event-exporter/templates/rolebinding.yaml index c0be3700..684d87f5 100644 --- a/charts/kubernetes-event-exporter/templates/rolebinding.yaml +++ b/charts/kubernetes-event-exporter/templates/rolebinding.yaml @@ -4,15 +4,19 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: {{ .Values.rbac.namespaced | ternary "RoleBinding" "ClusterRoleBinding" }} metadata: name: {{ include "kubernetes-event-exporter.fullname" . }} - namespace: {{ include "kubernetes-event-exporter.namespace" . }} labels: - {{- include "kubernetes-event-exporter.labels" . | nindent 4 }} + {{- include "kubernetes-event-exporter.labels" . | nindent 4 }} + {{- if .Values.rbac.namespaced }} + namespace: {{ include "kubernetes-event-exporter.namespace" . }} + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: {{ .Values.rbac.namespaced | ternary "Role" "ClusterRole" }} name: {{ include "kubernetes-event-exporter.fullname" . }} subjects: - kind: ServiceAccount + {{- if .Values.rbac.namespaced }} namespace: {{ include "kubernetes-event-exporter.namespace" . }} + {{- end }} name: {{ include "kubernetes-event-exporter.fullname" . }} {{- end }}