-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add semantic-release and Helm chart; push Docker image and Helm…
… chart to ghcr.io BREAKING CHANGE: not really a breaking change, just bumping to v1.0.0
- Loading branch information
1 parent
42b94f2
commit 5ef6c3e
Showing
41 changed files
with
324 additions
and
589 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
name: Build Container (branches) | ||
name: Build docker image on branches | ||
on: | ||
push: | ||
branches: | ||
- /refs/heads/* | ||
- !master | ||
branches-ignore: | ||
- main | ||
jobs: | ||
build: | ||
name: Docker Build and Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker build and publish | ||
uses: docker/build-push-action@v1 | ||
- name: Docker build | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
repository: logmein/k8s-aws-operator | ||
tag_with_ref: false | ||
tag_with_sha: false | ||
context: . | ||
push: false | ||
|
This file was deleted.
Oops, something went wrong.
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,71 @@ | ||
name: Publish Docker image and Helm chart | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
name: Buld and push Docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: | ||
imageDigest: ${{ steps.build-and-push.outputs.digest }} | ||
|
||
build-and-push-chart: | ||
name: Buld and push Helm chart | ||
needs: build-and-push-image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Helm login | ||
shell: bash | ||
run: echo ${{ secrets.GITHUB_TOKEN }} | helm registry login -u ${{ github.actor }} --password-stdin ghcr.io | ||
|
||
- name: Helm package | ||
shell: bash | ||
run: helm package charts/${{ github.event.repository.name }} --app-version ${{ github.event.release.tag_name }}@${{needs.build-and-push-image.outputs.imageDigest}} --version ${{ github.event.release.tag_name }}-chart | ||
|
||
- name: Helm push | ||
shell: bash | ||
run: helm push ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-chart.tgz oci://ghcr.io/${{ github.repository_owner }} | ||
|
||
- name: Helm logout | ||
shell: bash | ||
run: helm registry logout ghcr.io |
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,29 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
semantic-release: | ||
name: Run semantic-release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
issues: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@071ef4c9640be3700de2aa7f39e8f4038e0269ed | ||
with: | ||
extra_plugins: | | ||
[email protected] | ||
@semantic-release/[email protected] | ||
@semantic-release/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,13 @@ | ||
verifyConditions: [] | ||
branches: | ||
- main | ||
plugins: | ||
- '@semantic-release/commit-analyzer' | ||
- - '@semantic-release/release-notes-generator' | ||
- preset: conventionalcommits | ||
- - '@semantic-release/changelog' | ||
- changelogFile: CHANGELOG.md | ||
- - '@semantic-release/git' | ||
- assets: | ||
- CHANGELOG.md | ||
message: "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
type: application | ||
name: k8s-aws-operator | ||
version: 0.0.0-placeholder | ||
appVersion: v0.0.0-placeholder | ||
description: Operator for managing ENIs and EIPs in AWS from within Kubernetes | ||
home: https://github.com/goto-opensource/k8s-aws-operator | ||
maintainers: | ||
- name: Alfred Krohmer | ||
email: [email protected] | ||
url: https://github.com/alfredkrohmer |
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,42 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
spec: | ||
replicas: {{ .Values.replicas }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
spec: | ||
serviceAccountName: {{ .Chart.Name }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: {{ . | toYaml | nindent 6 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: {{ . | toYaml | nindent 6 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: {{ . | toYaml | nindent 6 }} | ||
{{- end }} | ||
{{- with .Values.topologySpreadConstraints }} | ||
topologySpreadConstraints: {{ . | toYaml | nindent 6 }} | ||
{{- end }} | ||
containers: | ||
- name: k8s-aws-operator | ||
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }} | ||
resources: {{ .Values.resources | toYaml | nindent 10 }} | ||
args: | ||
- -region={{ required "aws.region is required" .Values.aws.region }} | ||
{{- if or .Values.leaderElection.enabled (gt (.Values.replicas | int) 1) }} | ||
- -leader-election-namespace={{ .Release.Namespace }} | ||
{{- end }} | ||
ports: | ||
- name: metrics | ||
containerPort: 8080 | ||
protocol: TCP |
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,75 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{ . | toYaml | nindent 4 }} | ||
{{- end }} | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["get"] | ||
- apiGroups: ["aws.k8s.logmein.com"] | ||
resources: ["eips", "enis"] | ||
verbs: ["*"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ .Chart.Name }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Chart.Name }} | ||
namespace: {{ .Release.Namespace }} | ||
|
||
# for leader election: | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
rules: | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["create"] | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
resourceNames: ["k8s-aws-operator"] | ||
verbs: ["delete","get","update","watch"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ .Chart.Name }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Chart.Name }} | ||
namespace: {{ .Release.Namespace }} |
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,19 @@ | ||
{{- if .Values.metrics.serviceMonitor.enable }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Chart.Name }}-metrics | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
spec: | ||
{{- with .Values.metrics.service.clusterIP }} | ||
clusterIP: {{ . | quote }} | ||
{{- end }} | ||
ports: | ||
- name: metrics | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
{{- end }} |
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,16 @@ | ||
{{- if .Values.metrics.serviceMonitor.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ .Chart.Name }} | ||
endpoints: | ||
{{- with .Values.metrics.serviceMonitor.endpoints }} | ||
{{ . | toYaml | nindent 2 }} | ||
{{- end}} | ||
{{- end }} |
Oops, something went wrong.