Skip to content

Commit

Permalink
initial chart (#24)
Browse files Browse the repository at this point in the history
* initial chart

* add icon

* add helm workflows

* add config

* config branch

* fix lint

* fix lint

* ignore paths

* fix lint

* add kind config

* fix branch
  • Loading branch information
davidkarlsen committed Sep 17, 2023
1 parent 3142772 commit 0bb8503
Show file tree
Hide file tree
Showing 21 changed files with 670 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ name: build
on:
pull_request:
branches:
- "*"
- "*"
paths-ignore:
- config/helm-chart/**
push:
branches:
- main
- main
tags:
- "v*"
- "v*"
paths-ignore:
- config/helm-chart/**

jobs:
build:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/chart-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Publish charts to repo"
on:
push:
branches:
- main
tags:
- "chart-*"
paths:
- "config/helm-chart/**"

jobs:
publish:
runs-on: ubuntu-latest
permissions:
pages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v3.5

- name: add repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add bitnami-pre2022 https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
with:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59 changes: 59 additions & 0 deletions .github/workflows/chart-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Test using kind and chart-testing tool"
on:
pull_request:
paths:
- "config/helm-chart/**"

jobs:
test:
strategy:
fail-fast: false
matrix:
kubernetesVersion: [ "v1.24.15", "v1.28.0" ]
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Shellcheck
uses: ludeeus/action-shellcheck@2.0.0

- name: Set up Helm
uses: azure/setup-helm@v3.5

- uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct-config.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --config ct-config.yaml

- name: Install kind
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.8.0
with:
node_image: "kindest/node:${{ matrix.kubernetesVersion }}"
config: kind-config.yaml
- name: Verify kind
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl cluster-info
kubectl get nodes -o wide
kubectl get pods -n kube-system
- name: Run chart-testing (install)
run: ct install --config ct-config.yaml
File renamed without changes.
1 change: 1 addition & 0 deletions config/helm-chart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
charts
23 changes: 23 additions & 0 deletions config/helm-chart/flyway-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions config/helm-chart/flyway-operator/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.11.1
digest: sha256:ead8f26c76a9ec082f23629a358e8efd8f88d87aaed734bf41febcb8a7bc5d4c
generated: "2023-09-17T21:09:19.356982+02:00"
16 changes: 16 additions & 0 deletions config/helm-chart/flyway-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: flyway-operator
description: Flyway Operator - an operator to do declarative database schema migration.
type: application
icon: https://pbs.twimg.com/profile_images/1339525060999192576/9ltj0fpE_400x400.png
version: 0.1.0
appVersion: 0.1.6
maintainers:
- name: davidkarlsen
email: david@davidkarlsen.com
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
tags:
- bitnami-common
version: 2.x.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: migrations.flyway.davidkarlsen.com
spec:
group: flyway.davidkarlsen.com
names:
kind: Migration
listKind: MigrationList
plural: migrations
singular: migration
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Migration is the Schema for the migrations API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: MigrationSpec defines the desired state of Migration
properties:
database:
description: settings for database connection
properties:
credentials:
description: reference to a secret containing the password for
connecting to database
properties:
key:
description: The key of the secret to select from. Must be
a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be
defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
jdbcUrl:
description: the jdbcUrl to connect to database
pattern: ^jdbc:.*
type: string
username:
description: username for connecting to database
type: string
required:
- credentials
- jdbcUrl
- username
type: object
migrationSource:
description: settings defining the SQL migrations
properties:
ImagePullSecret:
description: Optional. Image-pull secret to pull the migration
source
items:
description: LocalObjectReference contains enough information
to let you locate the referenced object inside the same namespace.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
type: array
encoding:
default: UTF-8
description: The encoding of the SQL-files.
type: string
flywayImage:
description: Reference to the flyway image to use.
type: string
imageRef:
description: Reference to the image holding the SQLs to migrate
type: string
path:
default: /sql
description: Path within the image to the SQLs for flyway
type: string
placeholders:
additionalProperties:
type: string
description: 'Flyway placeholders, see: https://documentation.red-gate.com/fd/placeholders-configuration-184127475.html
These will be injected as env-vars with the required prefix.'
type: object
required:
- encoding
- imageRef
- path
type: object
required:
- database
- migrationSource
type: object
status:
description: MigrationStatus defines the observed state of Migration
properties:
conditions:
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
type: object
type: object
served: true
storage: true
subresources:
status: {}
Empty file.
Loading

0 comments on commit 0bb8503

Please sign in to comment.