Skip to content

Commit

Permalink
feat: migration
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Dec 14, 2023
1 parent 5f30644 commit d6bbca4
Show file tree
Hide file tree
Showing 33 changed files with 1,673 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sections:
- title: Major changes
labels:
- "release/super-feature"
- title: Complete changelog
labels:
- "bug"
- "enhancement"
- "dependencies"
template: |
{{ range $section := .Sections }}{{ if $section.Items }}### {{ $section.GetTitle }}{{ range $item := $section.Items }}
* [#{{ $item.GetID }}]({{ $item.GetURL }}) - {{ $item.GetTitle }}{{ end }}{{ end }}
{{ end }}
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
labels:
- dependencies
13 changes: 13 additions & 0 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Build Feature Branch

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

jobs:
branch:
uses: onecx/ci-quarkus/.github/workflows/build-branch.yml@v1
secrets: inherit
9 changes: 9 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build Pull Request

on:
pull_request:

jobs:
pr:
uses: onecx/ci-quarkus/.github/workflows/build-pr.yml@v1
secrets: inherit
9 changes: 9 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build Release
on:
push:
tags:
- '**'
jobs:
release:
uses: onecx/ci-quarkus/.github/workflows/build-release.yml@v1
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'
paths-ignore:
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- '*.md'
- '*.adoc'
- '*.txt'
- '.all-contributorsrc'

jobs:
build:
uses: onecx/ci-quarkus/.github/workflows/build.yml@v1
secrets: inherit
with:
helmEventTargetRepository: onecx/onecx-k8s
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
10 changes: 10 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Update documentation
on:
push:
branches: [ main ]
paths:
- 'docs/**'
jobs:
release:
uses: onecx/ci-common/.github/workflows/documentation.yml@v1
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/sonar-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Sonar Pull Request

on:
workflow_run:
workflows: ["Build Pull Request"]
types:
- completed

jobs:
pr:
uses: onecx/ci-quarkus/.github/workflows/quarkus-pr-sonar.yml@v1
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
target
*.iml
67 changes: 67 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.onecx</groupId>
<artifactId>onecx-quarkus3-parent</artifactId>
<version>0.23.0</version>
</parent>

<artifactId>onecx-k8s-db-postgresql-operator</artifactId>
<version>999-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk-bundle-generator</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.operatorsdk</groupId>
<artifactId>quarkus-operator-sdk</artifactId>
</dependency>

<!-- 1000kit -->
<dependency>
<groupId>org.tkit.quarkus.lib</groupId>
<artifactId>tkit-quarkus-log-cdi</artifactId>
</dependency>
<dependency>
<groupId>org.tkit.quarkus.lib</groupId>
<artifactId>tkit-quarkus-log-rs</artifactId>
</dependency>
<dependency>
<groupId>org.tkit.quarkus.lib</groupId>
<artifactId>tkit-quarkus-log-json</artifactId>
</dependency>

<!-- QUARKUS -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>

<!-- TEST -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
15 changes: 15 additions & 0 deletions src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM registry.access.redhat.com/ubi8/openjdk-17:1.15

ENV LANGUAGE='en_US:en'

# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/quarkus-app/*.jar /deployments/
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"

11 changes: 11 additions & 0 deletions src/main/docker/Dockerfile.native
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
19 changes: 19 additions & 0 deletions src/main/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: onecx-k8s-db-postgresql-operator
version: 0.0.0
appVersion: 0.0.0
description: Onecx k8s postgresql database schema operator
keywords:
- postgresql
- k8s
- operator
sources:
- https://github.com/onecx/onecx-k8s-db-postgresql-operator
maintainers:
- name: Tkit Developer
email: [email protected]
dependencies:
- name: helm-quarkus-app
alias: app
version: ^0
repository: oci://ghcr.io/onecx/charts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: databases.io.github.onecx.operator.db.postgresql
spec:
group: io.github.onecx.operator.db.postgresql
names:
kind: Database
plural: databases
singular: database
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
properties:
extensions:
items:
type: string
type: array
host:
type: string
name:
type: string
password-key:
type: string
password-secrets:
type: string
schema:
type: string
user:
type: string
user-search-path:
type: string
type: object
status:
properties:
message:
type: string
observedGeneration:
type: integer
password-secrets:
type: string
status:
enum:
- CREATED
- ERROR
- UNDEFINED
- UPDATED
type: string
url:
type: string
user:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
12 changes: 12 additions & 0 deletions src/main/helm/templates/operator-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ .Release.Namespace }}
12 changes: 12 additions & 0 deletions src/main/helm/templates/operator-cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-validating-cluster-role
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
43 changes: 43 additions & 0 deletions src/main/helm/templates/product-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{ if eq $.Values.watchNamespaces "JOSDK_WATCH_CURRENT" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
{{ else if eq $.Values.watchNamespaces "JOSDK_ALL_NAMESPACES" }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ $.Release.Namespace }}
{{ else }}
{{ range $anamespace := ( split "," $.Values.watchNamespaces ) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}-{{ .Values.app.name }}-role-binding
namespace: {{ $anamespace }}
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-{{ .Values.app.name }}
namespace: {{ $.Release.Namespace }}
---
{{- end }}
{{- end }}
Loading

0 comments on commit d6bbca4

Please sign in to comment.