fix pre-commit and cleanup

This commit is contained in:
Kjeld Schouten
2024-10-19 15:18:02 +02:00
parent 2acb59c9dc
commit 4ab41d42f2
203 changed files with 8456 additions and 8484 deletions
@@ -44,4 +44,3 @@ runs:
# Set output to changed charts
echo "Changed charts: ${CHARTS[*]}"
printf "::set-output name=addedOrModified::%s\n" "${CHARTS[*]}"
@@ -30,4 +30,4 @@
// "versioningTemplate": "redhat"
// }
]
}
}
+3 -3
View File
@@ -82,9 +82,9 @@ parse_command_line() {
check_existing_tag() {
local chart_name="$1"
local tag="$2"
echo "Checking if tag '$tag' exists for chart '$chart_name' on OCI..."
# Query the OCI registry for existing tags
local response
response=$(curl -s -H "Authorization: Bearer ${quay_token}" \
@@ -97,7 +97,7 @@ check_existing_tag() {
local tag_exists
tag_exists=$(echo "$response" | jq -r --arg tag "$tag" '.tags[]? | select(.name == $tag) | .name')
if [[ "$tag_exists" == "$tag" ]]; then
echo "Tag '$tag' already exists for chart '$chart_name'."
return 0
+6 -6
View File
@@ -30,7 +30,7 @@ jobs:
pull-requests: write
name: "${{ github.ref == 'refs/heads/master' && '(Production)' || '(Preview)' }}"
runs-on: actions-runners
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
@@ -79,12 +79,12 @@ jobs:
pre-commit run --all ||:
# Fix sh files to always be executable
find . -name '*.sh' | xargs chmod +x
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
with:
version: v3.14.0
# Optional step if GPG signing is used
- name: Prepare GPG key
if: github.event_name == 'push'
@@ -100,12 +100,12 @@ jobs:
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
- name: Helm | Login
if: github.event_name == 'push'
shell: bash
run: echo ${{ secrets.QUAY_SECRET }} | helm registry login -u ${{ secrets.QUAY_USER }} --password-stdin quay.io
- name: Release Charts
shell: bash
if: github.event_name == 'push'
@@ -117,7 +117,7 @@ jobs:
install="$RUNNER_TOOL_CACHE/cr/${{ inputs.version }}/$(uname -m)"
echo "$install" >> "$GITHUB_PATH"
./.github/scripts/cr.sh --quay-token "${{ secrets.QUAY_TOKEN }}" --instal-dir $install
- name: Helm | Logout
shell: bash
if: github.event_name == 'push'
@@ -24,4 +24,3 @@ jobs:
version: "~> v2" # or 'latest', 'nightly', semver
env:
GITHUB_TOKEN: "${{ secrets.BOT_TOKEN }}"
+2 -2
View File
@@ -46,10 +46,10 @@ jobs:
- id: reduce
run: |
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>/?containers/(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>/[^/]+)*)"; "\(.second_directory)") | unique' changes.json)
# Set the containers output
echo ::set-output name=containers::${CONTAINERS}
# Check if containers were found and set the containers_found output
if [[ "$CONTAINERS" == "[]" || -z "$CONTAINERS" ]]; then
echo "No Containers Found, Skipping"
+1 -8
View File
@@ -6,7 +6,7 @@ repos:
- id: remove-tabs
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace # trims trailing whitespace.
exclude: ^archive/
@@ -48,10 +48,3 @@ repos:
exclude: ^archive/
- id: rst-backticks
exclude: ^archive/
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
exclude: (^archive|^website\/public|templates\/.*|crds\/.*|README.md|CHANGELOG.md|questions.yaml|devcontainer.json|^clustertool)
files: \.(js|ts|jsx|tsx|css|less|html|json|markdown|md|yaml|yml)$
+1 -2
View File
@@ -43,7 +43,7 @@ persistence:
enabled: true
type: emptyDir
mountPath: "/.cache"
cnpg:
main:
enabled: true
@@ -53,4 +53,3 @@ cnpg:
portal:
open:
enabled: true
+4 -4
View File
@@ -41,9 +41,9 @@ workload:
RIVEN_FORCE_ENV: "true"
ZURG_URL: somezurgurl:9999
# Set this to your rclone's mount `__all__` dir if using Zurg
RIVEN_SYMLINK_RCLONE_PATH: "/mnt/zurg/__all__"
RIVEN_SYMLINK_RCLONE_PATH: "/mnt/zurg/__all__"
# This is the path that symlinks will be placed in
RIVEN_SYMLINK_LIBRARY_PATH: "/mnt/library"
RIVEN_SYMLINK_LIBRARY_PATH: "/mnt/library"
RIVEN_DATABASE_HOST: '{{ printf "postgresql+psycopg2://%s:%s@%s.%s/%s" .Values.cnpg.main.user .Values.cnpg.main.creds.password (.Values.cnpg.main.creds.host | trimAll "\"") .Release.Namespace .Values.cnpg.main.database }}'
RIVEN_DOWNLOADERS_REAL_DEBRID_ENABLED: "false"
# set your real debrid api key
@@ -51,7 +51,7 @@ workload:
RIVEN_UPDATERS_PLEX_ENABLED: "false"
RIVEN_UPDATERS_PLEX_URL: "http://plex:32400"
# set your plex token"
RIVEN_UPDATERS_PLEX_TOKEN: "xxxxx"
RIVEN_UPDATERS_PLEX_TOKEN: "xxxxx"
RIVEN_CONTENT_OVERSEERR_ENABLED: "false"
RIVEN_CONTENT_OVERSEERR_URL: "http://overseerr:5055"
# set your overseerr token
@@ -94,7 +94,7 @@ persistence:
data:
enabled: true
mountPath: "/riven/data"
zurg-all:
zurg-all:
enabled: true
mountPath: "/mnt/zurg/__all__"
library:
+1 -2
View File
@@ -29,7 +29,7 @@ persistence:
data:
enabled: true
mountPath: "/app/data"
cnpg:
main:
enabled: true
@@ -39,4 +39,3 @@ cnpg:
portal:
open:
enabled: true
+26 -26
View File
@@ -24,9 +24,9 @@ workload:
type: tcp
env:
# forces the use of env vars to be always used!
zurg_FORCE_ENV: "true"
zurg_FORCE_ENV: "true"
# Set this to your rclone's mount `__all__` dir if using Zurg
LOG_LEVEL: DEBUG
LOG_LEVEL: DEBUG
zurg:
token: YOURTOKEN
@@ -65,13 +65,13 @@ configmap:
# Zurg configuration version
zurg: v1
token: {{ .Values.zurg.token }} # https://real-debrid.com/apitoken
# basic functionality
host: "[::]" # do not change this if you are running it inside a docker container
port: 9999 # do not change this if you are running it inside a docker container
concurrent_workers: 32
check_for_changes_every_secs: 10
# misc configs
retain_folder_name_extension: false # if true, zurg won't modify the filenames from real-debrid
retain_rd_torrent_name: true # if true, it will strictly follow RD API torrent name property w/c should make this more compatible with rdt-client
@@ -81,7 +81,7 @@ configmap:
enable_repair: false # Don't change this, we run a separate zurg for doing repairs without blocking i/o
on_library_update: sh plex_update.sh "$@"
ignore_renames: true
# advanced alternative for Jellyfin/Emby support
# on_library_update: |-
# # Log the updated directories and send refresh request to autoscan
@@ -90,10 +90,10 @@ configmap:
# echo "Detected update on: $arg"
# # URL encode the directory path
# encoded_arg=$(python -c "import urllib.parse; print(urllib.parse.quote_plus('$arg'))")
# curl -s -X GET "http://autoscan:3030/triggers/manual?dir=/storage/realdebrid-zurg/$encoded_arg"
# curl -s -X GET "http://autoscan:3030/triggers/manual?dir=/storage/realdebrid-zurg/$encoded_arg"
# done
# echo "All updated sections refreshed."
# network configs
network_buffer_size: 1048576 # 1 MiB
serve_from_rclone: false # serve file data from rclone, not from zurg (zurg will only provide rclone the link to download)
@@ -112,7 +112,7 @@ configmap:
# - 32.download.real-debrid.com
# - 34.download.real-debrid.com
# - 40.download.real-debrid.com
# List of directory definitions and their filtering rules
directories:
# Configuration for anime shows
@@ -124,13 +124,13 @@ configmap:
- has_episodes: true # intelligent detection of episode files inside a torrent
- any_file_inside_regex: /^\[/ # usually anime starts with [ e.g. [SubsPlease]
- any_file_inside_not_regex: /s\d\de\d\d/i # and usually anime doesn't use SxxExx
shows:
group: media
group_order: 20
filters:
- has_episodes: true # intelligent detection of episode files inside a torrent
movies:
group: media # because anime, shows and movies are in the same group,
group_order: 30 # and anime and shows has a lower group_order number than movies, all torrents that doesn't fall into the previous 2 will fall into movies
@@ -143,56 +143,56 @@ configmap:
data:
plex_update.sh: |
#!/bin/bash
# PLEX PARTIAL SCAN script or PLEX UPDATE script
# When zurg detects changes, it can trigger this script IF your config.yml contains
# on_library_update: sh plex_update.sh "$@"
# Modified from https://github.com/debridmediamanager/zurg-testing/blob/main/plex_update.sh
plex_url="http://plex:32400" # If you're using zurg inside a Docker container, by default it is 172.17.0.1:32400
token="yourplextoken" # open Plex in a browser, open dev console and copy-paste this: window.localStorage.getItem("myPlexAccessToken")
zurg_mount="/storage/realdebrid-zurg" # replace with your zurg mount path, ensure this is what Plex sees
# Get the list of section IDs
section_ids=$(curl -sLX GET "$plex_url/library/sections" -H "X-Plex-Token: $token" | xmllint --xpath "//Directory/@key" - | sed 's/key="//g' | tr '"' '\n')
for arg in "$@"
do
modified_arg="$zurg_mount/$arg"
echo "Detected update on: $arg"
echo "Absolute path: $modified_arg"
##### START Added by ElfHosted for auto DMM symlinking ###
echo "Symlinking $modified_arg to /storage/symlinks/real-debrid-blackhole/$arg"
# Ensure blackhole exists
mkdir -p /storage/symlinks/real-debrid-blackhole/movies
mkdir -p /storage/symlinks/real-debrid-blackhole/shows
# Copy to the RD blackhole, preserving the directory structure
cp -rs "$modified_arg/"* "/storage/symlinks/real-debrid-blackhole/$(echo $arg | cut -f1 -d/)/"
##### END Added by ElfHosted for auto DMM symlinking ###
encoded_arg=$(echo -n "$modified_arg" | python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.stdin.read()))")
if [ -z "$encoded_arg" ]; then
echo "Error: Encoded argument is empty. Check the input or encoding process."
continue
fi
for section_id in $section_ids
do
final_url="${plex_url}/library/sections/${section_id}/refresh?path=${encoded_arg}&X-Plex-Token=${token}"
echo "Encoded argument: $encoded_arg"
echo "Section ID: $section_id"
echo "Final URL: $final_url"
curl -s "$final_url"
done
done
echo "All updated sections refreshed"
# credits to godver3
# credits to godver3
+1 -1
View File
@@ -20,4 +20,4 @@ ssh-public-key.txt
*.DS_Store
!/embed/**
.DS_Store
.github
.github
+18 -18
View File
@@ -2,22 +2,22 @@
"recommendations": [
"golang.go",
"redhat.vscode-yaml",
"formulahendry.code-runner",
"streetsidesoftware.code-spell-checker",
"Codium.codium",
"mrmlnc.vscode-duplicate",
"IgorSbitnev.error-gutters",
"usernamehw.errorlens",
"mhutchie.git-graph",
"eamodio.gitlens",
"vivaldy22.go-auto-struct-tag",
"msyrus.go-doc",
"766b.go-outliner",
"premparihar.gotestexplorer",
"yzhang.markdown-all-in-one",
"searKing.preview-vscode",
"zxh404.vscode-proto3",
"DavidAnson.vscode-markdownlint",
"GitHub.copilot"
"formulahendry.code-runner",
"streetsidesoftware.code-spell-checker",
"Codium.codium",
"mrmlnc.vscode-duplicate",
"IgorSbitnev.error-gutters",
"usernamehw.errorlens",
"mhutchie.git-graph",
"eamodio.gitlens",
"vivaldy22.go-auto-struct-tag",
"msyrus.go-doc",
"766b.go-outliner",
"premparihar.gotestexplorer",
"yzhang.markdown-all-in-one",
"searKing.preview-vscode",
"zxh404.vscode-proto3",
"DavidAnson.vscode-markdownlint",
"GitHub.copilot"
]
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
{
}
}
+1 -1
View File
@@ -19,4 +19,4 @@
"problemMatcher" : []
},
]
}
}
+8 -8
View File
@@ -1,9 +1,9 @@
package cmd
import (
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
)
var advLongHelp = strings.TrimSpace(`
@@ -12,13 +12,13 @@ These are all advanced commands that should generally not be needed
`)
var adv = &cobra.Command{
Use: "adv",
Short: "Advanced cluster maintanence commands",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
Use: "adv",
Short: "Advanced cluster maintanence commands",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
RootCmd.AddCommand(adv)
RootCmd.AddCommand(adv)
}
+7 -7
View File
@@ -1,20 +1,20 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
)
var bootstrap = &cobra.Command{
Use: "bootstrap",
Short: "bootstrap first Talos Node",
Run: bootstrapfunc,
Use: "bootstrap",
Short: "bootstrap first Talos Node",
Run: bootstrapfunc,
}
func bootstrapfunc(cmd *cobra.Command, args []string) {
gencmd.RunBootstrap(args)
gencmd.RunBootstrap(args)
}
func init() {
adv.AddCommand(bootstrap)
adv.AddCommand(bootstrap)
}
+10 -10
View File
@@ -1,21 +1,21 @@
package cmd
import (
"context"
"context"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
)
var fluxbootstrap = &cobra.Command{
Use: "fluxbootstrap",
Short: "Manually bootstrap fluxcd on existing cluster",
Run: func(cmd *cobra.Command, args []string) {
ctx := context.Background()
fluxhandler.FluxBootstrap(ctx)
},
Use: "fluxbootstrap",
Short: "Manually bootstrap fluxcd on existing cluster",
Run: func(cmd *cobra.Command, args []string) {
ctx := context.Background()
fluxhandler.FluxBootstrap(ctx)
},
}
func init() {
adv.AddCommand(fluxbootstrap)
adv.AddCommand(fluxbootstrap)
}
+16 -16
View File
@@ -1,26 +1,26 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var health = &cobra.Command{
Use: "health",
Short: "Check Talos Cluster Health",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
log.Info().Msg("Running Cluster HealthCheck")
healthcmd := gencmd.GenHealth(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(healthcmd)
},
Use: "health",
Short: "Check Talos Cluster Health",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
log.Info().Msg("Running Cluster HealthCheck")
healthcmd := gencmd.GenHealth(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(healthcmd)
},
}
func init() {
adv.AddCommand(health)
adv.AddCommand(health)
}
+13 -13
View File
@@ -1,24 +1,24 @@
package cmd
import (
"os"
"os"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var precommit = &cobra.Command{
Use: "precommit",
Short: "Runs the PreCommit encryption check",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.CheckFilesAndReportEncryption(true, true); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
},
Use: "precommit",
Short: "Runs the PreCommit encryption check",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.CheckFilesAndReportEncryption(true, true); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
},
}
func init() {
adv.AddCommand(precommit)
adv.AddCommand(precommit)
}
+26 -26
View File
@@ -1,41 +1,41 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var reset = &cobra.Command{
Use: "reset",
Short: "Reset Talos Nodes and Kubernetes",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
Use: "reset",
Short: "Reset Talos Nodes and Kubernetes",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
log.Info().Msg("Running Cluster node Reset")
log.Info().Msg("Running Cluster node Reset")
taloscmds := gencmd.GenReset(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
taloscmds := gencmd.GenReset(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
},
},
}
func init() {
adv.AddCommand(reset)
adv.AddCommand(reset)
}
+8 -8
View File
@@ -1,18 +1,18 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/scale"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/scale"
)
var scaleexport = &cobra.Command{
Use: "scaleexport",
Short: "Export SCALE Apps to file",
Run: func(cmd *cobra.Command, args []string) {
scale.ExportApps()
},
Use: "scaleexport",
Short: "Export SCALE Apps to file",
Run: func(cmd *cobra.Command, args []string) {
scale.ExportApps()
},
}
func init() {
adv.AddCommand(scaleexport)
adv.AddCommand(scaleexport)
}
+12 -12
View File
@@ -1,22 +1,22 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/scale"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/scale"
)
var scalemigrate = &cobra.Command{
Use: "scalemigrate",
Short: "Migrate exported SCALE Apps to the Talos Cluster",
Run: func(cmd *cobra.Command, args []string) {
err := scale.ProcessJSONFiles("./truenas_exports")
if err != nil {
log.Info().Msgf("Error: %v", err)
}
},
Use: "scalemigrate",
Short: "Migrate exported SCALE Apps to the Talos Cluster",
Run: func(cmd *cobra.Command, args []string) {
err := scale.ProcessJSONFiles("./truenas_exports")
if err != nil {
log.Info().Msgf("Error: %v", err)
}
},
}
func init() {
adv.AddCommand(scalemigrate)
adv.AddCommand(scalemigrate)
}
+16 -16
View File
@@ -1,26 +1,26 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/initfiles"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/initfiles"
)
var testcmd = &cobra.Command{
Use: "test",
Short: "test run",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
// err := fluxhandler.ProcessJSONFiles("./testdata/truenas_exports")
// if err != nil {
// log.Info().Msg("Error:", err)
// }
something := gencmd.GenBootstrap("", []string{})
log.Info().Msgf("test %v", something)
},
Use: "test",
Short: "test run",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
// err := fluxhandler.ProcessJSONFiles("./testdata/truenas_exports")
// if err != nil {
// log.Info().Msg("Error:", err)
// }
something := gencmd.GenBootstrap("", []string{})
log.Info().Msgf("test %v", something)
},
}
func init() {
adv.AddCommand(testcmd)
adv.AddCommand(testcmd)
}
+56 -56
View File
@@ -1,78 +1,78 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/nodestatus"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/nodestatus"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var apply = &cobra.Command{
Use: "apply",
Short: "apply TalosConfig",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
Use: "apply",
Short: "apply TalosConfig",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
bootstrapcmds := gencmd.GenBootstrap("", extraArgs)
bootstrapNode := helper.ExtractNode(bootstrapcmds)
bootstrapcmds := gencmd.GenBootstrap("", extraArgs)
bootstrapNode := helper.ExtractNode(bootstrapcmds)
log.Info().Msgf("Checking if first node is ready to recieve anything... %s", bootstrapNode)
status, err := nodestatus.WaitForHealth(bootstrapNode, []string{"running", "maintenance"})
if err != nil {
log.Info().Msgf("Checking if first node is ready to recieve anything... %s", bootstrapNode)
status, err := nodestatus.WaitForHealth(bootstrapNode, []string{"running", "maintenance"})
if err != nil {
} else if status == "maintenance" {
bootstrapNeeded, err := nodestatus.CheckNeedBootstrap(bootstrapNode)
if err != nil {
} else if status == "maintenance" {
bootstrapNeeded, err := nodestatus.CheckNeedBootstrap(bootstrapNode)
if err != nil {
} else if bootstrapNeeded {
log.Info().Msg("First Node requires to be bootstrapped before it can be used.")
if helper.GetYesOrNo("Do you want to bootstrap now? (yes/no) [y/n]: ") {
gencmd.RunBootstrap(extraArgs)
if helper.GetYesOrNo("Do you want to apply config to all remaining clusternodes as well? (yes/no) [y/n]: ") {
RunApply("", extraArgs)
}
} else {
log.Info().Msg("Exiting bootstrap, as apply is not possible...")
}
} else if bootstrapNeeded {
log.Info().Msg("First Node requires to be bootstrapped before it can be used.")
if helper.GetYesOrNo("Do you want to bootstrap now? (yes/no) [y/n]: ") {
gencmd.RunBootstrap(extraArgs)
if helper.GetYesOrNo("Do you want to apply config to all remaining clusternodes as well? (yes/no) [y/n]: ") {
RunApply("", extraArgs)
}
} else {
log.Info().Msg("Exiting bootstrap, as apply is not possible...")
}
} else {
log.Info().Msg("Detected maintenance mode, but first node does not require to be bootrapped.")
log.Info().Msg("Assuming apply is requested... continuing with Apply...")
RunApply(node, extraArgs)
}
} else {
log.Info().Msg("Detected maintenance mode, but first node does not require to be bootrapped.")
log.Info().Msg("Assuming apply is requested... continuing with Apply...")
RunApply(node, extraArgs)
}
} else if status == "running" {
log.Info().Msg("Apply: running first controlnode detected, continuing...")
RunApply(node, extraArgs)
}
},
} else if status == "running" {
log.Info().Msg("Apply: running first controlnode detected, continuing...")
RunApply(node, extraArgs)
}
},
}
func RunApply(node string, extraArgs []string) {
taloscmds := gencmd.GenApply(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
taloscmds := gencmd.GenApply(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
}
func init() {
RootCmd.AddCommand(apply)
RootCmd.AddCommand(apply)
}
+8 -8
View File
@@ -1,9 +1,9 @@
package cmd
import (
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
)
var chartsLongHelp = strings.TrimSpace(`
@@ -19,13 +19,13 @@ Workflow:
`)
var charts = &cobra.Command{
Use: "charts",
Short: "A tool to help with creating Talos cluster",
Long: chartsLongHelp,
SilenceUsage: true,
SilenceErrors: true,
Use: "charts",
Short: "A tool to help with creating Talos cluster",
Long: chartsLongHelp,
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
RootCmd.AddCommand(charts)
RootCmd.AddCommand(charts)
}
+13 -13
View File
@@ -1,23 +1,23 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/version"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/version"
)
var bumper = &cobra.Command{
Use: "bump",
Short: "generate a bumped image version",
Example: "charttool bump <version> <kind>",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
if err := version.Bump(args[0], args[1]); err != nil {
log.Fatal().Err(err).Msg("failed to bump version")
}
},
Use: "bump",
Short: "generate a bumped image version",
Example: "charttool bump <version> <kind>",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
if err := version.Bump(args[0], args[1]); err != nil {
log.Fatal().Err(err).Msg("failed to bump version")
}
},
}
func init() {
charts.AddCommand(bumper)
charts.AddCommand(bumper)
}
+18 -18
View File
@@ -1,29 +1,29 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/deps"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/deps"
"github.com/truecharts/public/clustertool/pkg/helper"
)
var depsCmd = &cobra.Command{
Use: "deps",
Short: "Download, Update and Verify Helm dependencies",
Example: "charttool deps <chart> <chart> <chart>",
Run: func(cmd *cobra.Command, args []string) {
if err := deps.LoadGPGKey(); err != nil {
log.Fatal().Err(err).Msg("failed to load gpg key")
}
Use: "deps",
Short: "Download, Update and Verify Helm dependencies",
Example: "charttool deps <chart> <chart> <chart>",
Run: func(cmd *cobra.Command, args []string) {
if err := deps.LoadGPGKey(); err != nil {
log.Fatal().Err(err).Msg("failed to load gpg key")
}
// Specify the mode (SyncMode or AsyncMode)
mode := helper.SyncMode // Change to helper.SyncMode for synchronous processing
if err := helper.WalkCharts(args, deps.DownloadDeps, "", mode); err != nil {
log.Fatal().Err(err).Msg("failed to update Chart.yaml")
}
},
// Specify the mode (SyncMode or AsyncMode)
mode := helper.SyncMode // Change to helper.SyncMode for synchronous processing
if err := helper.WalkCharts(args, deps.DownloadDeps, "", mode); err != nil {
log.Fatal().Err(err).Msg("failed to update Chart.yaml")
}
},
}
func init() {
charts.AddCommand(depsCmd)
charts.AddCommand(depsCmd)
}
+28 -28
View File
@@ -1,39 +1,39 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/changelog"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/changelog"
)
var genChangelogCmd = &cobra.Command{
Use: "genchangelog",
Short: "Generate changelog for charts",
Example: "charttool genchangelog <repo path> <template path> <charts dir>",
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 3 {
log.Fatal().Msg("Missing required arguments. Please provide the repo path, template path and charts directory.")
}
opts := &changelog.ChangelogOptions{
RepoPath: args[0],
TemplatePath: args[1],
ChartsDir: args[2],
ChangelogFileName: "CHANGELOG.md",
JSONOutputPath: "./changelog.json",
PrettyJSON: true,
StatusUpdateInterval: 5,
SkipCommitsWithBadMessage: false,
}
if err := opts.Generate(); err != nil {
log.Fatal().Err(err)
}
if err := opts.Render(); err != nil {
log.Fatal().Err(err)
}
},
Use: "genchangelog",
Short: "Generate changelog for charts",
Example: "charttool genchangelog <repo path> <template path> <charts dir>",
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 3 {
log.Fatal().Msg("Missing required arguments. Please provide the repo path, template path and charts directory.")
}
opts := &changelog.ChangelogOptions{
RepoPath: args[0],
TemplatePath: args[1],
ChartsDir: args[2],
ChangelogFileName: "CHANGELOG.md",
JSONOutputPath: "./changelog.json",
PrettyJSON: true,
StatusUpdateInterval: 5,
SkipCommitsWithBadMessage: false,
}
if err := opts.Generate(); err != nil {
log.Fatal().Err(err)
}
if err := opts.Render(); err != nil {
log.Fatal().Err(err)
}
},
}
func init() {
charts.AddCommand(genChangelogCmd)
charts.AddCommand(genChangelogCmd)
}
+20 -20
View File
@@ -1,34 +1,34 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/website"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/website"
"github.com/truecharts/public/clustertool/pkg/helper"
)
var genChartListCmd = &cobra.Command{
Use: "genchartlist",
Short: "Generate chart list json file",
Example: "charttool genchartlist <path to charts folder>",
Run: func(cmd *cobra.Command, args []string) {
opts := &website.ChartListOptions{
OutputPath: "./charts.json",
TrainFilter: []string{}, // We can filter by train later if needed
}
Use: "genchartlist",
Short: "Generate chart list json file",
Example: "charttool genchartlist <path to charts folder>",
Run: func(cmd *cobra.Command, args []string) {
opts := &website.ChartListOptions{
OutputPath: "./charts.json",
TrainFilter: []string{}, // We can filter by train later if needed
}
if err := helper.WalkCharts2(args, opts.GetChartData, helper.AsyncMode); err != nil {
log.Fatal().Err(err).Msg("failed to generate chart list json file:")
}
if err := helper.WalkCharts2(args, opts.GetChartData, helper.AsyncMode); err != nil {
log.Fatal().Err(err).Msg("failed to generate chart list json file:")
}
if err := opts.WriteChartList(); err != nil {
log.Fatal().Err(err).Msg("failed to write chart list json file:")
}
if err := opts.WriteChartList(); err != nil {
log.Fatal().Err(err).Msg("failed to write chart list json file:")
}
},
},
}
func init() {
charts.AddCommand(genChartListCmd)
charts.AddCommand(genChartListCmd)
}
+22 -22
View File
@@ -1,36 +1,36 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
"slices"
"slices"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/chartFile"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/chartFile"
"github.com/truecharts/public/clustertool/pkg/helper"
)
var genMetaCmd = &cobra.Command{
Use: "genmeta",
Short: "Generate and update Chart.yaml metadata",
Run: func(cmd *cobra.Command, args []string) {
bump := ""
if len(args) > 0 && slices.Contains([]string{"patch", "minor", "major"}, args[0]) {
bump = args[0]
args = args[1:]
}
Use: "genmeta",
Short: "Generate and update Chart.yaml metadata",
Run: func(cmd *cobra.Command, args []string) {
bump := ""
if len(args) > 0 && slices.Contains([]string{"patch", "minor", "major"}, args[0]) {
bump = args[0]
args = args[1:]
}
// Specify the mode (SyncMode or AsyncMode)
// Async Mode showed concurrency issues (Stavros)
mode := helper.SyncMode
// Specify the mode (SyncMode or AsyncMode)
// Async Mode showed concurrency issues (Stavros)
mode := helper.SyncMode
err := helper.WalkCharts(args, chartFile.UpdateChartFile, bump, mode)
if err != nil {
log.Fatal().Err(err).Msg("failed to update Chart.yaml:")
}
},
err := helper.WalkCharts(args, chartFile.UpdateChartFile, bump, mode)
if err != nil {
log.Fatal().Err(err).Msg("failed to update Chart.yaml:")
}
},
}
func init() {
charts.AddCommand(genMetaCmd)
charts.AddCommand(genMetaCmd)
}
+14 -14
View File
@@ -1,25 +1,25 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/image"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/charts/image"
)
var tagCleaner = &cobra.Command{
Use: "tagcleaner",
Short: "Creates a clean version tag from a container digest",
Example: "charttool tagcleaner <tag>",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
err := image.Clean(args[0])
if err != nil {
log.Fatal().Err(err).Msg("failed to clean tag")
}
},
Use: "tagcleaner",
Short: "Creates a clean version tag from a container digest",
Example: "charttool tagcleaner <tag>",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
err := image.Clean(args[0])
if err != nil {
log.Fatal().Err(err).Msg("failed to clean tag")
}
},
}
func init() {
charts.AddCommand(tagCleaner)
charts.AddCommand(tagCleaner)
}
+13 -13
View File
@@ -1,24 +1,24 @@
package cmd
import (
"os"
"os"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var checkcrypt = &cobra.Command{
Use: "checkcrypt",
Short: "Checks if all files are encrypted correctly in accordance with .sops.yaml",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.CheckFilesAndReportEncryption(false, false); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
},
Use: "checkcrypt",
Short: "Checks if all files are encrypted correctly in accordance with .sops.yaml",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.CheckFilesAndReportEncryption(false, false); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
},
}
func init() {
RootCmd.AddCommand(checkcrypt)
RootCmd.AddCommand(checkcrypt)
}
+11 -11
View File
@@ -1,21 +1,21 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var decrypt = &cobra.Command{
Use: "decrypt",
Short: "Decrypt all high-risk data using sops",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
},
Use: "decrypt",
Short: "Decrypt all high-risk data using sops",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
},
}
func init() {
RootCmd.AddCommand(decrypt)
RootCmd.AddCommand(decrypt)
}
+11 -11
View File
@@ -1,21 +1,21 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var encrypt = &cobra.Command{
Use: "encrypt",
Short: "Encrypt all high-risk data using sops",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.EncryptAllFiles(); err != nil {
log.Info().Msgf("Error encrypting files: %v\n", err)
}
},
Use: "encrypt",
Short: "Encrypt all high-risk data using sops",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.EncryptAllFiles(); err != nil {
log.Info().Msgf("Error encrypting files: %v\n", err)
}
},
}
func init() {
RootCmd.AddCommand(encrypt)
RootCmd.AddCommand(encrypt)
}
+4 -4
View File
@@ -1,14 +1,14 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
)
var fluxBootstrap = &cobra.Command{
Use: "fluxBootstrap",
Short: "bootstrapFluxCD",
Use: "fluxBootstrap",
Short: "bootstrapFluxCD",
}
func init() {
RootCmd.AddCommand(fluxBootstrap)
RootCmd.AddCommand(fluxBootstrap)
}
+26 -26
View File
@@ -1,14 +1,14 @@
package cmd
import (
"strings"
"strings"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/nodestatus"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/nodestatus"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var genConfigLongHelp = strings.TrimSpace(`
@@ -21,27 +21,27 @@ Powered by TalHelper (https://budimanjojo.github.io/talhelper/)
`)
var genConfig = &cobra.Command{
Use: "genconfig",
Short: "generate Configuration files",
Long: genConfigLongHelp,
Example: "clustertool genconfig",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
Use: "genconfig",
Short: "generate Configuration files",
Long: genConfigLongHelp,
Example: "clustertool genconfig",
Run: func(cmd *cobra.Command, args []string) {
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
gencmd.GenConfig(args)
err := nodestatus.CheckHealth(helper.TalEnv["VIP_IP"], "", true)
if err == nil {
log.Info().Msg("Running Cluster Detected, setting KubeConfig...")
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
} else {
log.Info().Msg("No Running Cluster Detected, Skipping KubeConfig...")
}
},
gencmd.GenConfig(args)
err := nodestatus.CheckHealth(helper.TalEnv["VIP_IP"], "", true)
if err == nil {
log.Info().Msg("Running Cluster Detected, setting KubeConfig...")
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
} else {
log.Info().Msg("No Running Cluster Detected, Skipping KubeConfig...")
}
},
}
func init() {
RootCmd.AddCommand(genConfig)
RootCmd.AddCommand(genConfig)
}
+8 -8
View File
@@ -1,9 +1,9 @@
package cmd
import (
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
)
var helmreleaseHelp = strings.TrimSpace(`
@@ -12,13 +12,13 @@ A toolkit to load helm-release files onto a cluster without flux
`)
var helmrelease = &cobra.Command{
Use: "helmrelease",
Short: "A toolkit to load helm-release files onto a cluster without flux",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
Use: "helmrelease",
Short: "A toolkit to load helm-release files onto a cluster without flux",
Long: advLongHelp,
SilenceUsage: true,
SilenceErrors: true,
}
func init() {
RootCmd.AddCommand(helmrelease)
RootCmd.AddCommand(helmrelease)
}
+23 -23
View File
@@ -1,37 +1,37 @@
package cmd
import (
"path/filepath"
"path/filepath"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
"github.com/truecharts/public/clustertool/pkg/initfiles"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
"github.com/truecharts/public/clustertool/pkg/initfiles"
)
var hrinstall = &cobra.Command{
Use: "install",
Short: "install a helm-release file without flux, helm-release file needs to be called helm-release.yaml",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
Use: "install",
Short: "install a helm-release file without flux, helm-release file needs to be called helm-release.yaml",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
var dir string
var dir string
// Check if args[0] includes a filename
if filename := filepath.Base(args[0]); filename != "" && filename != "." && filename != "/" {
dir = filepath.Dir(args[0])
} else {
dir = args[0] // Assuming args[0] is just a directory path without a filename
}
helmRepoPath := filepath.Join("./repositories", "helm")
helmRepos, _ := fluxhandler.LoadAllHelmRepos(helmRepoPath)
intermediateCharts := []fluxhandler.HelmChart{
{dir, false, true},
}
// Check if args[0] includes a filename
if filename := filepath.Base(args[0]); filename != "" && filename != "." && filename != "/" {
dir = filepath.Dir(args[0])
} else {
dir = args[0] // Assuming args[0] is just a directory path without a filename
}
helmRepoPath := filepath.Join("./repositories", "helm")
helmRepos, _ := fluxhandler.LoadAllHelmRepos(helmRepoPath)
intermediateCharts := []fluxhandler.HelmChart{
{dir, false, true},
}
fluxhandler.InstallCharts(intermediateCharts, helmRepos, false)
},
fluxhandler.InstallCharts(intermediateCharts, helmRepos, false)
},
}
func init() {
helmrelease.AddCommand(hrinstall)
helmrelease.AddCommand(hrinstall)
}
+23 -23
View File
@@ -1,37 +1,37 @@
package cmd
import (
"path/filepath"
"path/filepath"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
"github.com/truecharts/public/clustertool/pkg/initfiles"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/fluxhandler"
"github.com/truecharts/public/clustertool/pkg/initfiles"
)
var hrupgrade = &cobra.Command{
Use: "upgrade",
Short: "run helm-upgrade using a helm-release file without flux",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
Use: "upgrade",
Short: "run helm-upgrade using a helm-release file without flux",
Run: func(cmd *cobra.Command, args []string) {
initfiles.LoadTalEnv()
var dir string
var dir string
// Check if args[0] includes a filename
if filename := filepath.Base(args[0]); filename != "" && filename != "." && filename != "/" {
dir = filepath.Dir(args[0])
} else {
dir = args[0] // Assuming args[0] is just a directory path without a filename
}
helmRepoPath := filepath.Join("./repositories", "helm")
helmRepos, _ := fluxhandler.LoadAllHelmRepos(helmRepoPath)
intermediateCharts := []fluxhandler.HelmChart{
{dir, false, true},
}
// Check if args[0] includes a filename
if filename := filepath.Base(args[0]); filename != "" && filename != "." && filename != "/" {
dir = filepath.Dir(args[0])
} else {
dir = args[0] // Assuming args[0] is just a directory path without a filename
}
helmRepoPath := filepath.Join("./repositories", "helm")
helmRepos, _ := fluxhandler.LoadAllHelmRepos(helmRepoPath)
intermediateCharts := []fluxhandler.HelmChart{
{dir, false, true},
}
fluxhandler.UpgradeCharts(intermediateCharts, helmRepos, false)
},
fluxhandler.UpgradeCharts(intermediateCharts, helmRepos, false)
},
}
func init() {
helmrelease.AddCommand(hrupgrade)
helmrelease.AddCommand(hrupgrade)
}
+9 -9
View File
@@ -1,19 +1,19 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/info"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/info"
)
var infoCmd = &cobra.Command{
Use: "info",
Short: "Prints information about the clustertool binary",
Example: "clustertool info",
Run: func(cmd *cobra.Command, args []string) {
info.NewInfo().Print()
},
Use: "info",
Short: "Prints information about the clustertool binary",
Example: "clustertool info",
Run: func(cmd *cobra.Command, args []string) {
info.NewInfo().Print()
},
}
func init() {
RootCmd.AddCommand(infoCmd)
RootCmd.AddCommand(infoCmd)
}
+13 -13
View File
@@ -1,11 +1,11 @@
package cmd
import (
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/initfiles"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/initfiles"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var initLongHelp = strings.TrimSpace(`
@@ -21,18 +21,18 @@ Powered by TalHelper (https://budimanjojo.github.io/talhelper/)
`)
var initFiles = &cobra.Command{
Use: "init",
Short: "generate Basic ClusterTool file-and-folder structure in current folder",
Long: initLongHelp,
Example: "clustertool init",
Run: func(cmd *cobra.Command, args []string) {
Use: "init",
Short: "generate Basic ClusterTool file-and-folder structure in current folder",
Long: initLongHelp,
Example: "clustertool init",
Run: func(cmd *cobra.Command, args []string) {
sops.DecryptFiles()
sops.DecryptFiles()
initfiles.InitFiles()
},
initfiles.InitFiles()
},
}
func init() {
RootCmd.AddCommand(initFiles)
RootCmd.AddCommand(initFiles)
}
+29 -29
View File
@@ -1,13 +1,13 @@
package cmd
import (
"os"
"path/filepath"
"strings"
"os"
"path/filepath"
"strings"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/helper"
)
var thisversion string
@@ -28,35 +28,35 @@ Workflow:
`)
var RootCmd = &cobra.Command{
Use: "clustertool",
Short: "A tool to help with creating Talos cluster",
Long: rootLongHelp,
SilenceUsage: true,
SilenceErrors: true,
Version: thisversion,
Use: "clustertool",
Short: "A tool to help with creating Talos cluster",
Long: rootLongHelp,
SilenceUsage: true,
SilenceErrors: true,
Version: thisversion,
}
func init() {
// Define the --cluster flag
RootCmd.PersistentFlags().StringVar(&helper.ClusterName, "cluster", "main", "Cluster name")
// Define the --cluster flag
RootCmd.PersistentFlags().StringVar(&helper.ClusterName, "cluster", "main", "Cluster name")
}
func Execute() error {
// Parse only the persistent flags (like --cluster) before executing any command
RootCmd.PersistentFlags().Parse(os.Args[1:])
// Parse only the persistent flags (like --cluster) before executing any command
RootCmd.PersistentFlags().Parse(os.Args[1:])
// You can now access the helper.ClusterName variable
if helper.ClusterName != "" {
log.Info().Msgf("Cluster name: %s\n", helper.ClusterName)
helper.ClusterPath = filepath.Join("./clusters", helper.ClusterName)
helper.ClusterEnvFile = filepath.Join(helper.ClusterPath, "/clusterenv.yaml")
helper.TalConfigFile = filepath.Join(helper.ClusterPath, "/talos", "talconfig.yaml")
helper.TalosPath = filepath.Join(helper.ClusterPath, "/talos")
helper.TalosGenerated = filepath.Join(helper.TalosPath, "/generated")
helper.TalosConfigFile = filepath.Join(helper.TalosGenerated, "talosconfig")
helper.TalSecretFile = filepath.Join(helper.TalosGenerated, "talsecret.yaml")
}
// You can now access the helper.ClusterName variable
if helper.ClusterName != "" {
log.Info().Msgf("Cluster name: %s\n", helper.ClusterName)
helper.ClusterPath = filepath.Join("./clusters", helper.ClusterName)
helper.ClusterEnvFile = filepath.Join(helper.ClusterPath, "/clusterenv.yaml")
helper.TalConfigFile = filepath.Join(helper.ClusterPath, "/talos", "talconfig.yaml")
helper.TalosPath = filepath.Join(helper.ClusterPath, "/talos")
helper.TalosGenerated = filepath.Join(helper.TalosPath, "/generated")
helper.TalosConfigFile = filepath.Join(helper.TalosGenerated, "talosconfig")
helper.TalSecretFile = filepath.Join(helper.TalosGenerated, "talsecret.yaml")
}
// Execute the root command and all subcommands
return RootCmd.Execute()
// Execute the root command and all subcommands
return RootCmd.Execute()
}
+33 -33
View File
@@ -1,50 +1,50 @@
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/gencmd"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var upgrade = &cobra.Command{
Use: "upgrade",
Short: "Upgrade Talos Nodes and Kubernetes",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
Use: "upgrade",
Short: "Upgrade Talos Nodes and Kubernetes",
Run: func(cmd *cobra.Command, args []string) {
var extraArgs []string
node := ""
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if len(args) > 1 {
extraArgs = args[1:]
}
if len(args) >= 1 {
node = args[0]
if args[0] == "all" {
node = ""
}
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
if err := sops.DecryptFiles(); err != nil {
log.Info().Msgf("Error decrypting files: %v\n", err)
}
log.Info().Msg("Running Cluster Upgrade")
log.Info().Msg("Running Cluster Upgrade")
taloscmds := gencmd.GenUpgrade(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
taloscmds := gencmd.GenUpgrade(node, extraArgs)
gencmd.ExecCmds(taloscmds, true)
log.Info().Msg("Running Kubernetes Upgrade")
kubeUpgradeCmd := gencmd.GenKubeUpgrade(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeUpgradeCmd)
log.Info().Msg("Running Kubernetes Upgrade")
kubeUpgradeCmd := gencmd.GenKubeUpgrade(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeUpgradeCmd)
log.Info().Msg("(re)Loading KubeConfig)")
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
log.Info().Msg("(re)Loading KubeConfig)")
kubeconfigcmds := gencmd.GenKubeConfig(helper.TalEnv["VIP_IP"])
gencmd.ExecCmd(kubeconfigcmds)
},
},
}
func init() {
RootCmd.AddCommand(upgrade)
RootCmd.AddCommand(upgrade)
}
+79 -79
View File
@@ -1,16 +1,16 @@
package embed
import (
"embed"
"io/fs"
"os"
"path/filepath"
"runtime"
"embed"
"io/fs"
"os"
"path/filepath"
"runtime"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
"github.com/leaanthony/debme"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/leaanthony/debme"
"github.com/truecharts/public/clustertool/pkg/helper"
)
//go:embed generic/*
@@ -18,90 +18,90 @@ var GenericFiles embed.FS
var TalosExec string
func AllToCache() {
err := os.RemoveAll(helper.CacheDir)
if err != nil {
log.Fatal().Err(err)
}
GOOSARCH := runtime.GOOS + "_" + runtime.GOARCH
filesToCache(StaticFiles, GOOSARCH)
filesToCache(GenericFiles, "generic")
err := os.RemoveAll(helper.CacheDir)
if err != nil {
log.Fatal().Err(err)
}
GOOSARCH := runtime.GOOS + "_" + runtime.GOARCH
filesToCache(StaticFiles, GOOSARCH)
filesToCache(GenericFiles, "generic")
}
func filesToCache(embededfs embed.FS, sub string) {
// Ensure the base cache directory exists
if err := os.MkdirAll(helper.CacheDir, os.ModePerm); err != nil {
log.Info().Msgf("Error creating base cache directory: %v", err)
return
}
// Ensure the base cache directory exists
if err := os.MkdirAll(helper.CacheDir, os.ModePerm); err != nil {
log.Info().Msgf("Error creating base cache directory: %v", err)
return
}
root, _ := debme.FS(embededfs, sub)
fs.WalkDir(root, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.Name() != sub {
if d.IsDir() {
// If it's a directory, create the corresponding directory in the cache
writePath := filepath.Join(helper.CacheDir, path)
if err := os.MkdirAll(writePath, os.ModePerm); err != nil {
log.Info().Msgf("Error creating directory in cache: %v", err)
return err
}
} else {
root, _ := debme.FS(embededfs, sub)
fs.WalkDir(root, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.Name() != sub {
if d.IsDir() {
// If it's a directory, create the corresponding directory in the cache
writePath := filepath.Join(helper.CacheDir, path)
if err := os.MkdirAll(writePath, os.ModePerm); err != nil {
log.Info().Msgf("Error creating directory in cache: %v", err)
return err
}
} else {
// If it's a file, read and write it to the cache
data, err := root.ReadFile(path)
if err != nil {
log.Info().Msgf("Error reading file: %v", err)
return err
}
writePath := filepath.Join(helper.CacheDir, path)
if err := os.WriteFile(writePath, data, 0755); err != nil {
log.Info().Msgf("Error writing file to cache: %v", err)
return err
}
}
}
return nil
})
// If it's a file, read and write it to the cache
data, err := root.ReadFile(path)
if err != nil {
log.Info().Msgf("Error reading file: %v", err)
return err
}
writePath := filepath.Join(helper.CacheDir, path)
if err := os.WriteFile(writePath, data, 0755); err != nil {
log.Info().Msgf("Error writing file to cache: %v", err)
return err
}
}
}
return nil
})
}
func GetTalosExec() string {
execName := ""
if runtime.GOOS == "windows" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-windows-amd64.exe"
} else {
execName = "talosctl-windows-arm64.exe"
}
execName := ""
if runtime.GOOS == "windows" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-windows-amd64.exe"
} else {
execName = "talosctl-windows-arm64.exe"
}
}
if runtime.GOOS == "linux" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-linux-amd64"
} else {
execName = "talosctl-linux-arm64"
}
}
if runtime.GOOS == "linux" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-linux-amd64"
} else {
execName = "talosctl-linux-arm64"
}
}
if runtime.GOOS == "darwin" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-darwin-amd64"
} else {
execName = "talosctl-darwin-arm64"
}
}
if runtime.GOOS == "darwin" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-darwin-amd64"
} else {
execName = "talosctl-darwin-arm64"
}
}
if runtime.GOOS == "freebsd" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-freebsd-amd64"
} else {
execName = "talosctl-freebsd-arm64"
}
}
if runtime.GOOS == "freebsd" {
if runtime.GOARCH == "amd64" {
execName = "talosctl-freebsd-amd64"
} else {
execName = "talosctl-freebsd-arm64"
}
}
}
return filepath.Join(helper.CacheDir, execName)
return filepath.Join(helper.CacheDir, execName)
}
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed freebsd_amd64
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed darwin_arm64
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed linux_amd64
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed linux_arm64
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed windows_amd64/*
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed windows_arm64/*
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed darwin_amd64
+1 -1
View File
@@ -4,7 +4,7 @@
package embed
import (
"embed"
"embed"
)
//go:embed freebsd_arm64
@@ -3,7 +3,3 @@ clusterconfig
patches/sopssecret.yaml
cluster/main/kubernetes/**/bootstrap-values.yaml.ct
*kubeconfig
@@ -35,4 +35,4 @@ spec:
patchStrategicMerge:
metadata:
annotations:
extensions.talos.dev/schematic: "{{ schematic }}"
extensions.talos.dev/schematic: "{{ schematic }}"
@@ -9,4 +9,4 @@ spec:
prune: true
sourceRef:
kind: GitRepository
name: cluster
name: cluster
@@ -37,4 +37,4 @@ spec:
autoAssign: false
avoidBuggyIPs: true
addresses:
- ${METALLB_RANGE}
- ${METALLB_RANGE}
@@ -48,4 +48,4 @@ spec:
args:
- --nodes=$(NODE_IP)
- upgrade-k8s
- --to=$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
- --to=$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
@@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
resources:
# - schematics.yaml
- kubernetes.yaml
- talos.yaml
@@ -49,4 +49,4 @@ spec:
- --image=factory.talos.dev/installer/$(SCHEMATIC):$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
- --preserve=true
- --wait=false
- --force
- --force
@@ -59,4 +59,4 @@ patches:
patch: |
- op: replace
path: /metadata/name
value: flux-view-flux-system
value: flux-view-flux-system
@@ -4,4 +4,4 @@ metadata:
name: cluster-config
namespace: flux-system
data:
REPLACEWITHENV
REPLACEWITHENV
@@ -84,4 +84,4 @@ spec:
value: --oom-watch-interval=500ms
target:
kind: Deployment
name: helm-controller
name: helm-controller
@@ -5,4 +5,4 @@ metadata:
name: flux-system
labels:
pod-security.kubernetes.io/enforce: privileged
topolvm.io/webhook: ignore
topolvm.io/webhook: ignore
@@ -7,4 +7,4 @@ data:
# renovate: datasource=docker depName=ghcr.io/siderolabs/installer
TALOS_VERSION: v1.8.1
# renovate: datasource=docker depName=ghcr.io/siderolabs/kubelet
KUBERNETES_VERSION: v1.31.1
KUBERNETES_VERSION: v1.31.1
@@ -1,3 +1,3 @@
## DO NOT ALTER THIS FILE, CHANGE DO NOT PERSIST. Alter TalEnv.yaml instead.
hubble:
enabled: false
enabled: false
@@ -1,3 +1,3 @@
metrics:
main:
enabled: false
enabled: false
@@ -31,4 +31,4 @@ spec:
core:
sources: ["pci", "system", "usb"]
prometheus:
enable: true
enable: true
@@ -192,4 +192,4 @@ spec:
- '[ServiceMonitor,{{ if .Values.admissionController.serviceMonitor.namespace }}{{ .Values.admissionController.serviceMonitor.namespace }}{{ else }}{{ template "kyverno.namespace" . }}{{ end }},{{ template "kyverno.cleanup-controller.name" . }}]'
- '[ServiceMonitor,{{ if .Values.admissionController.serviceMonitor.namespace }}{{ .Values.admissionController.serviceMonitor.namespace }}{{ else }}{{ template "kyverno.namespace" . }}{{ end }},{{ template "kyverno.reports-controller.name" . }}]'
- '[Secret,{{ include "kyverno.namespace" . }},{{ template "kyverno.admission-controller.serviceName" . }}.{{ template "kyverno.namespace" . }}.svc.*]'
- '[Secret,{{ include "kyverno.namespace" . }},{{ template "kyverno.cleanup-controller.name" . }}.{{ template "kyverno.namespace" . }}.svc.*]'
- '[Secret,{{ include "kyverno.namespace" . }},{{ template "kyverno.cleanup-controller.name" . }}.{{ template "kyverno.namespace" . }}.svc.*]'
@@ -24,7 +24,7 @@ spec:
crds: CreateReplace
remediation:
retries: 3
values:
values:
defaultSettings:
# Increase to 3 for a multi-node cluster
defaultReplicaCount: 1
@@ -35,4 +35,4 @@ spec:
# Set to false to pick another CSI as default
defaultClass: true
# Increase to 3 for a multi-node cluster
defaultClassReplicaCount: 1
defaultClassReplicaCount: 1
@@ -4,4 +4,4 @@ metadata:
name: longhorn-system
labels:
pod-security.kubernetes.io/enforce: privileged
topolvm.io/webhook: ignore
topolvm.io/webhook: ignore
@@ -8,4 +8,4 @@ metadata:
driver: driver.longhorn.io
deletionPolicy: Delete
parameters:
type: snap
type: snap
@@ -23,4 +23,4 @@ spec:
retries: 3
values:
speaker:
ignoreExcludeLB: true
ignoreExcludeLB: true
@@ -42,4 +42,4 @@ spec:
replicated:
# The Mayastor backend contains a duplicate of snapshot controller which will cause conflicts
mayastor:
enabled: false
enabled: false
@@ -99,4 +99,4 @@ spec:
hostPath: /etc/ca-certificates
hostPathType: DirectoryOrCreate
globalMounts:
- readOnly: true
- readOnly: true
@@ -24,7 +24,7 @@ spec:
crds: CreateReplace
remediation:
retries: 3
values:
values:
lvmd:
managed: false
env:
@@ -50,6 +50,6 @@ spec:
"topolvm.io/device-class": "thin"
node:
lvmdEmbedded: true
controller:
replicaCount: 1
replicaCount: 1
@@ -4,4 +4,4 @@ metadata:
name: topolvm-system
labels:
pod-security.kubernetes.io/enforce: privileged
topolvm.io/webhook: ignore
topolvm.io/webhook: ignore
@@ -6,4 +6,4 @@ metadata:
# annotations:
# snapshot.storage.kubernetes.io/is-default-class: "false"
driver: topolvm.io
deletionPolicy: Delete
deletionPolicy: Delete
@@ -4,4 +4,4 @@ metadata:
name: volsync
labels:
pod-security.kubernetes.io/enforce: privileged
topolvm.io/webhook: ignore
topolvm.io/webhook: ignore
@@ -48,4 +48,4 @@
allowedRoles:
- os:admin
allowedKubernetesNamespaces:
- system-upgrade
- system-upgrade
@@ -3,4 +3,4 @@
value:
"disabled": false
"servers":
- "time.cloudflare.com"
- "time.cloudflare.com"
@@ -37,4 +37,3 @@ REPLACEWITHTALENV
namespace: flux-system
stringData:
REPLACEWITHDEPLOYKEY
@@ -3,4 +3,4 @@
value:
"disabled": false
"servers":
- "time.cloudflare.com"
- "time.cloudflare.com"
@@ -7,4 +7,4 @@ clustertool.exe
clustertool
sopssecret.yaml
sopssecret*
*sopssecret*
*sopssecret*
@@ -12,4 +12,4 @@ creation_rules:
age: REPLACEME
- path_regex: talsecret.yaml
age: REPLACEME
## DO NOT REMOVE: Personal setting go under this line
## DO NOT REMOVE: Personal setting go under this line
+1 -1
View File
@@ -1 +1 @@
This is a kubernetes cluster Powered by TrueCharts ClusterTool
This is a kubernetes cluster Powered by TrueCharts ClusterTool
@@ -2,4 +2,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: []
resources: []
@@ -38,4 +38,4 @@ spec:
target:
group: kustomize.toolkit.fluxcd.io
kind: Kustomization
labelSelector: substitution.flux.home.arpa/disabled notin (true)
labelSelector: substitution.flux.home.arpa/disabled notin (true)
@@ -4,4 +4,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- this-repo.yaml
- truecharts.yaml
- truecharts.yaml
@@ -17,4 +17,4 @@ spec:
/*
# include flux directories
!/clusters
!/repositories
!/repositories
@@ -16,4 +16,4 @@ spec:
# exclude all
/*
# include flux directories
!/repositories
!/repositories
@@ -6,4 +6,4 @@ resources:
- ./git
- ./helm
- ./oci
- ./entries
- ./entries
@@ -9,4 +9,4 @@ spec:
interval: 10m
url: oci://ghcr.io/fluxcd/flux-manifests
ref:
tag: v2.4.0
tag: v2.4.0
@@ -3,4 +3,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- flux-manifests.yaml
- flux-manifests.yaml
+279 -279
View File
@@ -5,36 +5,36 @@ go 1.23.0
toolchain go1.23.2
require (
filippo.io/age v1.2.0
github.com/Masterminds/semver/v3 v3.3.0
github.com/beevik/ntp v1.4.3
github.com/budimanjojo/talhelper/v3 v3.0.7
github.com/fatih/color v1.17.0
github.com/getsops/sops/v3 v3.9.1
github.com/go-git/go-git/v5 v5.12.0
github.com/go-logr/logr v1.4.2
github.com/go-logr/zapr v1.3.0
github.com/go-playground/validator/v10 v10.22.1
github.com/invopop/jsonschema v0.12.0
github.com/joho/godotenv v1.5.1
github.com/knadh/koanf/parsers/yaml v0.1.0
github.com/knadh/koanf/providers/file v1.1.2
github.com/knadh/koanf/v2 v2.1.1
github.com/leaanthony/debme v1.2.1
github.com/rs/zerolog v1.33.0
github.com/siderolabs/talos/pkg/machinery v1.8.1
github.com/spf13/cobra v1.8.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.28.0
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.16.2
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/kustomize/api v0.18.0
sigs.k8s.io/kustomize/kyaml v0.18.1
sigs.k8s.io/yaml v1.4.0
filippo.io/age v1.2.0
github.com/Masterminds/semver/v3 v3.3.0
github.com/beevik/ntp v1.4.3
github.com/budimanjojo/talhelper/v3 v3.0.7
github.com/fatih/color v1.17.0
github.com/getsops/sops/v3 v3.9.1
github.com/go-git/go-git/v5 v5.12.0
github.com/go-logr/logr v1.4.2
github.com/go-logr/zapr v1.3.0
github.com/go-playground/validator/v10 v10.22.1
github.com/invopop/jsonschema v0.12.0
github.com/joho/godotenv v1.5.1
github.com/knadh/koanf/parsers/yaml v0.1.0
github.com/knadh/koanf/providers/file v1.1.2
github.com/knadh/koanf/v2 v2.1.1
github.com/leaanthony/debme v1.2.1
github.com/rs/zerolog v1.33.0
github.com/siderolabs/talos/pkg/machinery v1.8.1
github.com/spf13/cobra v1.8.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.28.0
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.16.2
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/kustomize/api v0.18.0
sigs.k8s.io/kustomize/kyaml v0.18.1
sigs.k8s.io/yaml v1.4.0
)
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
@@ -42,253 +42,253 @@ replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
replace go.mozilla.org/sops/v3 => github.com/getsops/sops/v3 v3.9.1
require (
cloud.google.com/go v0.115.1 // indirect
cloud.google.com/go/auth v0.9.7 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
cloud.google.com/go/iam v1.2.1 // indirect
cloud.google.com/go/kms v1.20.0 // indirect
cloud.google.com/go/longrunning v0.6.1 // indirect
cloud.google.com/go/storage v1.43.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.1.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.0-beta.0-proton // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go-v2 v1.31.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.39 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.37 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.36.3 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.23.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.27.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.31.3 // indirect
github.com/aws/smithy-go v1.21.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.3 // indirect
github.com/cloudflare/circl v1.4.0 // indirect
github.com/containerd/containerd v1.7.20 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/go-cni v1.1.10 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containernetworking/cni v1.2.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/distribution/v3 v3.0.0-alpha.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.3.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.3.1+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/getsops/gopgagent v0.0.0-20240527072608-0c14999532fe // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/cel-go v0.21.0 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/gookit/filter v1.2.1 // indirect
github.com/gookit/goutil v0.6.15 // indirect
github.com/gookit/validate v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/hashicorp/vault/api v1.15.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/jsimonetti/rtnetlink/v2 v2.0.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mdlayher/ethtool v0.1.0 // indirect
github.com/mdlayher/genetlink v1.3.2 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/miekg/dns v1.1.59 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rubenv/sql-migrate v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/siderolabs/crypto v0.4.4 // indirect
github.com/siderolabs/gen v0.5.0 // indirect
github.com/siderolabs/go-blockdevice v0.4.7 // indirect
github.com/siderolabs/go-blockdevice/v2 v2.0.2 // indirect
github.com/siderolabs/go-pointer v1.0.0 // indirect
github.com/siderolabs/image-factory v0.5.0 // indirect
github.com/siderolabs/net v0.4.0 // indirect
github.com/siderolabs/protoenc v0.2.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/urfave/cli v1.22.15 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // 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
github.com/xlab/treeprint v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/api v0.199.0 // indirect
google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apiextensions-apiserver v0.31.1 // indirect
k8s.io/apiserver v0.31.1 // indirect
k8s.io/cli-runtime v0.31.1 // indirect
k8s.io/component-base v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect
k8s.io/kubectl v0.31.1 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
oras.land/oras-go v1.2.5 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
cloud.google.com/go v0.115.1 // indirect
cloud.google.com/go/auth v0.9.7 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
cloud.google.com/go/iam v1.2.1 // indirect
cloud.google.com/go/kms v1.20.0 // indirect
cloud.google.com/go/longrunning v0.6.1 // indirect
cloud.google.com/go/storage v1.43.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.1.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.0-beta.0-proton // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go-v2 v1.31.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.5 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.39 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.37 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.36.3 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.23.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.27.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.31.3 // indirect
github.com/aws/smithy-go v1.21.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.3 // indirect
github.com/cloudflare/circl v1.4.0 // indirect
github.com/containerd/containerd v1.7.20 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/go-cni v1.1.10 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containernetworking/cni v1.2.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/distribution/v3 v3.0.0-alpha.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.3.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.3.1+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/getsops/gopgagent v0.0.0-20240527072608-0c14999532fe // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/cel-go v0.21.0 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
github.com/gookit/filter v1.2.1 // indirect
github.com/gookit/goutil v0.6.15 // indirect
github.com/gookit/validate v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/hashicorp/vault/api v1.15.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/jsimonetti/rtnetlink/v2 v2.0.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mdlayher/ethtool v0.1.0 // indirect
github.com/mdlayher/genetlink v1.3.2 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/miekg/dns v1.1.59 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rubenv/sql-migrate v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/siderolabs/crypto v0.4.4 // indirect
github.com/siderolabs/gen v0.5.0 // indirect
github.com/siderolabs/go-blockdevice v0.4.7 // indirect
github.com/siderolabs/go-blockdevice/v2 v2.0.2 // indirect
github.com/siderolabs/go-pointer v1.0.0 // indirect
github.com/siderolabs/image-factory v0.5.0 // indirect
github.com/siderolabs/net v0.4.0 // indirect
github.com/siderolabs/protoenc v0.2.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/urfave/cli v1.22.15 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // 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
github.com/xlab/treeprint v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/api v0.199.0 // indirect
google.golang.org/genproto v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apiextensions-apiserver v0.31.1 // indirect
k8s.io/apiserver v0.31.1 // indirect
k8s.io/cli-runtime v0.31.1 // indirect
k8s.io/component-base v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect
k8s.io/kubectl v0.31.1 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
oras.land/oras-go v1.2.5 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
+64 -64
View File
@@ -1,81 +1,81 @@
package main
import (
"os"
"time"
"os"
"time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/truecharts/public/clustertool/cmd"
"github.com/truecharts/public/clustertool/embed"
"github.com/truecharts/public/clustertool/pkg/helper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
ctrllogzap "sigs.k8s.io/controller-runtime/pkg/log/zap"
"github.com/truecharts/public/clustertool/cmd"
"github.com/truecharts/public/clustertool/embed"
"github.com/truecharts/public/clustertool/pkg/helper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
ctrllogzap "sigs.k8s.io/controller-runtime/pkg/log/zap"
)
func main() {
// Configure zerolog
zerolog.DurationFieldUnit = time.Second
// Configure zerolog
zerolog.DurationFieldUnit = time.Second
var zerologLevel zerolog.Level
var zapLevel zapcore.Level
var zerologLevel zerolog.Level
var zapLevel zapcore.Level
// Switch-case for setting the global log level
switch os.Getenv("DEBUG") {
case "trace":
zerologLevel = zerolog.TraceLevel
zapLevel = zapcore.DebugLevel // zap does not have a Trace level, use Debug as equivalent
case "debug":
zerologLevel = zerolog.DebugLevel
zapLevel = zapcore.DebugLevel
case "warn":
zerologLevel = zerolog.WarnLevel
zapLevel = zapcore.WarnLevel
case "error":
zerologLevel = zerolog.ErrorLevel
zapLevel = zapcore.ErrorLevel
case "fatal":
zerologLevel = zerolog.FatalLevel
zapLevel = zapcore.FatalLevel
case "panic":
zerologLevel = zerolog.PanicLevel
zapLevel = zapcore.PanicLevel
default:
zerologLevel = zerolog.InfoLevel
zapLevel = zapcore.InfoLevel
}
// Switch-case for setting the global log level
switch os.Getenv("DEBUG") {
case "trace":
zerologLevel = zerolog.TraceLevel
zapLevel = zapcore.DebugLevel // zap does not have a Trace level, use Debug as equivalent
case "debug":
zerologLevel = zerolog.DebugLevel
zapLevel = zapcore.DebugLevel
case "warn":
zerologLevel = zerolog.WarnLevel
zapLevel = zapcore.WarnLevel
case "error":
zerologLevel = zerolog.ErrorLevel
zapLevel = zapcore.ErrorLevel
case "fatal":
zerologLevel = zerolog.FatalLevel
zapLevel = zapcore.FatalLevel
case "panic":
zerologLevel = zerolog.PanicLevel
zapLevel = zapcore.PanicLevel
default:
zerologLevel = zerolog.InfoLevel
zapLevel = zapcore.InfoLevel
}
// Set zerolog level
zerolog.SetGlobalLevel(zerologLevel)
log.Logger = log.Output(zerolog.ConsoleWriter{
Out: os.Stdout,
TimeFormat: time.RFC3339,
NoColor: true,
})
// Set zerolog level
zerolog.SetGlobalLevel(zerologLevel)
log.Logger = log.Output(zerolog.ConsoleWriter{
Out: os.Stdout,
TimeFormat: time.RFC3339,
NoColor: true,
})
// Configure zap logger
zapConfig := zap.NewProductionConfig()
zapConfig.Level = zap.NewAtomicLevelAt(zapLevel)
zapLogger, err := zapConfig.Build()
if err != nil {
panic(err)
}
defer zapLogger.Sync()
// Configure zap logger
zapConfig := zap.NewProductionConfig()
zapConfig.Level = zap.NewAtomicLevelAt(zapLevel)
zapLogger, err := zapConfig.Build()
if err != nil {
panic(err)
}
defer zapLogger.Sync()
// Set controller-runtime logger to use zap
ctrlLogger := ctrllogzap.New(ctrllogzap.UseDevMode(true), ctrllogzap.Level(zapLevel))
ctrllog.SetLogger(ctrlLogger)
// Set controller-runtime logger to use zap
ctrlLogger := ctrllogzap.New(ctrllogzap.UseDevMode(true), ctrllogzap.Level(zapLevel))
ctrllog.SetLogger(ctrlLogger)
embed.AllToCache()
embed.AllToCache()
helper.CheckSystemTime()
helper.CheckReqDomains()
helper.CheckSystemTime()
helper.CheckReqDomains()
err = cmd.Execute()
if err != nil {
log.Fatal().Err(err).Msg("Failed to execute command")
}
err = cmd.Execute()
if err != nil {
log.Fatal().Err(err).Msg("Failed to execute command")
}
}
+2 -2
View File
@@ -23,7 +23,7 @@ done
for os in "${!os_targets[@]}"; do
for arch in "${architectures[@]}"; do
echo "Building precommit for $os/$arch"
# Determine output file name and extension
output="./embed/${os}_${arch}/precommit"
mkdir "./clustertool/embed/${os}_${arch}/" || echo "mkdir failed or not needed"
@@ -37,4 +37,4 @@ for os in "${!os_targets[@]}"; do
ls -l "./embed/${os}_${arch}/" || echo "ls failed"
cd -
done
done
done
+7 -7
View File
@@ -1,15 +1,15 @@
package main
import (
"os"
"os"
"github.com/rs/zerolog/log"
"github.com/truecharts/public/clustertool/pkg/sops"
"github.com/rs/zerolog/log"
"github.com/truecharts/public/clustertool/pkg/sops"
)
func main() {
if err := sops.CheckFilesAndReportEncryption(true, true); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
if err := sops.CheckFilesAndReportEncryption(true, true); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
}
@@ -1,60 +1,60 @@
package changelog
import (
"fmt"
"os"
"path/filepath"
"strings"
"sync"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/log"
)
type ActiveChart struct {
Name string
Train string
Name string
Train string
}
type ActiveCharts struct {
items map[string]ActiveChart
mu *sync.RWMutex
items map[string]ActiveChart
mu *sync.RWMutex
}
func (a *ActiveCharts) isActiveChart(chartName string) bool {
a.mu.RLock()
defer a.mu.RUnlock()
_, ok := a.items[chartName]
return ok
a.mu.RLock()
defer a.mu.RUnlock()
_, ok := a.items[chartName]
return ok
}
func (a *ActiveCharts) getActiveChartsWalker(path string, entry os.DirEntry, err error) error {
if err != nil {
return err
}
if entry.Name() != "Chart.yaml" {
return nil
}
// path = charts/<train>/<chart>/Chart.yaml
segLen := len(strings.Split(path, "/"))
if segLen < 3 {
return fmt.Errorf("path (%s) is not valid. expected at least charts/<train>/<chart>/Chart.yaml", path)
}
// chart = charts/<train>/<chart>/
chart, _ := filepath.Split(path)
// chart = charts/<train>/<chart>
chart = strings.TrimSuffix(chart, "/")
// train = charts/<train>
train := filepath.Dir(chart)
// train = <train>
train = filepath.Base(train)
// chartName = <chart>
chartName := filepath.Base(chart)
a.mu.Lock()
if _, ok := a.items[chartName]; !ok {
a.items[chartName] = ActiveChart{Name: chartName, Train: train}
} else {
log.Error().Msgf("chart [%s] already exists in activeCharts", chartName)
}
a.mu.Unlock()
return nil
if err != nil {
return err
}
if entry.Name() != "Chart.yaml" {
return nil
}
// path = charts/<train>/<chart>/Chart.yaml
segLen := len(strings.Split(path, "/"))
if segLen < 3 {
return fmt.Errorf("path (%s) is not valid. expected at least charts/<train>/<chart>/Chart.yaml", path)
}
// chart = charts/<train>/<chart>/
chart, _ := filepath.Split(path)
// chart = charts/<train>/<chart>
chart = strings.TrimSuffix(chart, "/")
// train = charts/<train>
train := filepath.Dir(chart)
// train = <train>
train = filepath.Base(train)
// chartName = <chart>
chartName := filepath.Base(chart)
a.mu.Lock()
if _, ok := a.items[chartName]; !ok {
a.items[chartName] = ActiveChart{Name: chartName, Train: train}
} else {
log.Error().Msgf("chart [%s] already exists in activeCharts", chartName)
}
a.mu.Unlock()
return nil
}
+136 -136
View File
@@ -1,187 +1,187 @@
package changelog
import (
"encoding/json"
"errors"
"fmt"
"os"
"sort"
"sync"
"time"
"encoding/json"
"errors"
"fmt"
"os"
"sort"
"sync"
"time"
"github.com/Masterminds/semver/v3"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/rs/zerolog/log"
"github.com/Masterminds/semver/v3"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/rs/zerolog/log"
)
type ChangedData struct {
mu *sync.RWMutex `json:"-"`
LastCommit string `json:"last_commit"`
Charts map[string]*Chart `json:"charts"`
mu *sync.RWMutex `json:"-"`
LastCommit string `json:"last_commit"`
Charts map[string]*Chart `json:"charts"`
}
type Chart struct {
Versions map[string]*Version `json:"versions"`
SortedVersions []string `json:"-"` // Used only for rendering
Name string `json:"-"` // Used only for rendering
Train string `json:"-"` // Used only for rendering
Versions map[string]*Version `json:"versions"`
SortedVersions []string `json:"-"` // Used only for rendering
Name string `json:"-"` // Used only for rendering
Train string `json:"-"` // Used only for rendering
}
func (c *Chart) SortVersions(reverse bool) ([]*semver.Version, error) {
chartVersions := []*semver.Version{}
for key := range c.Versions {
semVer, err := semver.NewVersion(key)
if err != nil {
return nil, err
}
chartVersions = append(chartVersions, semVer)
}
// Sort the versions from oldest to newest
sort.Slice(chartVersions, func(i, j int) bool {
if reverse {
return chartVersions[i].GreaterThan(chartVersions[j])
}
return chartVersions[i].LessThan(chartVersions[j])
})
chartVersions := []*semver.Version{}
for key := range c.Versions {
semVer, err := semver.NewVersion(key)
if err != nil {
return nil, err
}
chartVersions = append(chartVersions, semVer)
}
// Sort the versions from oldest to newest
sort.Slice(chartVersions, func(i, j int) bool {
if reverse {
return chartVersions[i].GreaterThan(chartVersions[j])
}
return chartVersions[i].LessThan(chartVersions[j])
})
for _, version := range chartVersions {
c.SortedVersions = append(c.SortedVersions, version.String())
}
for _, version := range chartVersions {
c.SortedVersions = append(c.SortedVersions, version.String())
}
return chartVersions, nil
return chartVersions, nil
}
func (c *ChangedData) AddOrUpdateChart(chart string, version string, train string, commit *object.Commit) {
if c.Charts == nil {
c.Charts = make(map[string]*Chart)
}
_, exists := c.Charts[chart]
if !exists {
c.Charts[chart] = &Chart{}
}
if c.Charts == nil {
c.Charts = make(map[string]*Chart)
}
_, exists := c.Charts[chart]
if !exists {
c.Charts[chart] = &Chart{}
}
c.Charts[chart].AddVersion(version, train)
c.Charts[chart].Versions[version].AddCommit(commit)
c.Charts[chart].AddVersion(version, train)
c.Charts[chart].Versions[version].AddCommit(commit)
}
func (c *Chart) AddVersion(version string, train string) {
if c.Versions == nil {
c.Versions = make(map[string]*Version)
}
_, exists := c.Versions[version]
if exists {
return
}
c.Versions[version] = &Version{
Version: version,
Train: train,
Commits: make(map[string]*Commit),
}
if c.Versions == nil {
c.Versions = make(map[string]*Version)
}
_, exists := c.Versions[version]
if exists {
return
}
c.Versions[version] = &Version{
Version: version,
Train: train,
Commits: make(map[string]*Commit),
}
}
type Version struct {
Version string `json:"version"`
Train string `json:"train"`
Commits map[string]*Commit `json:"commits"`
SortedCommits []*Commit `json:"-"` // Used only for rendering
Version string `json:"version"`
Train string `json:"train"`
Commits map[string]*Commit `json:"commits"`
SortedCommits []*Commit `json:"-"` // Used only for rendering
}
func (v *Version) AddCommit(commit *object.Commit) {
if v.Commits == nil {
v.Commits = make(map[string]*Commit)
}
if v.Commits == nil {
v.Commits = make(map[string]*Commit)
}
_, exists := v.Commits[commit.Hash.String()]
if exists {
return
}
v.Commits[commit.Hash.String()] = &Commit{
CommitHash: commit.Hash.String(),
ParentHash: commit.ParentHashes[0].String(),
Author: Author{Name: commit.Author.Name, Date: commit.Author.When.Format(dateFormat)},
Message: getCommitMessage(commit),
Kind: getCommitKind(commit),
}
_, exists := v.Commits[commit.Hash.String()]
if exists {
return
}
v.Commits[commit.Hash.String()] = &Commit{
CommitHash: commit.Hash.String(),
ParentHash: commit.ParentHashes[0].String(),
Author: Author{Name: commit.Author.Name, Date: commit.Author.When.Format(dateFormat)},
Message: getCommitMessage(commit),
Kind: getCommitKind(commit),
}
}
func (v *Version) SortCommits(reverse bool) ([]*Commit, error) {
commits := []*Commit{}
for _, commit := range v.Commits {
commits = append(commits, commit)
}
commits := []*Commit{}
for _, commit := range v.Commits {
commits = append(commits, commit)
}
hasErr := false
sort.Slice(commits, func(i, j int) bool {
// While we could store the time.Time in the Author struct,
// it was giving mixed results as the timezones were different.
// The dateFormat we use does not contain timezone, so it sorts better.
iDate, err := time.Parse(dateFormat, commits[i].Author.Date)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse date [%s]", commits[i].Author.Date)
return false
}
jDate, err := time.Parse(dateFormat, commits[j].Author.Date)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse date [%s]", commits[j].Author.Date)
return false
}
if reverse {
return iDate.After(jDate)
}
return iDate.Before(jDate)
})
hasErr := false
sort.Slice(commits, func(i, j int) bool {
// While we could store the time.Time in the Author struct,
// it was giving mixed results as the timezones were different.
// The dateFormat we use does not contain timezone, so it sorts better.
iDate, err := time.Parse(dateFormat, commits[i].Author.Date)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse date [%s]", commits[i].Author.Date)
return false
}
jDate, err := time.Parse(dateFormat, commits[j].Author.Date)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse date [%s]", commits[j].Author.Date)
return false
}
if reverse {
return iDate.After(jDate)
}
return iDate.Before(jDate)
})
if hasErr {
return nil, errors.New("failed to sort commits")
}
if hasErr {
return nil, errors.New("failed to sort commits")
}
v.SortedCommits = commits
return commits, nil
v.SortedCommits = commits
return commits, nil
}
type Commit struct {
CommitHash string `json:"commit_hash"`
ParentHash string `json:"parent_hash"`
Author Author `json:"author"`
Kind string `json:"kind"`
Message string `json:"message"`
CommitHash string `json:"commit_hash"`
ParentHash string `json:"parent_hash"`
Author Author `json:"author"`
Kind string `json:"kind"`
Message string `json:"message"`
}
type Author struct {
Name string `json:"name"`
Date string `json:"date"`
Name string `json:"name"`
Date string `json:"date"`
}
func (c *ChangedData) LoadFromFile(path string) error {
fileInfo, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
if fileInfo.IsDir() {
return fmt.Errorf("path is a directory")
}
fileInfo, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
if fileInfo.IsDir() {
return fmt.Errorf("path is a directory")
}
bytes, err := os.ReadFile(path)
if err != nil {
return err
}
bytes, err := os.ReadFile(path)
if err != nil {
return err
}
err = json.Unmarshal(bytes, &c)
if err != nil {
return err
}
err = json.Unmarshal(bytes, &c)
if err != nil {
return err
}
return nil
return nil
}
func (c *ChangedData) WriteToFile(path string) error {
data, err := json.MarshalIndent(c, "", " ")
if err != nil {
return err
}
log.Info().Msgf("Writing changed data to [%s]", path)
return os.WriteFile(path, data, 0644)
data, err := json.MarshalIndent(c, "", " ")
if err != nil {
return err
}
log.Info().Msgf("Writing changed data to [%s]", path)
return os.WriteFile(path, data, 0644)
}

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