Skip to content

stuttgart-things/kaeffken

Repository files navigation

stuttgart-things/kaeffken

sthings

[ˈkɛfkən]- gitops apps & cluster management cli

CREATE

CREATE
kaeffken create --profile tests/vspherevm-workflow.yaml --survey true
WORFKLOW SCHEMA
---
gitRepo: stuttgart-things
gitOwner: stuttgart-things
gitBranch: "{{ .technology }}-{{ .vmName }}"
rootFolder: terraform
subFolder: "{{ .vmName }}"
technology: terraform
commitMessage: "Add {{ .vmName }} VM"

prTitle: "Add {{ .vmName }} VM"
prDescription: "Add {{ .vmName }} VM"
prTags:
  - terraform

values:
  - "tests/values.yaml"

#SECRETS
secretFiles:
  - "tests/secret-config.yaml"

secretAliases:
  - "host:vsphere_host"    # KEYINSOURCE:TARGETKEY

secretFileOutputName: "secret-vars.yaml" # SOURCE SECRET FILE  #pragma: allowlist secret

preQuestions:
  - prompt: "VM name?"
    kind: ask
    name: vmName
    type: string
    minLength: 3
    maxLength: 20

# SHOULD BE IMPLEMENTED | BEFORE RENDERING - SET/PRE-RENDER THOSE ALIASES
aliases:
  - "stateKey:{{ .vmName }}"

questions:
  - tests/vm-general.yaml
  - tests/{{ .envName }}.yaml

templates:
  - "tests/vsphere-vm.tf.tpl:{{ .vmName }}.tf"

</details>



<details><summary><b>DECRYPT</b></summary>

## DECRYPT FILE (SOPS)

### STDOUT

```bash
export SOPS_AGE_KEY=AGE-SECRET-KEY-1T22K05UTRDU..
kaeffken decrypt \
--source encrypted.yaml

TO FILE

kaeffken decrypt \
--source encrypted.yaml \
--key AGE-SECRET-KEY-1T22K05UTRDU.. \
--output file \
--destination /tmp/decrypted.yaml
APPS
kaeffken \
--output file \
--clusterPath=clusters/labul/test1 \
--apps tests/apps.yaml
--pr true
kaeffken \
--output stdout \
--apps /home/sthings/projects/stuttgart-things/kaeffken/apps/flux/apps.yaml \
--appDefaults /home/sthings/projects/stuttgart-things/kaeffken/apps/flux/app-defaults.yaml \
--defaults /home/sthings/projects/stuttgart-things/kaeffken/apps/flux/flux-defaults.yaml
ENCRYPT FILE
cat <<EOF >> tests/secret.yaml
kind: Secret
apiVersion: v1
metadata:
  name: secret
data:
  password: wHat6ver
EOF
kaeffken encrypt \
--source tests/secret.yaml \
--output stdout
kaeffken encrypt \
--source tests/secret.yaml \
--output file \
--destination ~/projects/sops/ \
--name config \
--age age1g438...
kaeffken encrypt \
--source tests/secret.yaml \
--output file \
--pr true \
--destination /tmp \
--clusterPath=clusters/labul/test1
RENDER (BUILTIN) TEMPLATE AND ENCRYPT FILE
kaeffken encrypt \
--template k8s \
--values "password=mysecretvalue, username=admin" \
--output stdout

INSTALL

INSTALL (LINUX)

DEV

CREATE BRANCH
task branch

💡 💻 💾 Add Features, fixes, documentation ...

LINT, TEST, BUILD, RUN
task run
CREATE/MERGE PULL REQUEST
task pr
RELEASE VERSIONED ARTIFACTS
task release
ENV FILE
cat <<EOF > .env
SOPS_AGE_KEY=AGE-SECRET-KEY-1T2...
EOF
ALL TASKS
task: Available tasks for this project:
* branch:              Create branch from main
* build:               Install
* build-ko:            Build KO Image
* commit:              Commit + push code into branch
* delete-branch:       Delete branch from origin
* lint:                Lint code
* pr:                  Create pull request into main
* release:             Release
* run:                 Run
* test:                Test code
* tests:               Built cli tests

AUTHOR

Patrick Hermann, stuttgart-things 12/2023

License

Licensed under the Apache License, Version 2.0 (the "License").

You may obtain a copy of the License at 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.