Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Develop to prepare V3 #77

Merged
merged 98 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
475a025
Go to Katenary V3
metal3d Dec 6, 2023
3a0cf1a
Set test(s) to PHONY
metal3d Apr 3, 2024
6e33fa4
Get the newest version of go-compose
metal3d Apr 3, 2024
f9cf397
Removed Smile sponsorship
metal3d Apr 3, 2024
d135f5b
Remove the Smile sponsorship
metal3d Apr 3, 2024
ed9b468
Unignore some yaml files
metal3d Apr 3, 2024
5a358f0
Add labels docs
metal3d Apr 3, 2024
5d4f72e
Fix unued variable, useless functions...
metal3d Apr 3, 2024
76aa332
Fix dependencies parsing
metal3d Apr 3, 2024
dc47e73
Temorary fixing overrides
metal3d Apr 3, 2024
4ded4d4
Set the compose file list using overrides
metal3d Apr 3, 2024
9a3fc6a
Fix "depends_on" check
metal3d Apr 3, 2024
6ce52cc
Reindentation and change labels
metal3d Apr 3, 2024
eeb044b
Add markdown editor configuration
metal3d Apr 3, 2024
50c2f9d
Use new labels in documentation, and fix content
metal3d Apr 3, 2024
ef7fcb6
Some users want to use "host" instead of "hostname"
metal3d Apr 3, 2024
3ae5ec9
Typo, format of markdown
metal3d Apr 3, 2024
8e4b3be
Add nvimrc file
metal3d Apr 3, 2024
fc67cb6
Fix line width to 120 columns
metal3d Apr 3, 2024
50169c8
Changing logo, fix doc, catchy text...
metal3d Apr 4, 2024
2aad5d4
Upgrading mod package
metal3d Apr 4, 2024
441b30a
Code cleaning
metal3d Apr 5, 2024
984b503
Do not pass by composed struct
metal3d Apr 5, 2024
45de7ab
Fix samepod generation
metal3d Apr 8, 2024
cc3c42b
Add venv to ignore list
metal3d Apr 10, 2024
5070101
Add workflow image and zoom on click
metal3d Apr 10, 2024
2f53638
Add documentation
metal3d Apr 10, 2024
c7c18f0
Fixup documentation
metal3d Apr 10, 2024
564b939
Remove useless composition call
metal3d Apr 10, 2024
3317459
Code cleaning
metal3d Apr 10, 2024
c780e6c
Change doc, icon and logo
metal3d Apr 10, 2024
d8bd66e
Change license date, enhance and fix documentation
metal3d Apr 10, 2024
19a37ac
Better styles, logo, effects...
metal3d Apr 10, 2024
821c038
Fix fonts
metal3d Apr 10, 2024
81ea0fb
fix fonts in svg, one more time...
metal3d Apr 10, 2024
c41fa22
Update k8s.io/api + fix changed function
metal3d Apr 11, 2024
ab15614
Use "helm" filtype first for vim modeline + tests
metal3d Apr 11, 2024
3c743fb
Fixup hard problems on bound volumes
metal3d Apr 19, 2024
57b274e
Fixing documentation
metal3d Apr 19, 2024
77e8be4
Container can be null
metal3d Apr 19, 2024
85f1b2d
Fixes the ingress doc
metal3d Apr 19, 2024
35f464a
Add footnotes and search
metal3d Apr 19, 2024
3bb635a
Add FAQ page
metal3d Apr 19, 2024
58d19cc
Fix the chart app version
metal3d Apr 19, 2024
ec62a79
Better override list and documentation
metal3d Apr 19, 2024
d48fd2f
make a better override + add more values (serviceAccount, nodeSelecto…
metal3d Apr 21, 2024
9826a54
Fix notes.txt problems
metal3d Apr 21, 2024
f291d17
Fixup documentation after changing packages
metal3d Apr 21, 2024
9621493
Add resources in containers and values
metal3d Apr 22, 2024
8ae9350
Add YAML keys in the comments
metal3d Apr 22, 2024
fd3ba6d
Fix doc after changes in source files
metal3d Apr 22, 2024
78d37c4
Ease installation
metal3d Apr 22, 2024
734b0ed
Try to embed logos
metal3d Apr 22, 2024
cd946b2
Try another thing
metal3d Apr 22, 2024
6770f81
Make pure svg calls
metal3d Apr 22, 2024
dc41826
Back to normal
metal3d Apr 22, 2024
12814f4
Cleanup
metal3d Apr 22, 2024
7e8cb57
Fixes
metal3d Apr 22, 2024
50975ae
Fix static volume binding
metal3d Apr 23, 2024
d1186ee
Refresh doc
metal3d Apr 23, 2024
49c1fa5
Explain what happens
metal3d Apr 23, 2024
c312991
Remove the bats tests
metal3d Apr 23, 2024
6a7fede
We shouldn't quote encoded values
metal3d Apr 23, 2024
77de53c
Create more tests
metal3d Apr 23, 2024
46c878b
Add coverage files
metal3d Apr 23, 2024
8b01807
Add workflows
metal3d Apr 23, 2024
2e3dd50
Add codecov
metal3d Apr 23, 2024
c01cdf5
Only on PR and on push to master
metal3d Apr 23, 2024
a3e7435
Add test for static volumes
metal3d Apr 23, 2024
e0c18ec
Avoid repetitions
metal3d Apr 23, 2024
531756d
Use sonarcloud
metal3d Apr 24, 2024
8f4d69d
Add sonar profile
metal3d Apr 24, 2024
39d63c1
Remove coverage files
metal3d Apr 24, 2024
98c7c6d
Use latest Go compiler
metal3d Apr 24, 2024
f73d598
Standardization
metal3d Apr 24, 2024
15a2f25
Exclude doc from the analysis
metal3d Apr 24, 2024
da7d92b
Add more tests, refactor to fix problems
metal3d Apr 24, 2024
451a134
Do not check coverage on test file dude
metal3d Apr 24, 2024
0aa7023
Avoid repetition
metal3d Apr 24, 2024
d01a35e
Use real types to parse labels
metal3d Apr 24, 2024
e4f67db
Fix the parsing of probes
metal3d Apr 24, 2024
ccfebd1
We need helm linting at this time
metal3d Apr 24, 2024
d98268f
Add more tests on probes and dependencies
metal3d Apr 24, 2024
4367a01
Big refactorization
metal3d May 6, 2024
adc44a5
Refactorization and ordering
metal3d May 7, 2024
78dfb15
Add the command package
metal3d May 7, 2024
918f1b8
Fix problems and adding functionnalities
metal3d Oct 17, 2024
4703aa7
MkDocs needs 4 spaces for lists
metal3d Oct 18, 2024
d2c8d08
Validate markdown
metal3d Oct 18, 2024
533e142
Sonar complience
metal3d Oct 18, 2024
865473b
Enhance documentation
metal3d Oct 18, 2024
164a617
fix(values): Remove tplString in environment directive
metal3d Oct 23, 2024
63c6d5d
chore(format): moved import
metal3d Oct 23, 2024
d319939
fix(doc): livenessProbe and readinessProbe must be set
metal3d Oct 23, 2024
db168c9
fix(generation): use tpl in note for hostnames
metal3d Oct 24, 2024
d72f371
fix(generation): fix the volume var/path name
metal3d Oct 24, 2024
2d33367
chore(optim): manage space in struct
metal3d Oct 24, 2024
e0c829c
Merge branch 'master' into develop
metal3d Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ root = true
indent_style=tab
indent_size=4

[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 4

40 changes: 40 additions & 0 deletions .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Go-Tests

on:
pull_request:
branches:
- develop
push:
branches:
- master
- develop
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Install Helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Launch Test
run: |
go vet ./... && go test -coverprofile=coverprofile.out -json -v ./... > gotest.json
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: metal3d/katenary
file: ./coverprofile.out
fail_ci_if_error: true

11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
.venv
dist/*
.cache/*
chart/*
*.yaml
*.yml
!.markdownlint.yaml
!generator/*.yaml
doc/venv/*
!doc/mkdocs.yaml
!.readthedocs.yaml
./katenary
Expand All @@ -12,3 +16,10 @@ docker-compose*
.credentials
release.id
configs/
cover*
.sq
./katenary
.aider*
.python_history
.bash_history
katenary
Empty file added .gitmodules
Empty file.
18 changes: 18 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# markdownlint configuration file
default: true

MD013: # Line length
line_length: 240

MD010: # Hard tabs
code_blocks: false

# no inline HTML
MD033: false

# heading as first line element...
MD041: false

# list indentation
MD007:
indent: 4
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Patrice Ferlet
Copyright (c) 2022-2024 Patrice Ferlet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
146 changes: 108 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,53 @@ VERSION=$(shell git describe --exact-match --tags $(CUR_SHA) 2>/dev/null || echo
CTN:=$(shell which podman 2>&1 1>/dev/null && echo "podman" || echo "docker")
PREFIX=~/.local

GOVERSION=1.22
GO=container
OUT=katenary
BLD_CMD=go build -ldflags="-X 'main.Version=$(VERSION)'" -o $(OUT) ./cmd/katenary/*.go
BLD_CMD=go build -ldflags="-X 'katenary/generator.Version=$(VERSION)'" -o $(OUT) ./cmd/katenary
GOOS=linux
GOARCH=amd64
[email protected]

BUILD_IMAGE=docker.io/golang:$(GOVERSION)-alpine
# SHELL=/bin/bash

# List of source files
SOURCES=$(wildcard ./*.go ./*/*.go ./*/*/*.go)
# List of binaries to build and sign
BINARIES=dist/katenary-linux-amd64 dist/katenary-linux-arm64 dist/katenary.exe dist/katenary-darwin-amd64 dist/katenary-freebsd-amd64 dist/katenary-freebsd-arm64
# List of signatures to build
ASC_BINARIES=$(patsubst %,%.asc,$(BINARIES))

# defaults
BROWSER=$(shell command -v epiphany || echo xdg-open)
SHELL := bash
# strict mode
.SHELLFLAGS := -eu -o pipefail -c
# One session per target
.ONESHELL:
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
.PHONY: help clean build install tests test

BUILD_IMAGE=docker.io/golang:1.18-alpine
all: build

.PHONY: help clean build

.ONESHELL:
help:
@cat <<EOF
@cat <<EOF | fold -s -w 80
=== HELP ===
To avoid you to install Go, the build is made by podman or docker.

You can use:
Installinf (you can use local Go by setting GO=local)):
# use podman or docker to build
$$ make install
# or use local Go
$$ make install GO=local
This will build and install katenary inside the PREFIX(/bin) value (default is $(PREFIX))

To change the PREFIX to somewhere where only root or sudo users can save the binary, it is recommended to build before install:

To change the PREFIX to somewhere where only root or sudo users can save the binary, it is recommended to build before install, one more time you can use local Go by setting GO=local:
$$ make build
$$ sudo make install PREFIX=/usr/local

Expand All @@ -47,29 +73,47 @@ help:
$$ make build-all
EOF

build: pull katenary

build-all:
rm -f dist/*
$(MAKE) _build-all

_build-all: pull dist dist/katenary-linux-amd64 dist/katenary-linux-arm64 dist/katenary.exe dist/katenary-darwin-amd64 dist/katenary-freebsd-amd64 dist/katenary-freebsd-arm64
## Standard build
build: pull katenary

pull:
ifneq ($(GO),local)
@echo -e "\033[1;32mPulling $(BUILD_IMAGE) docker image\033[0m"
@$(CTN) pull $(BUILD_IMAGE)
endif

dist:
katenary: $(SOURCES) Makefile go.mod go.sum
ifeq ($(GO),local)
@echo "=> Build on host using go"
else
@echo "=> Build in container using" $(CTN)
endif
echo $(BLD_CMD)
ifeq ($(GO),local)
$(BLD_CMD)
else ifeq ($(CTN),podman)
@podman run -e CGO_ENABLED=0 -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) \
--rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --userns keep-id -it $(BUILD_IMAGE) $(BLD_CMD)
else
@docker run -e CGO_ENABLED=0 -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) \
--rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --user $(shell id -u):$(shell id -g) -e HOME=/tmp -it $(BUILD_IMAGE) $(BLD_CMD)
endif
echo "=> Stripping if possible"
strip $(OUT) 2>/dev/null || echo "=> No strip available"


## Release build
dist: prepare $(BINARIES) $(ASC_BINARIES)

prepare: pull
mkdir -p dist

dist/katenary-linux-amd64:
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for linux-amd64...\033[0m"
$(MAKE) katenary GOOS=linux GOARCH=amd64 OUT=$@


dist/katenary-linux-arm64:
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for linux-arm...\033[0m"
Expand All @@ -94,30 +138,16 @@ dist/katenary-freebsd-arm64:
@echo
@echo -e "\033[1;32mBuilding katenary $(VERSION) for freebsd-arm64...\033[0m"
$(MAKE) katenary GOOS=freebsd GOARCH=arm64 OUT=$@

katenary: $(wildcard */*.go Makefile go.mod go.sum)
ifeq ($(GO),local)
@echo "=> Build in host using go"
else
@echo "=> Build in container using" $(CTN)
endif
echo $(BLD_CMD)
ifeq ($(GO),local)
$(BLD_CMD)
else ifeq ($(CTN),podman)
@podman run -e CGO_ENABLED=0 -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) \
--rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --userns keep-id -it $(BUILD_IMAGE) $(BLD_CMD)
else
@docker run -e CGO_ENABLED=0 -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) \
--rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --user $(shell id -u):$(shell id -g) -e HOME=/tmp -it $(BUILD_IMAGE) $(BLD_CMD)
endif
echo "=> Stripping if possible"
strip $(OUT) 2>/dev/null || echo "=> No strip available"

gpg-sign:
rm -f dist/*.asc
$(MAKE) $(ASC_BINARIES)

dist/%.asc: dist/%
gpg --armor --detach-sign --default-key $(SIGNER) $< &>/dev/null || exit 1

install: build
cp katenary $(PREFIX)/bin/katenary
install -Dm755 katenary $(PREFIX)/bin/katenary

uninstall:
rm -f $(PREFIX)/bin/katenary
Expand All @@ -126,13 +156,27 @@ clean:
rm -rf katenary dist/* release.id


serve-doc: __label_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

tests: test
test:
@echo -e "\033[1;33mTesting katenary $(VERSION)...\033[0m"
go test -v ./...
go test -coverprofile=cover.out ./...
go tool cover -func=cover.out | grep "total:"
go tool cover -html=cover.out -o cover.html
if [ "$(BROWSER)" = "xdg-open" ]; then
xdg-open cover.html
else
$(BROWSER) -i --new-window cover.html
fi


.ONESHELL:
push-release: build-all
@rm -f release.id
# read personal access token from .git-credentials
Expand All @@ -154,3 +198,29 @@ push-release: build-all
https://uploads.github.com/repos/metal3d/katenary/releases/$$(cat release.id)/assets?name=$$(basename $$i)
done
@rm -f release.id


__label_doc:
@command -v gomarkdoc || (echo "==> We need to install gomarkdoc..." && \
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest)
@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
Loading
Loading