2025-01-20 17:20:04 +01:00
|
|
|
/*
|
|
|
|
Copyright 2025 Peter Kurfer.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2024-12-10 08:43:59 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-12-13 09:09:14 +01:00
|
|
|
"embed"
|
2024-12-10 08:43:59 +01:00
|
|
|
"log/slog"
|
|
|
|
"os"
|
2024-12-13 09:09:14 +01:00
|
|
|
"text/template"
|
2024-12-10 08:43:59 +01:00
|
|
|
|
|
|
|
_ "github.com/magefile/mage/sh"
|
|
|
|
)
|
|
|
|
|
2024-12-13 09:09:14 +01:00
|
|
|
var (
|
|
|
|
workingDir string
|
|
|
|
//go:embed templates/*.tmpl
|
|
|
|
templatesFS embed.FS
|
|
|
|
templates *template.Template
|
|
|
|
)
|
2024-12-10 08:43:59 +01:00
|
|
|
|
2025-01-22 19:15:26 +01:00
|
|
|
const (
|
|
|
|
k8sVersion = "1.31.0"
|
|
|
|
)
|
|
|
|
|
2024-12-10 08:43:59 +01:00
|
|
|
func init() {
|
|
|
|
logLevel := new(slog.LevelVar)
|
|
|
|
|
|
|
|
if val, set := os.LookupEnv("MAGE_LOG_LEVEL"); set {
|
|
|
|
_ = logLevel.UnmarshalText([]byte(val))
|
|
|
|
}
|
|
|
|
|
|
|
|
handler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
|
|
|
|
Level: logLevel,
|
|
|
|
})
|
|
|
|
|
|
|
|
slog.SetDefault(slog.New(handler))
|
|
|
|
|
|
|
|
if wd, err := os.Getwd(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
} else {
|
|
|
|
workingDir = wd
|
|
|
|
}
|
2024-12-13 09:09:14 +01:00
|
|
|
|
|
|
|
templates = template.Must(template.ParseFS(templatesFS, "templates/*.tmpl"))
|
2024-12-10 08:43:59 +01:00
|
|
|
}
|