Refactor the reconciler and add Woodpecker CI
Now controller looks a bit better and its parts can be tested with integration tests, that are going to be implemented later.
This commit is contained in:
6
tests/manifests/configmap.yaml
Normal file
6
tests/manifests/configmap.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: database-configmap
|
||||
data:
|
||||
PROTOCOL: postgresql
|
44
tests/manifests/example.yaml
Normal file
44
tests/manifests/example.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
apiVersion: shoebill.badhouseplants.net/v1alpha1
|
||||
kind: ConfigSet
|
||||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
targets:
|
||||
- name: app-connection-string
|
||||
target:
|
||||
kind: Secret
|
||||
name: app-connection-string
|
||||
inputs:
|
||||
- name: PROTO
|
||||
from:
|
||||
kind: ConfigMap
|
||||
name: database-configmap
|
||||
key: PROTOCOL
|
||||
- name: PASSWORD
|
||||
from:
|
||||
kind: Secret
|
||||
name: database-secret
|
||||
key: PASSWORD
|
||||
- name: USERNAME
|
||||
from:
|
||||
kind: Secret
|
||||
name: database-secret
|
||||
key: USERNAME
|
||||
- name: DATABASE
|
||||
from:
|
||||
kind: Secret
|
||||
name: database-secret
|
||||
key: DATABASE
|
||||
templates:
|
||||
- name: CONNECTION
|
||||
template: "{{ PROTO }}:{{ USERNAME }}:{{ PASSWORD }}/{{ DATABASE }}"
|
||||
target: app-connection-string
|
||||
- name: IS_POSTGRES
|
||||
template: |
|
||||
{{#if (eq PROTO "postgresql") }}
|
||||
true
|
||||
{{ else }}
|
||||
false
|
||||
{{/if}}
|
||||
target: app-connection-string
|
8
tests/manifests/secret.yaml
Normal file
8
tests/manifests/secret.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: database-secret
|
||||
stringData:
|
||||
PASSWORD: 123123!!
|
||||
USERNAME: real_root
|
||||
DATABASE: postgres
|
14
tests/test.pl
Executable file
14
tests/test.pl
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/env sh
|
||||
|
||||
# Run shoebill generate and apply
|
||||
TAG=$(git rev-parse HEAD)
|
||||
IMAGE="git.badhouseplants.net/allanger/shoebill-operator"
|
||||
NAMESPACE="test-shoebill-operator"
|
||||
|
||||
kubectl create namespace $NAMESPACE
|
||||
shoebill manifests -i $IMAGE -t $TAG -n $NAMESPACE > /tmp/manifests.yaml
|
||||
kubectl apply -f /tmp/manifests.yaml
|
||||
kubectl rollout status -n $NAMESPACE deployment shoebill-controller
|
||||
|
||||
kubectl delete -f /tmp/manifests.yaml
|
||||
kubectl delete namespace $NAMESPACE
|
Reference in New Issue
Block a user