Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stuttgart-things/stagetime-creator
dynamic rendering and creation of k8s manifests/resources polled from redis streams/json
https://github.com/stuttgart-things/stagetime-creator
golang kubernetes message-queue redis redis-streams stagetime stuttgart-things template-engine yaml
Last synced: 2 days ago
JSON representation
dynamic rendering and creation of k8s manifests/resources polled from redis streams/json
- Host: GitHub
- URL: https://github.com/stuttgart-things/stagetime-creator
- Owner: stuttgart-things
- License: apache-2.0
- Created: 2023-06-30T08:44:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-19T12:30:24.000Z (9 months ago)
- Last Synced: 2024-06-21T16:55:09.162Z (5 months ago)
- Topics: golang, kubernetes, message-queue, redis, redis-streams, stagetime, stuttgart-things, template-engine, yaml
- Language: Go
- Homepage:
- Size: 17.9 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stuttgart-things/stageTime-creator
dynamic rendering and creation of k8s manifests/resources polled from redis streams/json
## DEV-TASKS
```bash
task --list: Available tasks for this project:
* build: Build the app
* build-image: Build image
* git-push: Commit & push the module
* lint: Lint code
* package: Update Chart.yaml and package archive
* push: Push to registry
* release: Build amd release to github w/ goreleaser
* run: Run app
* run-container: Run container
* run-test: Run test-producer
* tag: Commit, push & tag the module
* test: Test code
```## HELMFILE-DEPLOYMENTS
SET VAULT CONNECTION
```bash
export VAULT_ADDR=https://${VAULT_FQDN}}
export VAULT_NAMESPACE=root# APPROLE AUTH
export VAULT_AUTH_METHOD=approle
export VAULT_ROLE_ID=${VAULT_ROLE_ID}
export VAULT_SECRET_ID=${VAULT_SECRET_ID}# TOKEN AUTH
export VAULT_AUTH_METHOD=token #default
export VAULT_TOKEN=${VAULT_TOKEN}
```RENDER/APPLY
```bash
helmfile template --environment labul-pve-dev
helmfile sync --environment labul-pve-dev
```## DEPLOY DEV CODE TO CLUSTER
DEPLOYMENT
```bash
helm pull oci://eu.gcr.io/stuttgart-things/stagetime-creator --version v0.1.44
``````yaml
cat < stageTime-creator.yaml
---
secrets:
redis-connection:
name: redis-connection
labels:
app: stagetime-server
dataType: stringData
secretKVs:
REDIS_SERVER: redis-stack-deployment-headless.redis-stack.svc.cluster.local
REDIS_PORT: 6379
REDIS_PASSWORD:
EOF
``````bash
helm upgrade --install stagetime-creator oci://eu.gcr.io/stuttgart-things/stagetime-creator --version v0.1.44 --values stageTime-creator.yaml -n stagetime-creator --create-namespace
```CHECK REDIS DATA w/ CLI
```bash
# INSTALL REDIS-CLI
sudo apt-get update
sudo apt-get install redis
``````bash
# SHELL #1
kubectl -n stagetime port-forward redis-stack-node-0 28015:6379 -n stagetime-redis
``````bash
# SHELL #2
redis-cli -h 127.0.0.1 -p 28015 -a ${PASSWORD}# CHECK ALL REDIS KEYS
KEYS *# READ STREAM
XREAD COUNT 2 STREAMS stagetime-revisionruns writers 0-0 0-0# DELETE STREAM
DEL stagetime-revisionruns
```## TEST SERVICE LOCALLY (OUTSIDE CLUSTER)
START CONSUMER
```
export KUBECONFIG=~/.kube/dev11
export TEMPLATE_PATH=~/projects/go/src/github/stageTime-creator/tests
export TEMPLATE_NAME=job-template.yaml
export REDIS_STREAM=stagetime:test
export REDIS_PASSWORD=
export REDIS_SERVER=redis-pve.labul.sva.de
export REDIS_PORT=6379
task run
```START TEST PRODUCING (EXTERNAL REDIS)
```
# kubectl -n stagetime-redis port-forward redis-stagetime-deployment-node-0 28015:6379
task run-test
```START TEST PRODUCING (REDIS INSIDE CLUSTER)
```
kubectl -n port-forward redis-stagetime-deployment-node-0 :# kubectl -n stagetime-redis port-forward redis-stagetime-deployment-node-0 28015:6379
export REDIS_STREAM=stagetime-revisionruns
export REDIS_PASSWORD=
export REDIS_SERVER=127.0.0.1
export REDIS_PORT=28015 # HOST-PORT
go run tests/test-json-set.go
```VERIFY REDIS
```
redis-cli -h -p -a# redis-cli -h 127.0.0.1 -p 28015 -a test
KEYS *
# GET VALUE
GET
# GET STREAM
XREAD COUNT 2 STREAMS writers 0-0 0-0
```## LICENSE
APACHE 2.0
Copyright 2023 patrick hermann.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.Author Information
------------------
Patrick Hermann, stuttgart-things 06/2023