31 Commits

Author SHA1 Message Date
ef1ff2737f feat(repo): Change references to katenary repository 2025-08-19 23:36:48 +02:00
d34f97fa5d feat(repo): Go to repo.katenary.io 2025-08-19 23:23:17 +02:00
c85e61f5d0 Merge branch 'master' of repo.katenary.io:Katenary/katenary
All checks were successful
Go-Tests / tests (push) Successful in 1m49s
Go-Tests / sonar (push) Successful in 49s
2025-08-19 23:20:12 +02:00
f1c31b0eeb feat(doc): move some things in README
As we moved project to repo.katenary.io, badges were not OK
2025-08-19 22:31:50 +02:00
677b0d7b3c Merge pull request 'feat(actions): Change action to Gitea' (#161) from test-workflow into master
All checks were successful
Go-Tests / tests (push) Successful in 1m59s
Go-Tests / sonar (push) Successful in 1m7s
Reviewed-on: #161
2025-08-19 19:59:17 +00:00
f539be8f52 Remove proxy
All checks were successful
Go-Tests / tests (pull_request) Successful in 2m29s
Go-Tests / sonar (pull_request) Successful in 51s
2025-08-19 21:54:01 +02:00
4336490a72 feat(actions): Change action to Gitea
- Build and packages on Gitea action
- Use go 1.25
- Update dependencies
2025-08-19 21:52:33 +02:00
9f75f874d1 Features/buildah build (#159)
* feat(oci): Build using pure Buildah
2025-08-13 10:20:48 +02:00
90eda75219 feat(oci): Use Buildah
And set version the right way...
2025-08-04 16:18:35 +02:00
b13e922966 feat(package) Version were not correctly set
As the code moved in "internal" package, we need to set the version to
the new location
2025-08-04 16:13:35 +02:00
0d36a48f93 fix(securty): Fix security alert
Code scanning alert: we need to specify permissions on this action.
2025-08-03 23:29:39 +02:00
60016b8c3e Merge pull request #157 from Katenary/features/oci-image
Features/oci image
2025-08-03 23:06:06 +02:00
07263520b6 feat(oci): remove testing on push branches 2025-08-03 23:01:54 +02:00
0f3812b666 feat(oci): Add OCI image generation
Not fully tested but it should produce an image in ghcr.io
2025-08-03 22:54:19 +02:00
50a9d0ddde feat(md): fixes typo and rules 2025-08-03 22:53:53 +02:00
f5d3005c3b Merge pull request #156 from Katenary/feat-move-to-internal
feat(refacto): move everything in internal package
2025-08-03 16:03:17 +02:00
76b3b83d07 feat(workflow): change when to make CI
We will abandon develop branch for a while. It's better to work with
feature branches.
2025-08-03 15:59:00 +02:00
14ca5bf0ea feat(refacto): move everything in internal package
This allows to install katenary with `go install` and to clean up the
project folder.
2025-08-03 15:54:58 +02:00
d1768e5742 Merge pull request #155 from Katenary/develop
Develop
2025-08-03 14:20:17 +02:00
0fcf0f60e8 chore(modules): Update versions 2025-08-03 14:15:55 +02:00
e9ad85a0ac chore(make): Split and enhancements
- split Makefile in several sub files
- use a separated container for tests
-
2025-08-03 14:15:35 +02:00
b4b122fe7f Do not ignore cmd/katenary directory 2025-08-03 14:14:29 +02:00
6aaeda7a3c chore(modernize): use iterator 2025-08-03 14:13:57 +02:00
0b3f7b2b5c chore(code): remove dead code 2025-08-03 14:13:42 +02:00
e9e7c5f7b5 chore(test): fix concurrency problem 2025-08-03 14:12:49 +02:00
0df53ed5ae Merge pull request #154 from Katenary/develop
fix(configmap): File from the root of project ends by a dash
2025-08-03 13:16:21 +02:00
136478aff7 fix(configmap): File from the root of project ends by a dash
fixes #150

If we mount a file from the root of project, the names ends by a dash.
That makes helm failing to install the package.
2025-08-03 10:20:11 +02:00
5b812b30f7 Merge pull request #146 from Katenary/develop
fix(katenaryfile): Schema is broken without json annotation
2025-07-15 21:25:39 +02:00
f2b5c16e71 fix(katenaryfile): Schema is broken without json annotation
We need to add json annotation. The yaml annoation is not enought when
generating the schema.
2025-07-15 21:24:17 +02:00
df1f29c0ff Merge pull request #145 from Katenary/develop
fix(katenaryfile): Fix parsing katenary file
2025-07-15 21:18:45 +02:00
afbd6fc1ac fix(katenaryfile): Fix parsing katenary file
It seems that "json" annotation fails to get dashed names (like
configmap-files). That means that all labels in katernay.yaml file
couldn't be parsed.

Using `yaml` annotaiton fixes the problem. Fixes #144.
2025-07-15 21:13:22 +02:00
114 changed files with 1076 additions and 838 deletions

View File

@@ -0,0 +1,47 @@
name: Build and push OCI image
on:
push:
tags:
- "**"
env:
REGISTRY: repo.katenary.io
IMAGE_NAME: ${{ gitea.repository }}
VERSION: ${{ gitea.ref_name }}
STORAGE_DRIVER: vfs
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Install Buildah
run: |-
env
if ! command -v buildah 2>/dev/null; then
echo "Install Buildah"
sudo apt-get update
sudo apt-get install -y buildah
else
echo "Buildah already installed"
fi
- name: Login to repository
run: |
buildah login $REGISTRY -u ${{ gitea.actor }} -p ${{ secrets.ACCESS_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and tag
run: |-
buildah build --isolation=chroot --build-arg VERSION=$VERSION -t katenary -f ./oci/katenary/Containerfile .
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:$VERSION
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:latest
- name: Push image
run: |-
buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION
buildah push $REGISTRY/${IMAGE_NAME,,}:latest

View File

@@ -0,0 +1,68 @@
name: Go-Tests
on:
pull_request:
types:
- opened
- edited
push:
branches:
- "master"
- "main"
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
jobs:
tests:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.25
- name: Install helm
run: |
command -v helm || curl -sSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Tidy
run: |
go mod tidy
- name: Launch Test
run: |
go vet ./...
go test -coverprofile=coverprofile.out -json -v ./... > gotest.json
# - uses: actions/upload-artifact@v4
- name: Upload artifact
uses: christopherhx/gitea-upload-artifact@v4
with:
name: tests-results
path: |
coverprofile.out
gotest.json
sonar:
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout
uses: actions/checkout@v4
#- uses: actions/download-artifact@v4
- name: Download artifact
uses: christopherhx/gitea-download-artifact@v4
with:
name: tests-results
- name: Sonar
run: |
export SONAR_SCANNER_VERSION=7.2.0.5079
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
sonar-scanner \
-Dsonar.organization=katenary \
-Dsonar.projectKey=katenary_katenary

View File

@@ -1,12 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
target-branch: develop

View File

@@ -1,48 +0,0 @@
name: Go-Tests
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- develop
push:
branches:
- master
- main
- develop
- 'releases/**'
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
- name: Launch Test
run: |
go mod tidy
go vet ./... && go test -coverprofile=coverprofile.out -json -v ./... > gotest.json
- uses: actions/upload-artifact@v4
with:
name: tests-results
path: |
coverprofile.out
gotest.json
sonar:
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: tests-results
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5.2.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}

5
.gitignore vendored
View File

@@ -13,8 +13,6 @@ cover*
.config/
*/venv
# local binary
./katenary
# will be treated later
/examples/*
@@ -29,4 +27,7 @@ __pycache__
.rpmmacros
*.gpg
# local binaries
katenary
!cmd/katenary
!oci/katenary

406
Makefile
View File

@@ -13,7 +13,7 @@ CUR_BRANCH=$(shell git branch --show-current)
VERSION=$(shell git describe --exact-match --tags $(CUR_SHA) 2>/dev/null || echo $(CUR_BRANCH)-$(CUR_SHA))# use by golang flags
# Go build command and environment variables for target OS and architecture
GOVERSION=1.24
GOVERSION=1.25
GO=container# container, local
OUTPUT=katenary
GOOS=linux
@@ -21,48 +21,10 @@ GOARCH=amd64
CGO_ENABLED=0
PREFIX=~/.local
warn-docker:
@echo -e "\033[1;31mWarning: Docker is not recommended, use Podman instead.\033[0m"
sleep 5
# Get the container (Podman is preferred, but docker can be used too. It may failed with Docker.)
# TODO: propose nerdctl
CTN:=$(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker")
ifeq ($(CTN),podman)
CTN_USERMAP=--userns=keep-id
else
$(MAKE) warn-docker
CTN_USERMAP=--user=$(shell id -u):$(shell id -g) -e HOME=/tmp
endif
# Packaging OCI image, to build rpm, deb, pacman, tar packages
# We changes the keep-id uid/gid for Podman, so that the user inside the container is the same as the user outside.
# For Docker, as it doesn't support userns, we use common options, but it may fail...
PKG_OCI_IMAGE=packaging:fedora
ifeq ($(CTN),podman)
# podman
PKG_OCI_OPTS:=--rm -it \
-v ./:/opt/katenary:z \
--userns keep-id:uid=1001,gid=1001 \
$(PKG_OCI_IMAGE)
else
# docker
PKG_OCI_OPTS:=--rm -it \
-v ./:/opt/katenary:z \
-e HOME=/tmp \
$(CTN_USERMAP) \
$(PKG_OCI_IMAGE)
endif
GO_BUILD=go build -ldflags="-X 'katenary/generator.Version=$(VERSION)'" -o $(OUTPUT) ./cmd/katenary
# UPX compression
UPX_OPTS =
UPX ?= upx $(UPX_OPTS)
BUILD_IMAGE=docker.io/golang:$(GOVERSION)
# List of source files
SOURCES=$(shell find -name "*.go" -or -name "*.tpl" -type f | grep -v -P "^./example|^./vendor")
# List of binaries to build and sign
@@ -84,8 +46,20 @@ SIGNER=metal3d@gmail.com
# Browser command to see coverage report after tests
BROWSER=$(shell command -v epiphany || echo xdg-open)
include makefiles/build.mk
include makefiles/containers.mk
include makefiles/doc.mk
include makefiles/gpg.mk
include makefiles/packager.mk
include makefiles/test.mk
all: build
# if docker is used instead of podman, we warn the user
warn-docker:
@echo -e "\033[1;31mWarning: Docker is not recommended, use Podman instead.\033[0m"
sleep 5
help:
@cat <<EOF | fold -s -w 80
=== HELP ===
@@ -123,273 +97,6 @@ help:
EOF
## BUILD
# Simply build the binary for the current OS and architecture
build: pull katenary
pull:
ifneq ($(GO),local)
@echo -e "\033[1;32mPulling $(BUILD_IMAGE) docker image\033[0m"
@$(CTN) pull $(BUILD_IMAGE)
endif
katenary: $(SOURCES) go.mod go.sum
ifeq ($(GO),local)
@echo "=> Build on host using go"
$(GO_BUILD)
else
@echo "=> Build in container using" $(CTN)
@$(CTN) run \
-e CGO_ENABLED=$(CGO_ENABLED) \
-e GOOS=$(GOOS) \
-e GOARCH=$(GOARCH) \
--rm -v $(PWD):/go/src/katenary:z \
-w /go/src/katenary \
-v go-cache:/go/pkg/mod:z \
$(CTN_USERMAP) \
$(BUILD_IMAGE) $(GO_BUILD)
endif
# Make dist, build executables for all platforms, sign them, and compress them with upx if possible.
# Also generate the windows installer.
binaries: prepare $(BINARIES)
dist: binaries upx packages
dist-full: clean-dist dist gpg-sign check-sign rpm-sign check-dist-all
prepare: pull packager-oci-image
mkdir -p dist
dist/katenary-linux-amd64: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for linux-amd64...\033[0m"
$(MAKE) katenary GOOS=linux GOARCH=amd64 OUTPUT=$@
strip $@
dist/katenary-linux-arm64: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for linux-arm...\033[0m"
$(MAKE) katenary GOOS=linux GOARCH=arm64 OUTPUT=$@
dist/katenary.exe: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for windows...\033[0m"
$(MAKE) katenary GOOS=windows GOARCH=amd64 OUTPUT=$@
dist/katenary-darwin-amd64: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for darwin...\033[0m"
$(MAKE) katenary GOOS=darwin GOARCH=amd64 OUTPUT=$@
dist/katenary-freebsd-amd64: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for freebsd...\033[0m"
$(MAKE) katenary GOOS=freebsd GOARCH=amd64 OUTPUT=$@
strip $@
dist/katenary-freebsd-arm64: $(SOURCES) go.mod go.sum
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for freebsd-arm64...\033[0m"
$(MAKE) katenary GOOS=freebsd GOARCH=arm64 OUTPUT=$@
dist/katenary-windows-setup.exe: nsis/EnVar.dll dist/katenary.exe
@$(CTN) run -w /opt/katenary $(PKG_OCI_OPTS) \
makensis -DAPP_VERSION=$(VERSION) nsis/katenary.nsi
mv nsis/katenary-windows-setup.exe dist/katenary-windows-setup.exe
# Download the EnVar plugin for NSIS, put it in the nsis directory, and clean up
nsis/EnVar.dll:
curl https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip -o nsis/EnVar_plugin.zip
cd nsis
unzip -o EnVar_plugin.zip Plugins/x86-unicode/EnVar.dll
mv Plugins/x86-unicode/EnVar.dll EnVar.dll
rm -rf EnVar_plugin.zip Plugins
# UPX compression
upx: upx-linux upx-darwin
upx-linux: dist/katenary-linux-amd64 dist/katenary-linux-arm64
$(UPX) $^
upx-darwin: dist/katenary-darwin-amd64
$(UPX) --force-macos $^
## Linux / FreeBSD packages with fpm
DESCRIPTION := $(shell cat packaging/description | sed ':a;N;$$!ba;s/\n/\\n/g')
FPM_OPTS=--name katenary \
--url https://katenary.org \
--vendor "Katenary Project" \
--maintainer "Patrice Ferlet <metal3d@gmail.com>" \
--license "MIT" \
--description="$$(printf "$(DESCRIPTION)" | fold -s)"
# base files (doc...)
FPM_BASES=../LICENSE=/usr/local/share/doc/katenary/LICENSE \
../README.md=/usr/local/share/doc/katenary/README.md
FPM_COMMON_FILES=$(FPM_BASES) ../doc/share/man/man1/katenary.1=/usr/local/share/man/man1/katenary.1
# ArchLinux has got inconsistent /usr/local/man directory
FPM_COMMON_FILES_ARCHLINUX=$(FPM_BASES) ../doc/share/man/man1/katenary.1=/usr/local/man/man1/katenary.1 \
# Pacman refuses dashes in version, and should start with a number
PACMAN_VERSION=$(shell echo $(VERSION) | sed 's/-/./g; s/^v//')
define RPM_MACROS
%_signature gpg
%_gpg_path /home/builder/.gnupg
%_gpg_name $(SIGNER)
%_gpgbin /usr/bin/gpg2
%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --batch --verbose --no-armor --no-secmem-warning -u "%{_gpg_name}" -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}'
endef
rpm: dist/katenary-linux-$(GOARCH)
@echo "==> Building RPM packages for $(GOARCH)..."
$(CTN) run -w /opt/katenary/dist $(PKG_OCI_OPTS) \
fpm -s dir -t rpm -a $(GOARCH) -f $(FPM_OPTS) --version=$(VERSION) \
$(FPM_COMMON_FILES) \
./katenary-linux-$(GOARCH)=/usr/local/bin/katenary
rpm-sign:
[ -f .rpmmacros ] || echo "$(RPM_MACROS)" > .rpmmacros
[ -f .secret.gpg ] || gpg --export-secret-keys -a $(SIGNER) > .secret.gpg
$(CTN) run -w /opt/katenary/dist \
-v ./.secret.gpg:/home/builder/signer.gpg \
-v packager-gpg:/home/builder/.gnupg \
$(PKG_OCI_OPTS) \
gpg --import /home/builder/signer.gpg
$(CTN) run -w /opt/katenary/dist \
-v .rpmmacros:/home/builder/.rpmmacros:z \
-v packager-gpg:/home/builder/.gnupg \
$(PKG_OCI_OPTS) \
bash -c 'for rpm in $$(find . -iname "*.rpm"); do echo signing: $$rpm; rpm --addsign $$rpm; done'
deb:
@echo "==> Building DEB packages for $(GOARCH)..."
$(CTN) run -w /opt/katenary/dist $(PKG_OCI_OPTS) \
fpm -s dir -t deb -a $(GOARCH) -f $(FPM_OPTS) --version=$(VERSION) \
$(FPM_COMMON_FILES) \
./katenary-linux-$(GOARCH)=/usr/local/bin/katenary
pacman:
@echo "==> Building Pacman packages for $(GOARCH)..."
$(CTN) run -w /opt/katenary/dist $(PKG_OCI_OPTS) \
fpm -s dir -t pacman -a $(GOARCH) -f $(FPM_OPTS) --version=$(PACMAN_VERSION) \
$(FPM_COMMON_FILES_ARCHLINUX) \
./katenary-linux-$(GOARCH)=/usr/local/bin/katenary
freebsd:
@echo "==> Building FreeBSD packages for $(GOARCH)..."
$(CTN) run -w /opt/katenary/dist $(PKG_OCI_OPTS) \
fpm -s dir -t freebsd -a $(GOARCH) -f $(FPM_OPTS) --version=$(VERSION)\
$(FPM_COMMON_FILES) \
./katenary-freebsd-$(GOARCH)=/usr/local/bin/katenary
mv dist/katenary-$(VERSION).txz dist/katenary-freebsd-$(VERSION).$(GOARCH).txz
tar:
@echo "==> Building TAR packages for $(GOOS) $(GOARCH)..."
$(CTN) run -w /opt/katenary/dist $(PKG_OCI_OPTS) \
fpm -s dir -t tar -a $(GOARCH) -f $(FPM_OPTS) \
$(FPM_COMMON_FILES) \
./katenary-$(GOOS)-$(GOARCH)=/usr/local/bin/katenary
mv dist/katenary.tar dist/katenary-$(GOOS)-$(VERSION).$(GOARCH).tar
packages: manpage packager-oci-image
for arch in amd64 arm64; do \
$(MAKE) rpm GOARCH=$$arch; \
$(MAKE) deb GOARCH=$$arch; \
$(MAKE) pacman GOARCH=$$arch; \
$(MAKE) freebsd GOARCH=$$arch; \
$(MAKE) tar GOARCH=$$arch GOOS=linux; \
$(MAKE) tar GOARCH=$$arch GOOS=freebsd; \
done
packager-oci-image:
@$(CTN) build -t packaging:fedora ./packaging/oci 1>/dev/null
## GPG signing
gpg-sign:
rm -f dist/*.asc
$(MAKE) $(ASC_BINARIES)
check-sign:
@echo "=> Checking signatures..."
@for f in $(ASC_BINARIES); do \
if gpg --verify $$f &>/dev/null; then \
echo "Signature for $$f is valid"; \
else \
echo "Signature for $$f is invalid"; \
exit 1; \
fi; \
done
@echo "=> checking in blank environment..."
keyid=$(shell gpg -k --with-colons $(SIGNER)| grep '^pub' | cut -d: -f5);
$(CTN) run --rm -it -e GPGKEY=$${keyid} -v ./dist:/opt/dist:z \
packaging:fedora \
bash -c '
gpg --recv-key $$GPGKEY || exit 1;
echo "Trusting $(SIGNER) key...";
echo "trusted-key 483493B2DD0845DA8F21A26DF3702E3FAD8F76DC" >> ~/.gnupg/gpg.conf;
gpg --update-trustdb;
rm -f ~/.gnupg/gpg.conf;
for f in /opt/dist/*.asc; do echo "==> $${f}"; gpg --verify $${f}; done;
echo "=> Listing imported keys...";
gpg -k
'
dist/%.asc: dist/%
gpg --armor --detach-sign --default-key $(SIGNER) $< &>/dev/null || exit 1
check-dist-rocky:
@echo "=> Checking Rocky Linux package..."
p=$(wildcard dist/*x86_64.rpm);
$(CTN) run --rm -it -v ./dist:/opt:z quay.io/rockylinux/rockylinux:latest bash -c "
rpm -ivh /opt/$$(basename $$p);
katenary version;
"
check-dist-fedora:
@echo "=> Checking Fedora package..."
p=$(wildcard dist/*x86_64.rpm);
$(CTN) run --rm -it -v ./dist:/opt:z quay.io/fedora/fedora:latest bash -c "
rpm -ivh /opt/$$(basename $$p);
katenary version;
"
check-dist-archlinux:
echo "=> Checking ArchLinux package..."
p=$(wildcard dist/*x86_64.pkg.tar.zst);
$(CTN) run --rm -it -v ./dist:/opt:z quay.io/archlinux/archlinux bash -c "
pacman -U /opt/$$(basename $$p) --noconfirm;
katenary version;
"
check-dist-debian:
@echo "=> Checking Debian package..."
p=$(wildcard dist/*amd64.deb);
$(CTN) run --rm -it -v ./dist:/opt:z debian:latest bash -c "
dpkg -i /opt/$$(basename $$p);
katenary version;
"
check-dist-ubuntu:
@echo "=> Checking Ubuntu package..."
p=$(wildcard dist/*amd64.deb);
$(CTN) run --rm -it -v ./dist:/opt:z ubuntu:latest bash -c "
dpkg -i /opt/$$(basename $$p);
katenary version;
"
check-dist-all:
$(MAKE) check-dist-fedora
$(MAKE) check-dist-rocky
$(MAKE) check-dist-debian
$(MAKE) check-dist-ubuntu
$(MAKE) check-dist-archlinux
## installation and uninstallation
install: build
@@ -398,93 +105,6 @@ install: build
uninstall:
rm -f $(PREFIX)/bin/katenary
serve-doc: doc
@cd doc && \
[ -d venv ] || python -m venv venv; \
source venv/bin/activate && \
echo "==> Installing requirements in the virtual env..."
pip install -qq -r requirements.txt && \
echo "==> Serving doc with mkdocs..." && \
mkdocs serve
## Documentation generation
doc:
@echo "=> Generating documentation..."
# generate the labels doc and code doc
$(MAKE) __label_doc
manpage:
@echo "=> Generating manpage from documentation"
@cd doc && \
[ -d venv ] || python -m venv venv; \
source venv/bin/activate && \
echo "==> Installing requirements in the virtual env..." && \
pip install -qq -r requirements.txt && \
echo "==> Generating manpage..." && \
MANPAGE=true mkdocs build && \
rm -rf site &&
echo "==> Manpage generated in doc/share/man/man1/katenary.1"
install-gomarkdoc:
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
__label_doc:
@command -v gomarkdoc || (echo "==> We need to install gomarkdoc..." && \
$(MAKE) install-gomarkdoc)
@echo "=> Generating labels doc..."
# short label doc
go run ./cmd/katenary help-labels -m | \
sed -i '
/START_LABEL_DOC/,/STOP_LABEL_DOC/{/<!--/!d};
/START_LABEL_DOC/,/STOP_LABEL_DOC/r/dev/stdin
' doc/docs/labels.md
# detailed label doc
go run ./cmd/katenary help-labels -am | sed 's/^##/###/' | \
sed -i '
/START_DETAILED_DOC/,/STOP_DETAILED_DOC/{/<!--/!d};
/START_DETAILED_DOC/,/STOP_DETAILED_DOC/r/dev/stdin
' doc/docs/labels.md
echo "=> Generating Code documentation..."
PACKAGES=$$(for f in $$(find . -name "*.go" -type f); do dirname $$f; done | sort -u)
for pack in $$PACKAGES; do
echo "-> Generating doc for $$pack"
gomarkdoc --repository.default-branch $(shell git branch --show-current) -o doc/docs/packages/$$pack.md $$pack
sed -i '/^## Index/,/^##/ { /## Index/d; /^##/! d }' doc/docs/packages/$$pack.md
done
## TESTS, security analysis, and code quality
# Scan the source code.
# - we don't need detection of text/template as it's not a web application, and
# - we don't need sha1 detection as it is not used for cryptographic purposes.
# Note: metrics are actually not sent to anyone - it's a thing that is removed from the code in the future.
sast:
opengrep \
--config auto \
--exclude-rule go.lang.security.audit.xss.import-text-template.import-text-template \
--exclude-rule go.lang.security.audit.crypto.use_of_weak_crypto.use-of-sha1 \
--metrics=on \
.
test:
@echo -e "\033[1;33mTesting katenary $(VERSION)...\033[0m"
go test -coverprofile=cover.out ./...
$(MAKE) cover
cover:
@go tool cover -func=cover.out | grep "total:"
go tool cover -html=cover.out -o cover.html
show-cover:
@[ -f cover.html ] || (echo "cover.html is not present, run make test before"; exit 1)
if [ "$(BROWSER)" = "xdg-open" ]; then
xdg-open cover.html
else
$(BROWSER) -i --new-window cover.html
fi
## Miscellaneous
clean-all: clean-dist clean-package-signer clean-go-cache

View File

@@ -5,13 +5,9 @@
<div style="text-align:center; margin: auto 0 4em 0" align="center">
[![Documentation Status](https://readthedocs.org/projects/katenary/badge/?version=latest)](https://katenary.readthedocs.io/latest/?badge=latest)
[![Go Report Card](https://goreportcard.com/badge/github.com/Katenary/katenary)](https://goreportcard.com/report/github.com/Katenary/katenary)
[![GitHub release](https://img.shields.io/github/v/release/Katenary/katenary)](https://github.com/Katenary/katenary/releases)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=metal3d_katenary&metric=coverage)](https://sonarcloud.io/summary/new_code?id=metal3d_katenary)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=metal3d_katenary&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=metal3d_katenary)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=metal3d_katenary&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=metal3d_katenary)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=metal3d_katenary&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=metal3d_katenary)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=katenary_katenary&metric=coverage)](https://sonarcloud.io/summary/new_code?id=katenary_katenary)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=katenary_katenary&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=katenary_katenary)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=katenary_katenary&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=katenary_katenary)
</div>
@@ -50,7 +46,7 @@ is continuously updated. It's preferable to use releases.
You can use this commands on Linux:
```bash
sh <(curl -sSL https://raw.githubusercontent.com/Katenary/katenary/master/install.sh)
sh <(curl -sSL https://repo.katenary.io/Katenary/katenary/raw/branch/master/install.sh)
```
## Or, build yourself
@@ -186,7 +182,7 @@ services:
database:
image: mariadb:10
env_file:
# this valuse will be added in a configMap
# this values will be added in a configMap
- my_env.env
environment:
MARIADB_USER: foo
@@ -273,7 +269,7 @@ return {
settings = {
yaml = {
schemas = {
["https://raw.githubusercontent.com/Katenary/katenary/master/katenary.json"] = "katenary.yaml",
["https://repo.katenary.io/Katenary/katenary/raw/branch/master/katenary.json"] = "katenary.yaml",
},
},
},
@@ -289,7 +285,7 @@ Use this address to validate the `katenary.yaml` file in VSCode:
```json
{
"yaml.schemas": {
"https://raw.githubusercontent.com/Katenary/katenary/master/katenary.json": "katenary.yaml"
"https://repo.katenary.io/Katenary/katenary/raw/branch/master/katenary.json": "katenary.yaml"
}
}
```

View File

@@ -6,14 +6,15 @@ package main
import (
"fmt"
"katenary/generator"
"katenary/generator/katenaryfile"
"katenary/generator/labels"
"katenary/utils"
"log"
"os"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator"
"repo.katenary.io/katenary/katenary/internal/generator/katenaryfile"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/cli"
"github.com/spf13/cobra"
)

View File

@@ -13,8 +13,7 @@ func TestBuildCommand(t *testing.T) {
rootCmd := buildRootCmd()
if rootCmd == nil {
t.Errorf("Expected rootCmd to be defined")
}
if rootCmd.Use != "katenary" {
} else if rootCmd.Use != "katenary" {
t.Errorf("Expected rootCmd.Use to be katenary, got %s", rootCmd.Use)
}
numCommands := 6
@@ -53,18 +52,27 @@ func TestSchemaCommand(t *testing.T) {
}
schema := generateSchemaCommand()
old := os.Stdout
r, w, _ := os.Pipe()
r, w, err := os.Pipe()
if err != nil {
t.Fatalf("Failed to create pipe: %v", err)
}
os.Stdout = w
schema.Run(cmd, nil)
w.Close()
os.Stdout = old
var buf bytes.Buffer
done := make(chan struct{})
go func() {
schema.Run(cmd, nil)
w.Close()
close(done)
}()
io.Copy(&buf, r)
output := buf.String()
<-done
os.Stdout = old
// try to parse json
schemaContent := make(map[string]interface{})
if err := json.Unmarshal([]byte(output), &schemaContent); err != nil {
t.Errorf("Expected valid json, got %s", output)
schemaContent := make(map[string]any)
if err := json.Unmarshal(buf.Bytes(), &schemaContent); err != nil {
t.Errorf("Expected valid json")
}
}

View File

@@ -4,3 +4,6 @@ MD022: false
MD033: false
MD041: false
MD046: false
# list indentation
MD007:
indent: 4

View File

@@ -4,7 +4,7 @@ Katenary uses `compose-go` and several Kubernetes official packages.
- `github.com/compose-spec/compose-go`: to parse compose files. It ensures :
- that the project respects the "compose" specification
- that Katenary uses the "compose" struct exactly the same way `podman compose` or `docker copose` does
- that Katenary uses the "compose" struct exactly the same way `podman compose` or `docker compose` does
- `github.com/spf13/cobra`: to parse command line arguments, sub-commands and flags. It also generates completion for
bash, zsh, fish and PowerShell.
- `github.com/thediveo/netdb`: to get the standard names of a service from its port number

View File

@@ -39,10 +39,10 @@ share it with the community.
![](./statics/klee.svg)
</div>
The main developer is [Patrice FERLET](https://github.com/metal3d).
The main developer is [Patrice FERLET](https://repo.katenary.io/metal3d).
The project source
code is hosted on the [:fontawesome-brands-github: Katenary GitHub Repository](https://github.com/Katenary/katenary).
code is hosted on the [:fontawesome-brands-git: Katenary Repository](https://repo.katenary.io/Katenary/katenary).
## Install Katenary
@@ -57,7 +57,7 @@ If you are a Linux user, you can use the "one line installation command" which w
`$HOME/.local/bin` directory if it exists.
```bash
sh <(curl -sSL https://raw.githubusercontent.com/Katenary/katenary/master/install.sh)
sh <(curl -sSL https://repo.katenary.io/Katenary/katenary/raw/branch/master/install.sh)
```
!!! Info "Upgrading is integrated to the `katenary` command"
@@ -77,7 +77,7 @@ You can also build and install it yourself, the provided Makefile has got a `bui
To compile it, you can use the following commands:
```bash
git clone https://github.com/Katenary/katenary.git
git clone https://repo.katenary.io/Katenary/katenary.git
cd katenary
make build
make install

View File

@@ -3,7 +3,7 @@
# katenary
```go
import "katenary/cmd/katenary"
import "repo.katenary.io/katenary/katenary/cmd/katenary"
```
Katenary CLI, main package.

View File

@@ -1,67 +0,0 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# katenaryfile
```go
import "katenary/generator/katenaryfile"
```
Package katenaryfile is a package for reading and writing katenary files.
A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you can define the configuration of the conversion avoiding the use of labels in the compose file.
Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary.
## func [GenerateSchema](<https://github.com/katenary/katenary/blob/develop/generator/katenaryfile/main.go#L137>)
```go
func GenerateSchema() string
```
GenerateSchema generates the schema for the katenary.yaml file.
<a name="OverrideWithConfig"></a>
## func [OverrideWithConfig](<https://github.com/katenary/katenary/blob/develop/generator/katenaryfile/main.go#L49>)
```go
func OverrideWithConfig(project *types.Project)
```
OverrideWithConfig overrides the project with the katenary.yaml file. It will set the labels of the services with the values from the katenary.yaml file. It work in memory, so it will not modify the original project.
<a name="Service"></a>
## type [Service](<https://github.com/katenary/katenary/blob/develop/generator/katenaryfile/main.go#L27-L44>)
Service is a struct that contains the service configuration for katenary
```go
type Service struct {
MainApp *bool `json:"main-app,omitempty" jsonschema:"title=Is this service the main application"`
Values []StringOrMap `json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"`
Secrets *labelstructs.Secrets `json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"`
Ports *labelstructs.Ports `json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"`
Ingress *labelstructs.Ingress `json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"`
HealthCheck *labelstructs.HealthCheck `json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"`
SamePod *string `json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"`
Description *string `json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"`
Ignore *bool `json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"`
Dependencies []labelstructs.Dependency `json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"`
ConfigMapFile *labelstructs.ConfigMapFile `json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"`
MapEnv *labelstructs.MapEnv `json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"`
CronJob *labelstructs.CronJob `json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"`
EnvFrom *labelstructs.EnvFrom `json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"`
ExchangeVolumes []*labelstructs.ExchangeVolume `json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"`
ValuesFrom *labelstructs.ValueFrom `json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"`
}
```
<a name="StringOrMap"></a>
## type [StringOrMap](<https://github.com/katenary/katenary/blob/develop/generator/katenaryfile/main.go#L24>)
StringOrMap is a struct that can be either a string or a map of strings. It's a helper struct to unmarshal the katenary.yaml file and produce the schema
```go
type StringOrMap any
```
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)

View File

@@ -3,7 +3,7 @@
# generator
```go
import "katenary/generator"
import "repo.katenary.io/katenary/katenary/internal/generator"
```
Package generator generates kubernetes objects from a "compose" file and transforms them into a helm chart.
@@ -35,7 +35,7 @@ var Version = "master" // changed at compile time
```
<a name="Convert"></a>
## func [Convert](<https://github.com/katenary/katenary/blob/develop/generator/converter.go#L99>)
## func [Convert](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/converter.go#L100>)
```go
func Convert(config ConvertOptions, dockerComposeFile ...string) error
@@ -44,7 +44,7 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error
Convert a compose \(docker, podman...\) project to a helm chart. It calls Generate\(\) to generate the chart and then write it to the disk.
<a name="GetLabels"></a>
## func [GetLabels](<https://github.com/katenary/katenary/blob/develop/generator/labels.go#L12>)
## func [GetLabels](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels.go#L13>)
```go
func GetLabels(serviceName, appName string) map[string]string
@@ -53,7 +53,7 @@ func GetLabels(serviceName, appName string) map[string]string
GetLabels returns the labels for a service. It uses the appName to replace the \_\_replace\_\_ in the labels. This is used to generate the labels in the templates.
<a name="GetMatchLabels"></a>
## func [GetMatchLabels](<https://github.com/katenary/katenary/blob/develop/generator/labels.go#L25>)
## func [GetMatchLabels](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels.go#L26>)
```go
func GetMatchLabels(serviceName, appName string) map[string]string
@@ -62,7 +62,7 @@ func GetMatchLabels(serviceName, appName string) map[string]string
GetMatchLabels returns the matchLabels for a service. It uses the appName to replace the \_\_replace\_\_ in the labels. This is used to generate the matchLabels in the templates.
<a name="GetVersion"></a>
## func [GetVersion](<https://github.com/katenary/katenary/blob/develop/generator/version.go#L14>)
## func [GetVersion](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/version.go#L14>)
```go
func GetVersion() string
@@ -71,7 +71,7 @@ func GetVersion() string
GetVersion return the version of katneary. It's important to understand that the version is set at compile time for the github release. But, it the user get katneary using \`go install\`, the version should be different.
<a name="Helper"></a>
## func [Helper](<https://github.com/katenary/katenary/blob/develop/generator/helper.go#L15>)
## func [Helper](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/helper.go#L16>)
```go
func Helper(name string) string
@@ -80,7 +80,7 @@ func Helper(name string) string
Helper returns the \_helpers.tpl file for a chart.
<a name="NewCronJob"></a>
## func [NewCronJob](<https://github.com/katenary/katenary/blob/develop/generator/cronJob.go#L28>)
## func [NewCronJob](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/cronJob.go#L29>)
```go
func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) (*CronJob, *RBAC)
@@ -89,7 +89,7 @@ func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) (
NewCronJob creates a new CronJob from a compose service. The appName is the name of the application taken from the project name.
<a name="ToK8SYaml"></a>
## func [ToK8SYaml](<https://github.com/katenary/katenary/blob/develop/generator/utils.go#L90>)
## func [ToK8SYaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/utils.go#L91>)
```go
func ToK8SYaml(obj any) ([]byte, error)
@@ -98,7 +98,7 @@ func ToK8SYaml(obj any) ([]byte, error)
<a name="UnWrapTPL"></a>
## func [UnWrapTPL](<https://github.com/katenary/katenary/blob/develop/generator/utils.go#L86>)
## func [UnWrapTPL](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/utils.go#L87>)
```go
func UnWrapTPL(in []byte) []byte
@@ -107,7 +107,7 @@ func UnWrapTPL(in []byte) []byte
UnWrapTPL removes the line wrapping from a template.
<a name="ChartTemplate"></a>
## type [ChartTemplate](<https://github.com/katenary/katenary/blob/develop/generator/chart.go#L21-L24>)
## type [ChartTemplate](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/chart.go#L22-L25>)
ChartTemplate is a template of a chart. It contains the content of the template and the name of the service. This is used internally to generate the templates.
@@ -119,7 +119,7 @@ type ChartTemplate struct {
```
<a name="ConfigMap"></a>
## type [ConfigMap](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L37-L42>)
## type [ConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L38-L43>)
ConfigMap is a kubernetes ConfigMap. Implements the DataMap interface.
@@ -131,7 +131,7 @@ type ConfigMap struct {
```
<a name="NewConfigMap"></a>
### func [NewConfigMap](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L46>)
### func [NewConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L47>)
```go
func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *ConfigMap
@@ -140,7 +140,7 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co
NewConfigMap creates a new ConfigMap from a compose service. The appName is the name of the application taken from the project name. The ConfigMap is filled by environment variables and labels "map\-env".
<a name="NewConfigMapFromDirectory"></a>
### func [NewConfigMapFromDirectory](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L119>)
### func [NewConfigMapFromDirectory](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L120>)
```go
func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string) *ConfigMap
@@ -149,7 +149,7 @@ func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string
NewConfigMapFromDirectory creates a new ConfigMap from a compose service. This path is the path to the file or directory. If the path is a directory, all files in the directory are added to the ConfigMap. Each subdirectory are ignored. Note that the Generate\(\) function will create the subdirectories ConfigMaps.
<a name="ConfigMap.AddBinaryData"></a>
### func \(\*ConfigMap\) [AddBinaryData](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L157>)
### func \(\*ConfigMap\) [AddBinaryData](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L158>)
```go
func (c *ConfigMap) AddBinaryData(key string, value []byte)
@@ -158,7 +158,7 @@ func (c *ConfigMap) AddBinaryData(key string, value []byte)
AddBinaryData adds binary data to the configmap. Append or overwrite the value if the key already exists.
<a name="ConfigMap.AddData"></a>
### func \(\*ConfigMap\) [AddData](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L152>)
### func \(\*ConfigMap\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L153>)
```go
func (c *ConfigMap) AddData(key, value string)
@@ -167,7 +167,7 @@ func (c *ConfigMap) AddData(key, value string)
AddData adds a key value pair to the configmap. Append or overwrite the value if the key already exists.
<a name="ConfigMap.AppendDir"></a>
### func \(\*ConfigMap\) [AppendDir](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L166>)
### func \(\*ConfigMap\) [AppendDir](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L167>)
```go
func (c *ConfigMap) AppendDir(path string) error
@@ -176,7 +176,7 @@ func (c *ConfigMap) AppendDir(path string) error
AppendDir adds files from given path to the configmap. It is not recursive, to add all files in a directory, you need to call this function for each subdirectory.
<a name="ConfigMap.AppendFile"></a>
### func \(\*ConfigMap\) [AppendFile](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L213>)
### func \(\*ConfigMap\) [AppendFile](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L214>)
```go
func (c *ConfigMap) AppendFile(path string) error
@@ -185,7 +185,7 @@ func (c *ConfigMap) AppendFile(path string) error
<a name="ConfigMap.Filename"></a>
### func \(\*ConfigMap\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L237>)
### func \(\*ConfigMap\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L238>)
```go
func (c *ConfigMap) Filename() string
@@ -194,7 +194,7 @@ func (c *ConfigMap) Filename() string
Filename returns the filename of the configmap. If the configmap is used for files, the filename contains the path.
<a name="ConfigMap.SetData"></a>
### func \(\*ConfigMap\) [SetData](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L247>)
### func \(\*ConfigMap\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L248>)
```go
func (c *ConfigMap) SetData(data map[string]string)
@@ -203,7 +203,7 @@ func (c *ConfigMap) SetData(data map[string]string)
SetData sets the data of the configmap. It replaces the entire data.
<a name="ConfigMap.Yaml"></a>
### func \(\*ConfigMap\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L252>)
### func \(\*ConfigMap\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L253>)
```go
func (c *ConfigMap) Yaml() ([]byte, error)
@@ -212,7 +212,7 @@ func (c *ConfigMap) Yaml() ([]byte, error)
Yaml returns the yaml representation of the configmap
<a name="ConfigMapMount"></a>
## type [ConfigMapMount](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L28-L31>)
## type [ConfigMapMount](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L29-L32>)
@@ -223,7 +223,7 @@ type ConfigMapMount struct {
```
<a name="ConvertOptions"></a>
## type [ConvertOptions](<https://github.com/katenary/katenary/blob/develop/generator/chart.go#L27-L36>)
## type [ConvertOptions](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/chart.go#L28-L37>)
ConvertOptions are the options to convert a compose project to a helm chart.
@@ -241,7 +241,7 @@ type ConvertOptions struct {
```
<a name="CronJob"></a>
## type [CronJob](<https://github.com/katenary/katenary/blob/develop/generator/cronJob.go#L22-L25>)
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/cronJob.go#L23-L26>)
CronJob is a kubernetes CronJob.
@@ -253,7 +253,7 @@ type CronJob struct {
```
<a name="CronJob.Filename"></a>
### func \(\*CronJob\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/cronJob.go#L114>)
### func \(\*CronJob\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/cronJob.go#L115>)
```go
func (c *CronJob) Filename() string
@@ -264,7 +264,7 @@ Filename returns the filename of the cronjob.
Implements the Yaml interface.
<a name="CronJob.Yaml"></a>
### func \(\*CronJob\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/cronJob.go#L121>)
### func \(\*CronJob\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/cronJob.go#L122>)
```go
func (c *CronJob) Yaml() ([]byte, error)
@@ -275,7 +275,7 @@ Yaml returns the yaml representation of the cronjob.
Implements the Yaml interface.
<a name="CronJobValue"></a>
## type [CronJobValue](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L118-L123>)
## type [CronJobValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L118-L123>)
CronJobValue is a cronjob configuration that will be saved in values.yaml.
@@ -289,7 +289,7 @@ type CronJobValue struct {
```
<a name="DataMap"></a>
## type [DataMap](<https://github.com/katenary/katenary/blob/develop/generator/types.go#L4-L7>)
## type [DataMap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/types.go#L4-L7>)
DataMap is a kubernetes ConfigMap or Secret. It can be used to add data to the ConfigMap or Secret.
@@ -301,7 +301,7 @@ type DataMap interface {
```
<a name="Deployment"></a>
## type [Deployment](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L34-L44>)
## type [Deployment](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L35-L45>)
Deployment is a kubernetes Deployment.
@@ -313,7 +313,7 @@ type Deployment struct {
```
<a name="NewDeployment"></a>
### func [NewDeployment](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L48>)
### func [NewDeployment](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L49>)
```go
func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment
@@ -322,7 +322,7 @@ func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment
NewDeployment creates a new Deployment from a compose service. The appName is the name of the application taken from the project name. It also creates the Values map that will be used to create the values.yaml file.
<a name="Deployment.AddContainer"></a>
### func \(\*Deployment\) [AddContainer](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L115>)
### func \(\*Deployment\) [AddContainer](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L116>)
```go
func (d *Deployment) AddContainer(service types.ServiceConfig)
@@ -331,7 +331,7 @@ func (d *Deployment) AddContainer(service types.ServiceConfig)
AddContainer adds a container to the deployment.
<a name="Deployment.AddHealthCheck"></a>
### func \(\*Deployment\) [AddHealthCheck](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L161>)
### func \(\*Deployment\) [AddHealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L162>)
```go
func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *corev1.Container)
@@ -340,7 +340,7 @@ func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *core
<a name="Deployment.AddIngress"></a>
### func \(\*Deployment\) [AddIngress](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L190>)
### func \(\*Deployment\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L191>)
```go
func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *Ingress
@@ -349,7 +349,7 @@ func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *In
AddIngress adds an ingress to the deployment. It creates the ingress object.
<a name="Deployment.AddLegacyVolume"></a>
### func \(\*Deployment\) [AddLegacyVolume](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L220>)
### func \(\*Deployment\) [AddLegacyVolume](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L221>)
```go
func (d *Deployment) AddLegacyVolume(name, kind string)
@@ -358,7 +358,7 @@ func (d *Deployment) AddLegacyVolume(name, kind string)
<a name="Deployment.AddVolumes"></a>
### func \(\*Deployment\) [AddVolumes](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L196>)
### func \(\*Deployment\) [AddVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L197>)
```go
func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
@@ -367,7 +367,7 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
AddVolumes adds a volume to the deployment. It does not create the PVC, it only adds the volumes to the deployment. If the volume is a bind volume it will warn the user that it is not supported yet.
<a name="Deployment.BindFrom"></a>
### func \(\*Deployment\) [BindFrom](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L241>)
### func \(\*Deployment\) [BindFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L242>)
```go
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
@@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
<a name="Deployment.BindMapFilesToContainer"></a>
### func \(\*Deployment\) [BindMapFilesToContainer](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L375>)
### func \(\*Deployment\) [BindMapFilesToContainer](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L376>)
```go
func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int)
@@ -385,7 +385,7 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret
<a name="Deployment.DependsOn"></a>
### func \(\*Deployment\) [DependsOn](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L269>)
### func \(\*Deployment\) [DependsOn](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L270>)
```go
func (d *Deployment) DependsOn(to *Deployment, servicename string) error
@@ -394,7 +394,7 @@ func (d *Deployment) DependsOn(to *Deployment, servicename string) error
DependsOn adds a initContainer to the deployment that will wait for the service to be up.
<a name="Deployment.Filename"></a>
### func \(\*Deployment\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L300>)
### func \(\*Deployment\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L301>)
```go
func (d *Deployment) Filename() string
@@ -403,7 +403,7 @@ func (d *Deployment) Filename() string
Filename returns the filename of the deployment.
<a name="Deployment.MountExchangeVolumes"></a>
### func \(\*Deployment\) [MountExchangeVolumes](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L426>)
### func \(\*Deployment\) [MountExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L427>)
```go
func (d *Deployment) MountExchangeVolumes()
@@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes()
<a name="Deployment.SetEnvFrom"></a>
### func \(\*Deployment\) [SetEnvFrom](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L305>)
### func \(\*Deployment\) [SetEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L306>)
```go
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
@@ -421,7 +421,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
SetEnvFrom sets the environment variables to a configmap. The configmap is created.
<a name="Deployment.Yaml"></a>
### func \(\*Deployment\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/deployment.go#L450>)
### func \(\*Deployment\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/deployment.go#L451>)
```go
func (d *Deployment) Yaml() ([]byte, error)
@@ -430,7 +430,7 @@ func (d *Deployment) Yaml() ([]byte, error)
Yaml returns the yaml representation of the deployment.
<a name="FileMapUsage"></a>
## type [FileMapUsage](<https://github.com/katenary/katenary/blob/develop/generator/configMap.go#L21>)
## type [FileMapUsage](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/configMap.go#L22>)
FileMapUsage is the usage of the filemap.
@@ -448,7 +448,7 @@ const (
```
<a name="HelmChart"></a>
## type [HelmChart](<https://github.com/katenary/katenary/blob/develop/generator/chart.go#L40-L53>)
## type [HelmChart](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/chart.go#L41-L54>)
HelmChart is a Helm Chart representation. It contains all the templates, values, versions, helpers...
@@ -471,7 +471,7 @@ type HelmChart struct {
```
<a name="Generate"></a>
### func [Generate](<https://github.com/katenary/katenary/blob/develop/generator/generator.go#L31>)
### func [Generate](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/generator.go#L32>)
```go
func Generate(project *types.Project) (*HelmChart, error)
@@ -491,7 +491,7 @@ The Generate function will create the HelmChart object this way:
- Merge the same\-pod services.
<a name="NewChart"></a>
### func [NewChart](<https://github.com/katenary/katenary/blob/develop/generator/chart.go#L56>)
### func [NewChart](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/chart.go#L57>)
```go
func NewChart(name string) *HelmChart
@@ -500,7 +500,7 @@ func NewChart(name string) *HelmChart
NewChart creates a new empty chart with the given name.
<a name="HelmChart.SaveTemplates"></a>
### func \(\*HelmChart\) [SaveTemplates](<https://github.com/katenary/katenary/blob/develop/generator/chart.go#L71>)
### func \(\*HelmChart\) [SaveTemplates](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/chart.go#L72>)
```go
func (chart *HelmChart) SaveTemplates(templateDir string)
@@ -509,7 +509,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string)
SaveTemplates the templates of the chart to the given directory.
<a name="Ingress"></a>
## type [Ingress](<https://github.com/katenary/katenary/blob/develop/generator/ingress.go#L17-L21>)
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/ingress.go#L18-L22>)
@@ -521,7 +521,7 @@ type Ingress struct {
```
<a name="NewIngress"></a>
### func [NewIngress](<https://github.com/katenary/katenary/blob/develop/generator/ingress.go#L24>)
### func [NewIngress](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/ingress.go#L25>)
```go
func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress
@@ -530,7 +530,7 @@ func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress
NewIngress creates a new Ingress from a compose service.
<a name="Ingress.Filename"></a>
### func \(\*Ingress\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/ingress.go#L128>)
### func \(\*Ingress\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/ingress.go#L129>)
```go
func (ingress *Ingress) Filename() string
@@ -539,7 +539,7 @@ func (ingress *Ingress) Filename() string
<a name="Ingress.Yaml"></a>
### func \(\*Ingress\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/ingress.go#L132>)
### func \(\*Ingress\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/ingress.go#L133>)
```go
func (ingress *Ingress) Yaml() ([]byte, error)
@@ -548,7 +548,7 @@ func (ingress *Ingress) Yaml() ([]byte, error)
<a name="IngressValue"></a>
## type [IngressValue](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L29-L36>)
## type [IngressValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L29-L36>)
IngressValue is a ingress configuration that will be saved in values.yaml.
@@ -564,7 +564,7 @@ type IngressValue struct {
```
<a name="PersistenceValue"></a>
## type [PersistenceValue](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L16-L21>)
## type [PersistenceValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L16-L21>)
PersistenceValue is a persistence configuration that will be saved in values.yaml.
@@ -578,7 +578,7 @@ type PersistenceValue struct {
```
<a name="RBAC"></a>
## type [RBAC](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L20-L24>)
## type [RBAC](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L20-L24>)
RBAC is a kubernetes RBAC containing a role, a rolebinding and an associated serviceaccount.
@@ -591,7 +591,7 @@ type RBAC struct {
```
<a name="NewRBAC"></a>
### func [NewRBAC](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L27>)
### func [NewRBAC](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L27>)
```go
func NewRBAC(service types.ServiceConfig, appName string) *RBAC
@@ -600,7 +600,7 @@ func NewRBAC(service types.ServiceConfig, appName string) *RBAC
NewRBAC creates a new RBAC from a compose service. The appName is the name of the application taken from the project name.
<a name="RepositoryValue"></a>
## type [RepositoryValue](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L10-L13>)
## type [RepositoryValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L10-L13>)
RepositoryValue is a docker repository image and tag that will be saved in values.yaml.
@@ -612,7 +612,7 @@ type RepositoryValue struct {
```
<a name="Role"></a>
## type [Role](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L114-L117>)
## type [Role](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L114-L117>)
Role is a kubernetes Role.
@@ -624,7 +624,7 @@ type Role struct {
```
<a name="Role.Filename"></a>
### func \(\*Role\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L119>)
### func \(\*Role\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L119>)
```go
func (r *Role) Filename() string
@@ -633,7 +633,7 @@ func (r *Role) Filename() string
<a name="Role.Yaml"></a>
### func \(\*Role\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L123>)
### func \(\*Role\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L123>)
```go
func (r *Role) Yaml() ([]byte, error)
@@ -642,7 +642,7 @@ func (r *Role) Yaml() ([]byte, error)
<a name="RoleBinding"></a>
## type [RoleBinding](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L100-L103>)
## type [RoleBinding](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L100-L103>)
RoleBinding is a kubernetes RoleBinding.
@@ -654,7 +654,7 @@ type RoleBinding struct {
```
<a name="RoleBinding.Filename"></a>
### func \(\*RoleBinding\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L105>)
### func \(\*RoleBinding\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L105>)
```go
func (r *RoleBinding) Filename() string
@@ -663,7 +663,7 @@ func (r *RoleBinding) Filename() string
<a name="RoleBinding.Yaml"></a>
### func \(\*RoleBinding\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L109>)
### func \(\*RoleBinding\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L109>)
```go
func (r *RoleBinding) Yaml() ([]byte, error)
@@ -672,7 +672,7 @@ func (r *RoleBinding) Yaml() ([]byte, error)
<a name="Secret"></a>
## type [Secret](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L22-L25>)
## type [Secret](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L23-L26>)
Secret is a kubernetes Secret.
@@ -686,7 +686,7 @@ type Secret struct {
```
<a name="NewSecret"></a>
### func [NewSecret](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L28>)
### func [NewSecret](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L29>)
```go
func NewSecret(service types.ServiceConfig, appName string) *Secret
@@ -695,7 +695,7 @@ func NewSecret(service types.ServiceConfig, appName string) *Secret
NewSecret creates a new Secret from a compose service
<a name="Secret.AddData"></a>
### func \(\*Secret\) [AddData](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L70>)
### func \(\*Secret\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L71>)
```go
func (s *Secret) AddData(key, value string)
@@ -704,7 +704,7 @@ func (s *Secret) AddData(key, value string)
AddData adds a key value pair to the secret.
<a name="Secret.Filename"></a>
### func \(\*Secret\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L86>)
### func \(\*Secret\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L87>)
```go
func (s *Secret) Filename() string
@@ -713,7 +713,7 @@ func (s *Secret) Filename() string
Filename returns the filename of the secret.
<a name="Secret.SetData"></a>
### func \(\*Secret\) [SetData](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L91>)
### func \(\*Secret\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L92>)
```go
func (s *Secret) SetData(data map[string]string)
@@ -722,7 +722,7 @@ func (s *Secret) SetData(data map[string]string)
SetData sets the data of the secret.
<a name="Secret.Yaml"></a>
### func \(\*Secret\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/secret.go#L98>)
### func \(\*Secret\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/secret.go#L99>)
```go
func (s *Secret) Yaml() ([]byte, error)
@@ -731,7 +731,7 @@ func (s *Secret) Yaml() ([]byte, error)
Yaml returns the yaml representation of the secret.
<a name="Service"></a>
## type [Service](<https://github.com/katenary/katenary/blob/develop/generator/service.go#L18-L21>)
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/service.go#L19-L22>)
Service is a kubernetes Service.
@@ -743,7 +743,7 @@ type Service struct {
```
<a name="NewService"></a>
### func [NewService](<https://github.com/katenary/katenary/blob/develop/generator/service.go#L24>)
### func [NewService](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/service.go#L25>)
```go
func NewService(service types.ServiceConfig, appName string) *Service
@@ -752,7 +752,7 @@ func NewService(service types.ServiceConfig, appName string) *Service
NewService creates a new Service from a compose service.
<a name="Service.AddPort"></a>
### func \(\*Service\) [AddPort](<https://github.com/katenary/katenary/blob/develop/generator/service.go#L53>)
### func \(\*Service\) [AddPort](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/service.go#L54>)
```go
func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string)
@@ -761,7 +761,7 @@ func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string)
AddPort adds a port to the service.
<a name="Service.Filename"></a>
### func \(\*Service\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/service.go#L78>)
### func \(\*Service\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/service.go#L75>)
```go
func (s *Service) Filename() string
@@ -770,7 +770,7 @@ func (s *Service) Filename() string
Filename returns the filename of the service.
<a name="Service.Yaml"></a>
### func \(\*Service\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/service.go#L83>)
### func \(\*Service\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/service.go#L80>)
```go
func (s *Service) Yaml() ([]byte, error)
@@ -779,7 +779,7 @@ func (s *Service) Yaml() ([]byte, error)
Yaml returns the yaml representation of the service.
<a name="ServiceAccount"></a>
## type [ServiceAccount](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L132-L135>)
## type [ServiceAccount](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L132-L135>)
ServiceAccount is a kubernetes ServiceAccount.
@@ -791,7 +791,7 @@ type ServiceAccount struct {
```
<a name="ServiceAccount.Filename"></a>
### func \(\*ServiceAccount\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L137>)
### func \(\*ServiceAccount\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L137>)
```go
func (r *ServiceAccount) Filename() string
@@ -800,7 +800,7 @@ func (r *ServiceAccount) Filename() string
<a name="ServiceAccount.Yaml"></a>
### func \(\*ServiceAccount\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/rbac.go#L141>)
### func \(\*ServiceAccount\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/rbac.go#L141>)
```go
func (r *ServiceAccount) Yaml() ([]byte, error)
@@ -809,7 +809,7 @@ func (r *ServiceAccount) Yaml() ([]byte, error)
<a name="TLS"></a>
## type [TLS](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L23-L26>)
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L23-L26>)
@@ -821,7 +821,7 @@ type TLS struct {
```
<a name="Value"></a>
## type [Value](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L39-L50>)
## type [Value](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L39-L50>)
Value will be saved in values.yaml. It contains configuration for all deployment and services.
@@ -841,7 +841,7 @@ type Value struct {
```
<a name="NewValue"></a>
### func [NewValue](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L57>)
### func [NewValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L57>)
```go
func NewValue(service types.ServiceConfig, main ...bool) *Value
@@ -852,7 +852,7 @@ NewValue creates a new Value from a compose service. The value contains the nece
If \`main\` is true, the tag will be empty because it will be set in the helm chart appVersion.
<a name="Value.AddIngress"></a>
### func \(\*Value\) [AddIngress](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L90>)
### func \(\*Value\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L90>)
```go
func (v *Value) AddIngress(host, path string)
@@ -861,7 +861,7 @@ func (v *Value) AddIngress(host, path string)
<a name="Value.AddPersistence"></a>
### func \(\*Value\) [AddPersistence](<https://github.com/katenary/katenary/blob/develop/generator/values.go#L104>)
### func \(\*Value\) [AddPersistence](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/values.go#L104>)
```go
func (v *Value) AddPersistence(volumeName string)
@@ -870,7 +870,7 @@ func (v *Value) AddPersistence(volumeName string)
AddPersistence adds persistence configuration to the Value.
<a name="VolumeClaim"></a>
## type [VolumeClaim](<https://github.com/katenary/katenary/blob/develop/generator/volume.go#L18-L23>)
## type [VolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/volume.go#L19-L24>)
VolumeClaim is a kubernetes VolumeClaim. This is a PersistentVolumeClaim.
@@ -882,7 +882,7 @@ type VolumeClaim struct {
```
<a name="NewVolumeClaim"></a>
### func [NewVolumeClaim](<https://github.com/katenary/katenary/blob/develop/generator/volume.go#L26>)
### func [NewVolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/volume.go#L27>)
```go
func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *VolumeClaim
@@ -891,7 +891,7 @@ func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *Vo
NewVolumeClaim creates a new VolumeClaim from a compose service.
<a name="VolumeClaim.Filename"></a>
### func \(\*VolumeClaim\) [Filename](<https://github.com/katenary/katenary/blob/develop/generator/volume.go#L62>)
### func \(\*VolumeClaim\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/volume.go#L63>)
```go
func (v *VolumeClaim) Filename() string
@@ -900,7 +900,7 @@ func (v *VolumeClaim) Filename() string
Filename returns the suggested filename for a VolumeClaim.
<a name="VolumeClaim.Yaml"></a>
### func \(\*VolumeClaim\) [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/volume.go#L67>)
### func \(\*VolumeClaim\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/volume.go#L68>)
```go
func (v *VolumeClaim) Yaml() ([]byte, error)
@@ -909,7 +909,7 @@ func (v *VolumeClaim) Yaml() ([]byte, error)
Yaml marshals a VolumeClaim into yaml.
<a name="Yaml"></a>
## type [Yaml](<https://github.com/katenary/katenary/blob/develop/generator/types.go#L10-L13>)
## type [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/types.go#L10-L13>)
Yaml is a kubernetes object that can be converted to yaml.

View File

@@ -3,12 +3,12 @@
# extrafiles
```go
import "katenary/generator/extrafiles"
import "repo.katenary.io/katenary/katenary/internal/generator/extrafiles"
```
Package extrafiles provides function to generate the Chart files that are not objects. Like README.md and notes.txt...
## func [NotesFile](<https://github.com/katenary/katenary/blob/develop/generator/extrafiles/notes.go#L13>)
## func [NotesFile](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/extrafiles/notes.go#L13>)
```go
func NotesFile(services []string) string
@@ -17,7 +17,7 @@ func NotesFile(services []string) string
NotesFile returns the content of the note.txt file.
<a name="ReadMeFile"></a>
## func [ReadMeFile](<https://github.com/katenary/katenary/blob/develop/generator/extrafiles/readme.go#L46>)
## func [ReadMeFile](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/extrafiles/readme.go#L46>)
```go
func ReadMeFile(charname, description string, values map[string]any) string

View File

@@ -0,0 +1,67 @@
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# katenaryfile
```go
import "repo.katenary.io/katenary/katenary/internal/generator/katenaryfile"
```
Package katenaryfile is a package for reading and writing katenary files.
A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you can define the configuration of the conversion avoiding the use of labels in the compose file.
Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary.
## func [GenerateSchema](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/katenaryfile/main.go#L138>)
```go
func GenerateSchema() string
```
GenerateSchema generates the schema for the katenary.yaml file.
<a name="OverrideWithConfig"></a>
## func [OverrideWithConfig](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/katenaryfile/main.go#L50>)
```go
func OverrideWithConfig(project *types.Project)
```
OverrideWithConfig overrides the project with the katenary.yaml file. It will set the labels of the services with the values from the katenary.yaml file. It work in memory, so it will not modify the original project.
<a name="Service"></a>
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/katenaryfile/main.go#L28-L45>)
Service is a struct that contains the service configuration for katenary
```go
type Service struct {
MainApp *bool `yaml:"main-app,omitempty" json:"main-app,omitempty" jsonschema:"title=Is this service the main application"`
Values []StringOrMap `yaml:"values,omitempty" json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"`
Secrets *labelstructs.Secrets `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"`
Ports *labelstructs.Ports `yaml:"ports,omitempty" json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"`
Ingress *labelstructs.Ingress `yaml:"ingress,omitempty" json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"`
HealthCheck *labelstructs.HealthCheck `yaml:"health-check,omitempty" json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"`
SamePod *string `yaml:"same-pod,omitempty" json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"`
Description *string `yaml:"description,omitempty" json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"`
Ignore *bool `yaml:"ignore,omitempty" json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"`
Dependencies []labelstructs.Dependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"`
ConfigMapFiles *labelstructs.ConfigMapFiles `yaml:"configmap-files,omitempty" json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"`
MapEnv *labelstructs.MapEnv `yaml:"map-env,omitempty" json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"`
CronJob *labelstructs.CronJob `yaml:"cron-job,omitempty" json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"`
EnvFrom *labelstructs.EnvFrom `yaml:"env-from,omitempty" json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"`
ExchangeVolumes []*labelstructs.ExchangeVolume `yaml:"exchange-volumes,omitempty" json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"`
ValuesFrom *labelstructs.ValueFrom `yaml:"values-from,omitempty" json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"`
}
```
<a name="StringOrMap"></a>
## type [StringOrMap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/katenaryfile/main.go#L25>)
StringOrMap is a struct that can be either a string or a map of strings. It's a helper struct to unmarshal the katenary.yaml file and produce the schema
```go
type StringOrMap any
```
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)

View File

@@ -3,7 +3,7 @@
# labels
```go
import "katenary/generator/labels"
import "repo.katenary.io/katenary/katenary/internal/generator/labels"
```
Package labels provides functionality to parse and manipulate labels.
@@ -17,7 +17,7 @@ const KatenaryLabelPrefix = "katenary.v3"
```
<a name="GetLabelHelp"></a>
## func [GetLabelHelp](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L88>)
## func [GetLabelHelp](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L89>)
```go
func GetLabelHelp(asMarkdown bool) string
@@ -26,7 +26,7 @@ func GetLabelHelp(asMarkdown bool) string
GetLabelHelp return the help for the labels.
<a name="GetLabelHelpFor"></a>
## func [GetLabelHelpFor](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L97>)
## func [GetLabelHelpFor](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L98>)
```go
func GetLabelHelpFor(labelname string, asMarkdown bool) string
@@ -35,7 +35,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string
GetLabelHelpFor returns the help for a specific label.
<a name="GetLabelNames"></a>
## func [GetLabelNames](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L72>)
## func [GetLabelNames](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L73>)
```go
func GetLabelNames() []string
@@ -44,7 +44,7 @@ func GetLabelNames() []string
GetLabelNames returns a sorted list of all katenary label names.
<a name="Prefix"></a>
## func [Prefix](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L235>)
## func [Prefix](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L236>)
```go
func Prefix() string
@@ -53,7 +53,7 @@ func Prefix() string
<a name="Help"></a>
## type [Help](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L64-L69>)
## type [Help](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L65-L70>)
Help is the documentation of a label.
@@ -67,7 +67,7 @@ type Help struct {
```
<a name="Label"></a>
## type [Label](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L57>)
## type [Label](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L58>)
Label is a katenary label to find in compose files.
@@ -94,12 +94,12 @@ const (
LabelCronJob Label = KatenaryLabelPrefix + "/cronjob"
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
LabelValueFrom Label = KatenaryLabelPrefix + "/values-from"
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
)
```
<a name="LabelName"></a>
### func [LabelName](<https://github.com/katenary/katenary/blob/develop/generator/labels/katenaryLabels.go#L59>)
### func [LabelName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/katenaryLabels.go#L60>)
```go
func LabelName(name string) Label

View File

@@ -3,30 +3,30 @@
# labelstructs
```go
import "katenary/generator/labels/labelstructs"
import "repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
```
Package labelstructs is a package that contains the structs used to represent the labels in the yaml files.
## type [ConfigMapFile](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/configMap.go#L5>)
## type [ConfigMapFiles](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/configMap.go#L5>)
```go
type ConfigMapFile []string
type ConfigMapFiles []string
```
<a name="ConfigMapFileFrom"></a>
### func [ConfigMapFileFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/configMap.go#L7>)
### func [ConfigMapFileFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/configMap.go#L7>)
```go
func ConfigMapFileFrom(data string) (ConfigMapFile, error)
func ConfigMapFileFrom(data string) (ConfigMapFiles, error)
```
<a name="CronJob"></a>
## type [CronJob](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/cronJob.go#L5-L10>)
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/cronJob.go#L5-L10>)
@@ -40,7 +40,7 @@ type CronJob struct {
```
<a name="CronJobFrom"></a>
### func [CronJobFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/cronJob.go#L12>)
### func [CronJobFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/cronJob.go#L12>)
```go
func CronJobFrom(data string) (*CronJob, error)
@@ -49,7 +49,7 @@ func CronJobFrom(data string) (*CronJob, error)
<a name="Dependency"></a>
## type [Dependency](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/dependencies.go#L6-L12>)
## type [Dependency](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/dependencies.go#L6-L12>)
Dependency is a dependency of a chart to other charts.
@@ -64,7 +64,7 @@ type Dependency struct {
```
<a name="DependenciesFrom"></a>
### func [DependenciesFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/dependencies.go#L15>)
### func [DependenciesFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/dependencies.go#L15>)
```go
func DependenciesFrom(data string) ([]Dependency, error)
@@ -73,7 +73,7 @@ func DependenciesFrom(data string) ([]Dependency, error)
DependenciesFrom returns a slice of dependencies from the given string.
<a name="EnvFrom"></a>
## type [EnvFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/envFrom.go#L5>)
## type [EnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/envFrom.go#L5>)
@@ -82,7 +82,7 @@ type EnvFrom []string
```
<a name="EnvFromFrom"></a>
### func [EnvFromFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/envFrom.go#L8>)
### func [EnvFromFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/envFrom.go#L8>)
```go
func EnvFromFrom(data string) (EnvFrom, error)
@@ -91,7 +91,7 @@ func EnvFromFrom(data string) (EnvFrom, error)
EnvFromFrom returns a EnvFrom from the given string.
<a name="ExchangeVolume"></a>
## type [ExchangeVolume](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/exchangeVolume.go#L5-L10>)
## type [ExchangeVolume](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/exchangeVolume.go#L5-L10>)
@@ -105,7 +105,7 @@ type ExchangeVolume struct {
```
<a name="NewExchangeVolumes"></a>
### func [NewExchangeVolumes](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/exchangeVolume.go#L12>)
### func [NewExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/exchangeVolume.go#L12>)
```go
func NewExchangeVolumes(data string) ([]*ExchangeVolume, error)
@@ -114,7 +114,7 @@ func NewExchangeVolumes(data string) ([]*ExchangeVolume, error)
<a name="HealthCheck"></a>
## type [HealthCheck](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/probes.go#L11-L14>)
## type [HealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/probes.go#L11-L14>)
@@ -126,7 +126,7 @@ type HealthCheck struct {
```
<a name="ProbeFrom"></a>
### func [ProbeFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/probes.go#L16>)
### func [ProbeFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/probes.go#L16>)
```go
func ProbeFrom(data string) (*HealthCheck, error)
@@ -135,7 +135,7 @@ func ProbeFrom(data string) (*HealthCheck, error)
<a name="Ingress"></a>
## type [Ingress](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/ingress.go#L14-L22>)
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/ingress.go#L15-L23>)
@@ -152,7 +152,7 @@ type Ingress struct {
```
<a name="IngressFrom"></a>
### func [IngressFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/ingress.go#L25>)
### func [IngressFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/ingress.go#L26>)
```go
func IngressFrom(data string) (*Ingress, error)
@@ -161,7 +161,7 @@ func IngressFrom(data string) (*Ingress, error)
IngressFrom creates a new Ingress from a compose service.
<a name="MapEnv"></a>
## type [MapEnv](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/mapenv.go#L5>)
## type [MapEnv](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/mapenv.go#L5>)
@@ -170,7 +170,7 @@ type MapEnv map[string]string
```
<a name="MapEnvFrom"></a>
### func [MapEnvFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/mapenv.go#L8>)
### func [MapEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/mapenv.go#L8>)
```go
func MapEnvFrom(data string) (MapEnv, error)
@@ -179,7 +179,7 @@ func MapEnvFrom(data string) (MapEnv, error)
MapEnvFrom returns a MapEnv from the given string.
<a name="Ports"></a>
## type [Ports](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/ports.go#L5>)
## type [Ports](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/ports.go#L5>)
@@ -188,7 +188,7 @@ type Ports []uint32
```
<a name="PortsFrom"></a>
### func [PortsFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/ports.go#L8>)
### func [PortsFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/ports.go#L8>)
```go
func PortsFrom(data string) (Ports, error)
@@ -197,7 +197,7 @@ func PortsFrom(data string) (Ports, error)
PortsFrom returns a Ports from the given string.
<a name="Secrets"></a>
## type [Secrets](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/secrets.go#L5>)
## type [Secrets](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/secrets.go#L5>)
@@ -206,7 +206,7 @@ type Secrets []string
```
<a name="SecretsFrom"></a>
### func [SecretsFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/secrets.go#L7>)
### func [SecretsFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/secrets.go#L7>)
```go
func SecretsFrom(data string) (Secrets, error)
@@ -215,7 +215,7 @@ func SecretsFrom(data string) (Secrets, error)
<a name="TLS"></a>
## type [TLS](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/ingress.go#L10-L12>)
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/ingress.go#L11-L13>)
@@ -226,7 +226,7 @@ type TLS struct {
```
<a name="ValueFrom"></a>
## type [ValueFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/valueFrom.go#L5>)
## type [ValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/valueFrom.go#L5>)
@@ -235,7 +235,7 @@ type ValueFrom map[string]string
```
<a name="GetValueFrom"></a>
### func [GetValueFrom](<https://github.com/katenary/katenary/blob/develop/generator/labels/labelstructs/valueFrom.go#L7>)
### func [GetValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/generator/labels/labelstructs/valueFrom.go#L7>)
```go
func GetValueFrom(data string) (*ValueFrom, error)

View File

@@ -3,12 +3,12 @@
# parser
```go
import "katenary/parser"
import "repo.katenary.io/katenary/katenary/internal/parser"
```
Package parser is a wrapper around compose\-go to parse compose files.
## func [Parse](<https://github.com/katenary/katenary/blob/develop/parser/main.go#L29>)
## func [Parse](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/parser/main.go#L29>)
```go
func Parse(profiles []string, envFiles []string, dockerComposeFile ...string) (*types.Project, error)

View File

@@ -3,7 +3,7 @@
# utils
```go
import "katenary/utils"
import "repo.katenary.io/katenary/katenary/internal/utils"
```
Package utils provides some utility functions used in katenary. It defines some constants and functions used in the whole project.
@@ -17,7 +17,7 @@ const DirectoryPermission = 0o755
```
<a name="AsResourceName"></a>
## func [AsResourceName](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L196>)
## func [AsResourceName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L196>)
```go
func AsResourceName(name string) string
@@ -26,7 +26,7 @@ func AsResourceName(name string) string
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
<a name="Confirm"></a>
## func [Confirm](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L164>)
## func [Confirm](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L164>)
```go
func Confirm(question string, icon ...Icon) bool
@@ -35,7 +35,7 @@ func Confirm(question string, icon ...Icon) bool
Confirm asks a question and returns true if the answer is y.
<a name="CountStartingSpaces"></a>
## func [CountStartingSpaces](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L41>)
## func [CountStartingSpaces](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L41>)
```go
func CountStartingSpaces(line string) int
@@ -44,7 +44,7 @@ func CountStartingSpaces(line string) int
CountStartingSpaces counts the number of spaces at the beginning of a string.
<a name="EncodeBasicYaml"></a>
## func [EncodeBasicYaml](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L178>)
## func [EncodeBasicYaml](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L178>)
```go
func EncodeBasicYaml(data any) ([]byte, error)
@@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error)
EncodeBasicYaml encodes a basic yaml from an interface.
<a name="FixedResourceName"></a>
## func [FixedResourceName](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L190>)
## func [FixedResourceName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L190>)
```go
func FixedResourceName(name string) string
@@ -62,7 +62,7 @@ func FixedResourceName(name string) string
FixedResourceName returns a resource name without underscores to respect the kubernetes naming convention.
<a name="GetContainerByName"></a>
## func [GetContainerByName](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L87>)
## func [GetContainerByName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L87>)
```go
func GetContainerByName(name string, containers []corev1.Container) (*corev1.Container, int)
@@ -71,7 +71,7 @@ func GetContainerByName(name string, containers []corev1.Container) (*corev1.Con
GetContainerByName returns a container by name and its index in the array. It returns nil, \-1 if not found.
<a name="GetKind"></a>
## func [GetKind](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L54>)
## func [GetKind](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L54>)
```go
func GetKind(path string) (kind string)
@@ -80,7 +80,7 @@ func GetKind(path string) (kind string)
GetKind returns the kind of the resource from the file path.
<a name="GetServiceNameByPort"></a>
## func [GetServiceNameByPort](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L77>)
## func [GetServiceNameByPort](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L77>)
```go
func GetServiceNameByPort(port int) string
@@ -89,7 +89,7 @@ func GetServiceNameByPort(port int) string
GetServiceNameByPort returns the service name for a port. It the service name is not found, it returns an empty string.
<a name="GetValuesFromLabel"></a>
## func [GetValuesFromLabel](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L129>)
## func [GetValuesFromLabel](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L129>)
```go
func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[string]*EnvConfig
@@ -98,7 +98,7 @@ func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[str
GetValuesFromLabel returns a map of values from a label.
<a name="HashComposefiles"></a>
## func [HashComposefiles](<https://github.com/katenary/katenary/blob/develop/utils/hash.go#L12>)
## func [HashComposefiles](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/hash.go#L12>)
```go
func HashComposefiles(files []string) (string, error)
@@ -107,7 +107,7 @@ func HashComposefiles(files []string) (string, error)
HashComposefiles returns a hash of the compose files.
<a name="Int32Ptr"></a>
## func [Int32Ptr](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L35>)
## func [Int32Ptr](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L35>)
```go
func Int32Ptr(i int32) *int32
@@ -116,7 +116,7 @@ func Int32Ptr(i int32) *int32
Int32Ptr returns a pointer to an int32.
<a name="PathToName"></a>
## func [PathToName](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L106>)
## func [PathToName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L106>)
```go
func PathToName(path string) string
@@ -125,7 +125,7 @@ func PathToName(path string) string
PathToName converts a path to a kubernetes complient name.
<a name="StrPtr"></a>
## func [StrPtr](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L38>)
## func [StrPtr](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L38>)
```go
func StrPtr(s string) *string
@@ -134,7 +134,7 @@ func StrPtr(s string) *string
StrPtr returns a pointer to a string.
<a name="TplName"></a>
## func [TplName](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L22>)
## func [TplName](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L22>)
```go
func TplName(serviceName, appname string, suffix ...string) string
@@ -143,7 +143,7 @@ func TplName(serviceName, appname string, suffix ...string) string
TplName returns the name of the kubernetes resource as a template string. It is used in the templates and defined in \_helper.tpl file.
<a name="TplValue"></a>
## func [TplValue](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L97>)
## func [TplValue](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L97>)
```go
func TplValue(serviceName, variable string, pipes ...string) string
@@ -152,7 +152,7 @@ func TplValue(serviceName, variable string, pipes ...string) string
TplValue returns a string that can be used in a template to access a value from the values file.
<a name="Warn"></a>
## func [Warn](<https://github.com/katenary/katenary/blob/develop/utils/icons.go#L25>)
## func [Warn](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/icons.go#L25>)
```go
func Warn(msg ...any)
@@ -161,7 +161,7 @@ func Warn(msg ...any)
Warn prints a warning message
<a name="WordWrap"></a>
## func [WordWrap](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L159>)
## func [WordWrap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L159>)
```go
func WordWrap(text string, lineWidth int) string
@@ -170,7 +170,7 @@ func WordWrap(text string, lineWidth int) string
WordWrap wraps a string to a given line width. Warning: it may break the string. You need to check the result.
<a name="Wrap"></a>
## func [Wrap](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L71>)
## func [Wrap](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L71>)
```go
func Wrap(src, above, below string) string
@@ -179,7 +179,7 @@ func Wrap(src, above, below string) string
Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
<a name="EnvConfig"></a>
## type [EnvConfig](<https://github.com/katenary/katenary/blob/develop/utils/utils.go#L123-L126>)
## type [EnvConfig](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/utils.go#L123-L126>)
EnvConfig is a struct to hold the description of an environment variable.
@@ -191,7 +191,7 @@ type EnvConfig struct {
```
<a name="Icon"></a>
## type [Icon](<https://github.com/katenary/katenary/blob/develop/utils/icons.go#L6>)
## type [Icon](<https://repo.katenary.io/Katenary/katenary/blob/feat-move-to-gitea/internal/utils/icons.go#L6>)
Icon is a unicode icon

View File

@@ -51,8 +51,8 @@ copyright: Copyright &copy; 2021 - 2024 - Katenary authors
extra:
generator: false
social:
- icon: fontawesome/brands/github
link: https://github.com/katenary/katenary
- icon: fontawesome/brands/git
link: https://repo.katenary.io/katenary/katenary
nav:
- "Home": index.md
- usage.md
@@ -63,12 +63,12 @@ nav:
- FAQ: faq.md
- Go Packages:
- packages/cmd/katenary.md
- packages/parser.md
- packages/utils.md
- packages/internal/parser.md
- packages/internal/utils.md
- Generator:
- Index: packages/generator.md
- ExtraFiles: packages/generator/extrafiles.md
- Index: packages/internal/generator.md
- ExtraFiles: packages/internal/generator/extrafiles.md
- labels:
- packages/generator/labels.md
- Labelstructs: packages/generator/labels/labelstructs.md
- KatenaryFile: packages/generator/katenaryfile.md
- packages/internal/generator/labels.md
- Labelstructs: packages/internal/generator/labels/labelstructs.md
- KatenaryFile: packages/internal/generator/katenaryfile.md

30
go.mod
View File

@@ -1,8 +1,6 @@
module katenary // github.com/katenay/katenary
module repo.katenary.io/katenary/katenary
go 1.24.0
toolchain go1.24.3
go 1.25
require (
github.com/compose-spec/compose-go v1.20.2
@@ -11,18 +9,18 @@ require (
github.com/spf13/cobra v1.9.1
github.com/thediveo/netdb v1.1.2
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.33.2
k8s.io/apimachinery v0.33.2
sigs.k8s.io/yaml v1.5.0
k8s.io/api v0.33.4
k8s.io/apimachinery v0.33.4
sigs.k8s.io/yaml v1.6.0
)
require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
@@ -38,22 +36,22 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
)

51
go.sum
View File

@@ -11,12 +11,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/fxamacker/cbor/v2 v2.8.0 h1:fFtUGXUzXPHTIUdne5+zzMPTfffl3RD5qYnkY40vtxU=
github.com/fxamacker/cbor/v2 v2.8.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
@@ -73,8 +73,9 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -102,37 +103,37 @@ go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE=
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -147,21 +148,21 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
k8s.io/api v0.33.2 h1:YgwIS5jKfA+BZg//OQhkJNIfie/kmRsO0BmNaVSimvY=
k8s.io/api v0.33.2/go.mod h1:fhrbphQJSM2cXzCWgqU29xLDuks4mu7ti9vveEnpSXs=
k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/api v0.33.4 h1:oTzrFVNPXBjMu0IlpA2eDDIU49jsuEorGHB4cvKupkk=
k8s.io/api v0.33.4/go.mod h1:VHQZ4cuxQ9sCUMESJV5+Fe8bGnqAARZ08tSTdHWfeAc=
k8s.io/apimachinery v0.33.4 h1:SOf/JW33TP0eppJMkIgQ+L6atlDiP/090oaX0y9pd9s=
k8s.io/apimachinery v0.33.4/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ=
sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=

View File

@@ -2,9 +2,6 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"maps"
"os"
@@ -12,6 +9,10 @@ import (
"slices"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
)
@@ -348,10 +349,10 @@ func (chart *HelmChart) setSharedConf(service types.ServiceConfig, deployments m
// setEnvironmentValuesFrom sets the environment values from another service.
func (chart *HelmChart) setEnvironmentValuesFrom(service types.ServiceConfig, deployments map[string]*Deployment) {
if _, ok := service.Labels[labels.LabelValueFrom]; !ok {
if _, ok := service.Labels[labels.LabelValuesFrom]; !ok {
return
}
mapping, err := labelstructs.GetValueFrom(service.Labels[labels.LabelValueFrom])
mapping, err := labelstructs.GetValueFrom(service.Labels[labels.LabelValuesFrom])
if err != nil {
log.Fatal("error unmarshaling values-from label:", err)
}

View File

@@ -2,11 +2,12 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"os"
"strings"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"

View File

@@ -2,9 +2,6 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"os"
"path/filepath"
@@ -12,6 +9,10 @@ import (
"strings"
"unicode/utf8"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -2,10 +2,13 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"io"
"os"
"regexp"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"github.com/compose-spec/compose-go/types"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"
@@ -90,3 +93,41 @@ func TestAppendBadDir(t *testing.T) {
t.Errorf("Expected error, got nil")
}
}
func TestRootConfigmapfile(t *testing.T) {
composeFile := `
services:
web:
image: nginx
volumes:
- ./foo.txt:/etc/foo.txt
labels:
%[1]s/configmap-files: |-
- ./foo.txt
`
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
tmpDir := setup(composeFile)
defer teardown(tmpDir)
currentDir, _ := os.Getwd()
os.Chdir(tmpDir)
defer os.Chdir(currentDir)
fooTxt := "foo content"
fooFp, _ := os.Create("foo.txt")
io.WriteString(fooFp, fooTxt)
fooFp.Close()
output := internalCompileTest(t, "-s", "templates/web/statics/configmap.yaml")
configMap := v1.ConfigMap{}
if err := yaml.Unmarshal([]byte(output), &configMap); err != nil {
t.Errorf(unmarshalError, err)
}
if configMap.Data == nil {
t.Error("Expected configmap data to not be nil")
}
// if the configmap.Name ends by anything that is not alphanumeric, there is a problem
valid := regexp.MustCompile(`.*[a-zA-Z0-9]+$`)
if !valid.MatchString(configMap.Name) {
t.Errorf("ConfigMap name %s is not valid", configMap.Name)
}
}

View File

@@ -4,12 +4,6 @@ import (
"bytes"
"errors"
"fmt"
"katenary/generator/extrafiles"
"katenary/generator/katenaryfile"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/parser"
"katenary/utils"
"log"
"os"
"os/exec"
@@ -18,6 +12,13 @@ import (
"strings"
"time"
"repo.katenary.io/katenary/katenary/internal/generator/extrafiles"
"repo.katenary.io/katenary/katenary/internal/generator/katenaryfile"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/parser"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
)

View File

@@ -1,12 +1,13 @@
package generator
import (
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"

View File

@@ -2,9 +2,6 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"os"
"path/filepath"
@@ -12,6 +9,10 @@ import (
"strings"
"time"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
@@ -635,12 +636,16 @@ func (d *Deployment) appendFileToConfigMap(service types.ServiceConfig, appName
// in generate.go
dirname := filepath.Dir(volume.Source)
pathname := utils.PathToName(dirname)
pathname = strings.TrimSpace(pathname)
if len(pathname) != 0 {
pathname += "-" + pathname
}
var cm *ConfigMap
if v, ok := d.configMaps[pathname]; !ok {
cm = NewConfigMap(*d.service, appName, true)
cm.usage = FileMapUsageFiles
cm.path = dirname
cm.Name = utils.TplName(service.Name, appName) + "-" + pathname
cm.Name = utils.TplName(service.Name, appName) + pathname
d.configMaps[pathname] = &ConfigMapMount{
configMap: cm,
mountPath: []mountPathConfig{{

View File

@@ -2,11 +2,12 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"os"
"strings"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
yaml3 "gopkg.in/yaml.v3"
v1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

View File

@@ -3,13 +3,14 @@ package generator
import (
"bytes"
"fmt"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"regexp"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"
@@ -226,7 +227,7 @@ func fixResourceNames(project *types.Project) error {
project.Services[j] = s
}
// also, the value-from label should be updated
if valuefrom, ok := s.Labels[labels.LabelValueFrom]; ok {
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
vf, err := labelstructs.GetValueFrom(valuefrom)
if err != nil {
return err
@@ -240,7 +241,7 @@ func fixResourceNames(project *types.Project) error {
if err != nil {
return err
}
s.Labels[labels.LabelValueFrom] = string(output)
s.Labels[labels.LabelValuesFrom] = string(output)
}
}
service.Name = fixed

View File

@@ -1,8 +1,9 @@
package generator
import (
"katenary/generator/labels"
"regexp"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
)
var (

View File

@@ -2,8 +2,9 @@ package generator
import (
_ "embed"
"katenary/generator/labels"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
)
// helmHelper is a template for the _helpers.tpl file in the chart templates directory.

View File

@@ -1,12 +1,13 @@
package generator
import (
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
networkv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -2,10 +2,11 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"os"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
v1 "k8s.io/api/networking/v1"
"sigs.k8s.io/yaml"
)

View File

@@ -4,14 +4,15 @@ import (
"bytes"
"encoding/json"
"fmt"
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"log"
"os"
"reflect"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
"github.com/invopop/jsonschema"
"gopkg.in/yaml.v3"
@@ -25,22 +26,22 @@ type StringOrMap any
// Service is a struct that contains the service configuration for katenary
type Service struct {
MainApp *bool `json:"main-app,omitempty" jsonschema:"title=Is this service the main application"`
Values []StringOrMap `json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"`
Secrets *labelstructs.Secrets `json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"`
Ports *labelstructs.Ports `json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"`
Ingress *labelstructs.Ingress `json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"`
HealthCheck *labelstructs.HealthCheck `json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"`
SamePod *string `json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"`
Description *string `json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"`
Ignore *bool `json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"`
Dependencies []labelstructs.Dependency `json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"`
ConfigMapFile *labelstructs.ConfigMapFile `json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"`
MapEnv *labelstructs.MapEnv `json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"`
CronJob *labelstructs.CronJob `json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"`
EnvFrom *labelstructs.EnvFrom `json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"`
ExchangeVolumes []*labelstructs.ExchangeVolume `json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"`
ValuesFrom *labelstructs.ValueFrom `json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"`
MainApp *bool `yaml:"main-app,omitempty" json:"main-app,omitempty" jsonschema:"title=Is this service the main application"`
Values []StringOrMap `yaml:"values,omitempty" json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"`
Secrets *labelstructs.Secrets `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"`
Ports *labelstructs.Ports `yaml:"ports,omitempty" json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"`
Ingress *labelstructs.Ingress `yaml:"ingress,omitempty" json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"`
HealthCheck *labelstructs.HealthCheck `yaml:"health-check,omitempty" json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"`
SamePod *string `yaml:"same-pod,omitempty" json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"`
Description *string `yaml:"description,omitempty" json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"`
Ignore *bool `yaml:"ignore,omitempty" json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"`
Dependencies []labelstructs.Dependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"`
ConfigMapFiles *labelstructs.ConfigMapFiles `yaml:"configmap-files,omitempty" json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"`
MapEnv *labelstructs.MapEnv `yaml:"map-env,omitempty" json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"`
CronJob *labelstructs.CronJob `yaml:"cron-job,omitempty" json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"`
EnvFrom *labelstructs.EnvFrom `yaml:"env-from,omitempty" json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"`
ExchangeVolumes []*labelstructs.ExchangeVolume `yaml:"exchange-volumes,omitempty" json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"`
ValuesFrom *labelstructs.ValueFrom `yaml:"values-from,omitempty" json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"`
}
// OverrideWithConfig overrides the project with the katenary.yaml file. It
@@ -93,12 +94,12 @@ func OverrideWithConfig(project *types.Project) {
mustGetLabelContent(s.Description, &project.Services[i], labels.LabelDescription)
mustGetLabelContent(s.Ignore, &project.Services[i], labels.LabelIgnore)
mustGetLabelContent(s.Dependencies, &project.Services[i], labels.LabelDependencies)
mustGetLabelContent(s.ConfigMapFile, &project.Services[i], labels.LabelConfigMapFiles)
mustGetLabelContent(s.ConfigMapFiles, &project.Services[i], labels.LabelConfigMapFiles)
mustGetLabelContent(s.MapEnv, &project.Services[i], labels.LabelMapEnv)
mustGetLabelContent(s.CronJob, &project.Services[i], labels.LabelCronJob)
mustGetLabelContent(s.EnvFrom, &project.Services[i], labels.LabelEnvFrom)
mustGetLabelContent(s.ExchangeVolumes, &project.Services[i], labels.LabelExchangeVolume)
mustGetLabelContent(s.ValuesFrom, &project.Services[i], labels.LabelValueFrom)
mustGetLabelContent(s.ValuesFrom, &project.Services[i], labels.LabelValuesFrom)
}
}
fmt.Println(utils.IconInfo, "Katenary file loaded successfully, the services are now configured.")

View File

@@ -1,12 +1,13 @@
package katenaryfile
import (
"katenary/generator/labels"
"log"
"os"
"path/filepath"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"github.com/compose-spec/compose-go/cli"
)
@@ -123,3 +124,58 @@ webapp:
t.Fatal("Expected ingress to be defined", v)
}
}
func TestOverrideConfigMapFiles(t *testing.T) {
composeContent := `
services:
webapp:
image: nginx:latest
`
katenaryfileContent := `
webapp:
configmap-files:
- foo/bar
ports:
- 80
ingress:
port: 80
`
// create /tmp/katenary-test-override directory, save the compose.yaml file
tmpDir, err := os.MkdirTemp("", "katenary-test-override")
if err != nil {
t.Fatalf("Failed to create temp directory: %s", err.Error())
}
composeFile := filepath.Join(tmpDir, "compose.yaml")
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
os.MkdirAll(tmpDir, 0755)
if err := os.WriteFile(composeFile, []byte(composeContent), 0644); err != nil {
t.Log(err)
}
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0644); err != nil {
t.Log(err)
}
defer os.RemoveAll(tmpDir)
c, _ := os.ReadFile(composeFile)
log.Println(string(c))
// chand dir to this directory
os.Chdir(tmpDir)
options, _ := cli.NewProjectOptions(nil,
cli.WithWorkingDirectory(tmpDir),
cli.WithDefaultConfigPath,
)
project, err := cli.ProjectFromOptions(options)
if err != nil {
t.Fatalf("Failed to create project from options: %s", err.Error())
}
OverrideWithConfig(project)
w := project.Services[0].Labels
if v, ok := w[labels.LabelConfigMapFiles]; !ok {
t.Fatal("Expected configmap-files to be defined", v)
}
}

View File

@@ -2,7 +2,8 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
)
var componentLabel = labels.LabelName("component")

View File

@@ -4,7 +4,6 @@ import (
"bytes"
_ "embed"
"fmt"
"katenary/utils"
"log"
"regexp"
"sort"
@@ -12,6 +11,8 @@ import (
"text/tabwriter"
"text/template"
"repo.katenary.io/katenary/katenary/internal/utils"
"sigs.k8s.io/yaml"
)
@@ -34,7 +35,7 @@ const (
LabelCronJob Label = KatenaryLabelPrefix + "/cronjob"
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
LabelValueFrom Label = KatenaryLabelPrefix + "/values-from"
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
)
var (

View File

@@ -2,10 +2,10 @@ package labelstructs
import "gopkg.in/yaml.v3"
type ConfigMapFile []string
type ConfigMapFiles []string
func ConfigMapFileFrom(data string) (ConfigMapFile, error) {
var mapping ConfigMapFile
func ConfigMapFileFrom(data string) (ConfigMapFiles, error) {
var mapping ConfigMapFiles
if err := yaml.Unmarshal([]byte(data), &mapping); err != nil {
return nil, err
}

View File

@@ -1,8 +1,9 @@
package labelstructs_test
import (
"katenary/generator/labels/labelstructs"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
)
func TestConfigMapFileFrom(t *testing.T) {

View File

@@ -2,7 +2,8 @@ package labelstructs
import (
"fmt"
"katenary/utils"
"repo.katenary.io/katenary/katenary/internal/utils"
"gopkg.in/yaml.v3"
)

View File

@@ -1,7 +1,7 @@
package generator
import (
"katenary/utils"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"

View File

@@ -2,10 +2,11 @@ package generator
import (
"encoding/base64"
"katenary/generator/labels"
"katenary/utils"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -3,10 +3,11 @@ package generator
import (
"bytes"
"fmt"
"katenary/generator/labels"
"os"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"
)

View File

@@ -2,10 +2,11 @@ package generator
import (
"fmt"
"katenary/utils"
"regexp"
"strings"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -51,11 +52,7 @@ func NewService(service types.ServiceConfig, appName string) *Service {
// AddPort adds a port to the service.
func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string) {
name := s.service.Name
if len(serviceName) > 0 {
name = serviceName[0]
}
var name string
var finalport intstr.IntOrString
if targetPort := utils.GetServiceNameByPort(int(port.Target)); targetPort == "" {
@@ -88,7 +85,7 @@ func (s *Service) Yaml() ([]byte, error) {
}
lines := []string{}
for _, line := range strings.Split(string(y), "\n") {
for line := range strings.SplitSeq(string(y), "\n") {
if regexp.MustCompile(`^\s*loadBalancer:\s*`).MatchString(line) {
continue
}

View File

@@ -1,11 +1,12 @@
package generator
import (
"katenary/parser"
"log"
"os"
"os/exec"
"testing"
"repo.katenary.io/katenary/katenary/internal/parser"
)
const unmarshalError = "Failed to unmarshal the output: %s"

View File

@@ -1,13 +1,14 @@
package generator
import (
"katenary/generator/labels"
"katenary/generator/labels/labelstructs"
"katenary/utils"
"regexp"
"strconv"
"strings"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/generator/labels/labelstructs"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"

View File

@@ -2,12 +2,13 @@ package generator
import (
"fmt"
"katenary/generator/labels"
"katenary/utils"
"os"
"path/filepath"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/cli"
)

View File

@@ -1,9 +1,10 @@
package generator
import (
"katenary/utils"
"strings"
"repo.katenary.io/katenary/katenary/internal/utils"
"github.com/compose-spec/compose-go/types"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

View File

@@ -5,13 +5,14 @@ import (
"image"
"image/color"
"image/png"
"katenary/generator/labels"
"katenary/utils"
"log"
"os"
"path/filepath"
"testing"
"repo.katenary.io/katenary/katenary/internal/generator/labels"
"repo.katenary.io/katenary/katenary/internal/utils"
v1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"

Some files were not shown because too many files have changed in this diff Show More