feat: 🚛 完成了 client 资源创建
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"gitea.loveuer.com/yizhisec/pkg3/logger"
|
||||
"yizhisec.com/hsv2/forge/internal/opt"
|
||||
"yizhisec.com/hsv2/forge/pkg/downloader"
|
||||
"yizhisec.com/hsv2/forge/pkg/model"
|
||||
)
|
||||
|
||||
type RedisOpt func(*redisOpt)
|
||||
@@ -90,18 +91,18 @@ metrics:
|
||||
fn(o)
|
||||
}
|
||||
|
||||
redisDir := filepath.Join(m.workdir, "dependency", "redis")
|
||||
chartFile := filepath.Join(redisDir, chartFilename)
|
||||
valuesFile := filepath.Join(redisDir, "values.yaml")
|
||||
location := filepath.Join(m.workdir, "dependency", "redis")
|
||||
chartFile := filepath.Join(location, chartFilename)
|
||||
valuesFile := filepath.Join(location, "values.yaml")
|
||||
|
||||
logger.Info("☑️ maker.Redis: 开始构建 Redis 资源...")
|
||||
logger.Debug("☑️ maker.Redis: 开始构建 Redis 资源..., opt = %#v", o)
|
||||
logger.Debug("☑️ maker.Redis: 创建目录 %s", redisDir)
|
||||
if err := os.MkdirAll(redisDir, 0755); err != nil {
|
||||
logger.Debug("☑️ maker.Redis: 创建目录 %s", location)
|
||||
if err := os.MkdirAll(location, 0755); err != nil {
|
||||
logger.Debug("❌ maker.Redis: 创建目录失败: %v", err)
|
||||
return err
|
||||
}
|
||||
logger.Debug("✅ maker.Redis: 创建目录 %s 成功", redisDir)
|
||||
logger.Debug("✅ maker.Redis: 创建目录 %s 成功", location)
|
||||
|
||||
logger.Debug("☑️ maker.Redis: 下载 Redis chart..., url = %s, dest = %s", chartURL, chartFile)
|
||||
if err := downloader.Download(
|
||||
@@ -123,6 +124,14 @@ metrics:
|
||||
}
|
||||
logger.Debug("✅ maker.Redis: 写入 values.yaml 文件成功, dest = %s", valuesFile)
|
||||
|
||||
logger.Debug("☑️ maker.Redis: 开始获取镜像...")
|
||||
img := &model.Image{Name: "docker.io/bitnami/redis:8.2.2", Fallback: "hub.yizhisec.com/external/bitnami/redis:8.2.2", Save: "bitnami.redis.8.2.2.tar"}
|
||||
if err := m.Image(ctx, img.Name, WithImageFallback(img.Fallback), WithImageSave(filepath.Join(location, img.Save))); err != nil {
|
||||
logger.Debug("❌ maker.Redis: 获取镜像失败: %s, %v", img.Name, err)
|
||||
return err
|
||||
}
|
||||
logger.Debug("✅ maker.Redis: 获取镜像成功!!!")
|
||||
|
||||
logger.Info("✅ maker.Redis: 构建 Redis 资源成功!!!")
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user