Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create project #1

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
sections:
- title: Major changes
labels:
- "release/super-feature"
- title: Complete changelog
labels:
- "bug"
- "enhancement"
- "dependencies"
template: |
Add Adminer helm chart template as dependency to Chart.yaml:
```yaml
dependencies:
- name: adminer
alias: app
version: "{{ .Version }}"
repository: oci://ghcr.io/onecx/charts
```

{{ range $section := .Sections }}{{ if $section.Items }}### {{ $section.GetTitle }}{{ range $item := $section.Items }}
* [#{{ $item.GetID }}]({{ $item.GetURL }}) - {{ $item.GetTitle }}{{ end }}{{ end }}
{{ end }}
17 changes: 17 additions & 0 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build Feature Branch

on:
workflow_dispatch:
push:
branches:
- '**'
- '!main'
- '!fix/[0-9]+.[0-9]+.x'

jobs:
helm:
uses: onecx/ci-common/.github/workflows/helm-build.yml@v1
secrets: inherit
with:
helmDir: 'helm'
artifact: ''
14 changes: 14 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build Pull Request
on:
pull_request:
branches:
- 'main'
- 'fix/[0-9]+.[0-9]+.x'

jobs:
helm:
uses: onecx/ci-common/.github/workflows/helm-build.yml@v1
secrets: inherit
with:
helmDir: 'helm'
artifact: ''
13 changes: 13 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Build Release
on:
push:
tags:
- '**'
jobs:
helm:
uses: onecx/ci-common/.github/workflows/helm-release.yml@v1
secrets: inherit
changelog:
uses: onecx/ci-common/.github/workflows/generate-changelog.yml@v1
needs: helm
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'fix/[0-9]+.[0-9]+.x'

jobs:
helm:
uses: onecx/ci-common/.github/workflows/helm-build.yml@v1
secrets: inherit
with:
push: true
artifact: ''
helmDir: 'helm'
templateValuesYaml: ''
helm-event:
uses: onecx/ci-product/.github/workflows/helm-send-event.yml@v1
needs: helm
secrets: inherit
with:
targetRepository: onecx/onecx-develop
7 changes: 7 additions & 0 deletions .github/workflows/create-fix-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Create Fix Branch
on:
workflow_dispatch:
jobs:
fix:
uses: onecx/ci-common/.github/workflows/create-fix-branch.yml@v1
secrets: inherit
7 changes: 7 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Create Release Version
on:
workflow_dispatch:
jobs:
release:
uses: onecx/ci-common/.github/workflows/create-release.yml@v1
secrets: inherit
12 changes: 12 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: onecx-develop-adminer
version: 0.0.0
appVersion: 0.0.0
description: adminer
keywords:
- adminer
sources:
- https://github.com/onecx/onecx-develop-adminer
maintainers:
- name: Tkit Developer
email: [email protected]
19 changes: 19 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- define "app.fullname" -}}
{{ .Release.Name }}-{{ .Values.name | default .Chart.Name }}
{{- end -}}

{{- define "app.product.name" -}}
{{ .Release.Name }}
{{- end -}}

{{- define "app.version" -}}
{{ .Values.image.tag }}
{{- end -}}

{{- define "app.labels.common" -}}
version: {{ .Chart.Version | replace "+" "_" }}
adminer: {{ .Values.image.tag | quote }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/name: {{ template "app.fullname" $ }}
{{- end -}}
33 changes: 33 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "app.labels.common" $ | indent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ include "app.fullname" . }}
template:
metadata:
labels:
app: {{ include "app.fullname" . }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.imagePullSecrets }}
{{- end }}
containers:
- name: {{ include "app.fullname" . }}
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
env:
- name: ADMINER_DESIGN
value: {{ .Values.theme }}
{{- if .Values.db.server }}
- name: ADMINER_DEFAULT_SERVER
value: {{ .Values.db.server }}
{{- end }}
restartPolicy: Always
terminationGracePeriodSeconds: 30
33 changes: 33 additions & 0 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.routing.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "app.labels.common" $ | indent 4 }}
annotations:
{{- if .Values.traefik.middleware.auth.enabled }}
traefik.ingress.kubernetes.io/router.middlewares: {{ include "app.fullname" . }}-auth@kubernetescrd
{{- end }}
{{- if .Values.routing.ingress.annotations }}
{{ toYaml .Values.routing.ingress.annotations | indent 4 }}
{{- end }}
spec:
rules:
- http:
paths:
- path: "/"
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-{{ .Values.name | default .Chart.Name }}
port:
number: {{ .Values.service.port }}
{{ if .Values.routing.ingress.host.override }}
host: {{ .Values.routing.ingress.host.override }}.{{ .Values.global.default_url | default .Values.routing.default_url }}
{{ else if .Values.routing.ingress.host.name }}
host: {{ .Values.routing.ingress.host.name }}-{{ .Release.Namespace }}.{{ .Values.global.default_url | default .Values.routing.default_url }}
{{ else }}
host: {{ .Release.Name }}-{{ .Values.name | default .Chart.Name }}-{{ .Release.Namespace }}.{{ .Values.global.default_url | default .Values.routing.default_url }}
{{- end }}
{{ end }}
18 changes: 18 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
kind: Service
apiVersion: v1
metadata:
name: {{ include "app.fullname" . }}
labels:
{{ include "app.labels.common" $ | indent 4 }}
annotations:
description: {{ include "app.fullname" . }}
spec:
selector:
app: {{ include "app.fullname" . }}
ports:
- name: http
protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.pod.port }}
type: ClusterIP
sessionAffinity: None
11 changes: 11 additions & 0 deletions helm/templates/traefik-middleware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.traefik.middleware.auth.enabled }}
kind: Middleware
apiVersion: traefik.io/v1alpha1
metadata:
name: {{ include "app.fullname" . }}-auth
labels:
{{ include "app.labels.common" $ | indent 4 }}
spec:
basicAuth:
secret: {{ include "app.fullname" . }}-auth
{{- end }}
11 changes: 11 additions & 0 deletions helm/templates/traefik-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.traefik.middleware.auth.enabled }}
kind: Secret
apiVersion: v1
metadata:
name: {{ include "app.fullname" . }}-auth
labels:
{{ include "app.labels.common" $ | indent 4 }}
type: Opaque
data:
users: {{ .Values.traefik.middleware.auth.users }}
{{- end }}
69 changes: 69 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# global configuration
global:
# global host name
default_url:

# Name of the instance, default {{ .Release.Name }}-{{ .Values.name | default .Chart.Name }}
name: adminer

# Adminer image
image:
# Docker registry
registry: "docker.io"
# Docker image
repository: "adminer"
# Docker version
tag: 4.8.1-standalone

# service
service:
port: 8080

# post configuration
pod:
# pot port
port: 8080

imagePullPolicy: IfNotPresent

# Route
routing:
# Enable or disable route
enabled: true

# Default URL
default_url: "change.com"

# ingress
ingress:
# host configuration
host:
# prio1 if the name is define generate domain <override>.<default_url>
override :
# prio2 if the name is define generate domain <name>-<release_namespace>.<default_url>
name:
# else <release_name>-<name of chart_name>-<release_namespace>.<default_url>

# aditional annotations
annotations: {}
# traefik.ingress.kubernetes.io/router.middlewares: traefik-develop-basic-auth@kubernetescrd

# database configuration
db:
# default server
server:

# Replicas
replicas: 1

# Adminer theme
theme: "pepa-linha"

# Custom resources
traefik:
middleware:
auth:
# enable or disabel traefik middleware
enabled: true
# user:password hash
users: