Merge pull request #314 from stefanprodan/timoni-vet-module

timoni: Add debug values and vet module in CI
This commit is contained in:
Stefan Prodan
2023-10-30 12:56:48 +02:00
committed by GitHub
6 changed files with 49 additions and 8 deletions
+3
View File
@@ -61,6 +61,9 @@ jobs:
run: |
docker build -t ${PODINFO_IMAGE_URL}:${PODINFO_VERSION} --build-arg "REVISION=${GITHUB_SHA}" -f Dockerfile.xx .
kind load docker-image ${PODINFO_IMAGE_URL}:${PODINFO_VERSION}
- name: Vet module
run: |
timoni mod vet ./timoni/podinfo --debug
- name: Build module
run: |
timoni mod push ./timoni/podinfo ${PODINFO_MODULE_URL} -v ${PODINFO_VERSION}
@@ -0,0 +1,26 @@
// Copyright 2023 Stefan Prodan
// SPDX-License-Identifier: Apache-2.0
package v1alpha1
// Action holds the list of annotations for controlling
// Timoni's apply behaviour of Kubernetes resources.
Action: {
// Force annotation for recreating immutable resources such as Kubernetes Jobs.
Force: {
"action.timoni.sh/force": ActionStatus.Enabled
}
// One-off annotation for appling resources only if they don't exist on the cluster.
Oneoff: {
"action.timoni.sh/one-off": ActionStatus.Enabled
}
// Keep annotation for preventing Timoni's garbage collector from deleting resources.
Keep: {
"action.timoni.sh/prune": ActionStatus.Disabled
}
}
ActionStatus: {
Enabled: "enabled"
Disabled: "disabled"
}
@@ -6,21 +6,23 @@ import (
"text/tabwriter"
)
_resources: timoni.apply.app
// The build command generates the Kubernetes manifests and prints the multi-docs YAML to stdout.
// Example 'cue cmd -t test -t name=test -t namespace=test -t mv=6.5.0 -t kv=1.28.0 build'.
// Example 'cue cmd -t debug -t name=podinfo -t namespace=test -t mv=1.0.0 -t kv=1.28.0 build'.
command: build: {
task: print: cli.Print & {
text: yaml.MarshalStream(timoni.apply.all)
text: yaml.MarshalStream(_resources)
}
}
// The ls command prints a table with the Kubernetes resources kind, namespace, name and version.
// Example 'cue cmd -t test -t name=test -t namespace=test -t mv=6.5.0 -t kv=1.28.0 ls'.
// Example 'cue cmd -t debug -t name=podinfo -t namespace=test -t mv=1.0.0 -t kv=1.28.0 ls'.
command: ls: {
task: print: cli.Print & {
text: tabwriter.Write([
"RESOURCE \tAPI VERSION",
for r in timoni.apply.all {
for r in _resources {
if r.metadata.namespace == _|_ {
"\(r.kind)/\(r.metadata.name) \t\(r.apiVersion)"
}
@@ -1,8 +1,16 @@
@if(test)
@if(debug)
package main
// Values used by debug_tool.cue.
// Debug example 'cue cmd -t debug -t name=podinfo -t namespace=test -t mv=1.0.0 -t kv=1.28.0 build'.
values: {
image: {
repository: "docker.io/stefanprodan/podinfo"
tag: "latest"
digest: ""
}
ui: backend: "http://backend.default.svc.cluster.local/echo"
metadata: {
@@ -23,7 +31,7 @@ values: {
annotations: "cert-manager.io/cluster-issuer": "letsencrypt"
}
monitoring: enabled: false
monitoring: enabled: true
_mcpu: 100
_mem: 128
+1 -1
View File
@@ -45,5 +45,5 @@ timoni: {
// Pass Kubernetes resources outputted by the instance
// to Timoni's multi-step apply.
apply: all: [ for obj in instance.objects {obj}]
apply: app: [ for obj in instance.objects {obj}]
}
+3 -1
View File
@@ -1,6 +1,8 @@
// Code generated by timoni. DO NOT EDIT.
// Code generated by timoni.
// Note that this file must have no imports and all values must be concrete.
@if(!debug)
package main
// Defaults