Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupExpiredCharts()
- func ClearChartCache() error
- func CreateChartCopy(sourcePath string) (string, error)
- func GenerateCacheKey(manifest *manifest.Manifest) (string, error)
- func GenerateReleaseName(projectName, environmentName string) string
- func GetCachedChart(cacheKey string) (string, bool)
- func GetChartCacheStats() (count int, totalSize int64)
- func MapManifestToChartValues(m *manifest.Manifest, desiredEnvironment string) (map[string]any, error)
- func PrepareChart(ctx context.Context, manifest *manifest.Manifest, desiredEnvironment string) (string, error)
- func SetCachedChart(cacheKey, chartPath string)
- type ChartCache
- type ChartCacheInfo
- type ChartData
- type Client
- func (c *Client) DeleteRelease(ctx context.Context, project, environment string) error
- func (c *Client) GetRelease(ctx context.Context, project, environment string) (*v1.Release, error)
- func (c *Client) GetReleaseHistory(ctx context.Context, project, environment string) ([]*v1.Release, error)
- func (c *Client) InstallApp(ctx context.Context, manifest *manifest.Manifest, environment string, ...) error
- func (c *Client) ListReleases(ctx context.Context, selector labels.Selector) ([]*v1.Release, error)
- func (c *Client) RollbackRelease(ctx context.Context, releaseName string, revision int, timeout time.Duration) error
- type Option
Constants ¶
const ( // ChartNameTemplate is the template for generated chart names ChartNameTemplate = "%s-%s" // ReleaseNameTemplate is the template for Helm release names ReleaseNameTemplate = "%s-%s" // TempChartPrefix is the prefix for temporary chart directories TempChartPrefix = "deployah-chart-" // ChartYamlTemplate is the template file name for Chart.yaml ChartYamlTemplate = "Chart.yaml.gotmpl" // ValuesYamlFile is the name of the values file ValuesYamlFile = "values.yaml" )
Chart and Template Constants
Variables ¶
var ChartTemplateFS embed.FS
Embed the embedded chart directory. We renamed underscore-prefixed templates so they are included by directory embedding without explicit listing.
Functions ¶
func CleanupExpiredCharts ¶
func CleanupExpiredCharts()
CleanupExpiredCharts removes expired chart cache entries
func ClearChartCache ¶
func ClearChartCache() error
ClearChartCache clears all cached charts and removes their directories
func CreateChartCopy ¶
CreateChartCopy creates a copy of a cached chart directory to avoid conflicts
func GenerateCacheKey ¶
GenerateCacheKey creates a comprehensive cache key that includes both manifest and chart template hashes
func GenerateReleaseName ¶
GenerateReleaseName returns the Helm release name derived from project and environment. Format: PROJECT_NAME-ENVIRONMENT_NAME
func GetCachedChart ¶
GetCachedChart retrieves a cached chart if it exists and is valid
func GetChartCacheStats ¶
GetChartCacheStats returns statistics about the chart cache
func PrepareChart ¶
func PrepareChart(ctx context.Context, manifest *manifest.Manifest, desiredEnvironment string) (string, error)
PrepareChart expands the embedded chart into a temporary directory, rendering any files with the .gotmpl suffix using Go templates and Sprig functions. It returns the root directory path of the prepared chart. Uses caching to avoid regenerating identical charts.
func SetCachedChart ¶
func SetCachedChart(cacheKey, chartPath string)
SetCachedChart stores a chart path in the cache
Types ¶
type ChartCache ¶
ChartCache represents a cached chart entry
type ChartCacheInfo ¶
type ChartCacheInfo struct { Count int `json:"count"` TotalSize int64 `json:"totalSize"` ChartHash string `json:"chartHash"` TTL string `json:"ttl"` CacheKeys []string `json:"cacheKeys,omitempty"` }
ChartCacheInfo provides detailed information about the chart cache
func GetChartCacheInfo ¶
func GetChartCacheInfo() (*ChartCacheInfo, error)
GetChartCacheInfo returns detailed information about the chart cache
type ChartData ¶
type ChartData struct { Chart struct { Name string Description string Version string AppVersion string } Values map[string]any // For values.yaml templating Manifest *manifest.Manifest // Added for dynamic sub-charts }
ChartData holds the values to substitute in the templates, including arbitrary values for values.yaml .Values can be used in values.yaml.gotmpl for flexible templating You can add more fields for project, component, etc.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient initializes Helm action configuration with functional options. Default storage driver is "secret" if not specified. Default timeout is 5 minutes if not specified.
func (*Client) DeleteRelease ¶
DeleteRelease uninstalls the given release.
func (*Client) GetRelease ¶
func (*Client) GetReleaseHistory ¶
func (c *Client) GetReleaseHistory(ctx context.Context, project, environment string) ([]*v1.Release, error)
GetReleaseHistory returns the history of a specific release.
func (*Client) InstallApp ¶
func (c *Client) InstallApp(ctx context.Context, manifest *manifest.Manifest, environment string, dryRun bool) error
InstallApp installs or upgrades the app using the embedded chart.
func (*Client) ListReleases ¶
ListReleases returns detailed information about releases in the current namespace.
type Option ¶
type Option func(*Client)
Option is a functional option for configuring the Helm client
func WithKubeconfig ¶
WithKubeconfig sets the path to the kubeconfig file
func WithNamespace ¶
WithNamespace sets the Kubernetes namespace for Helm operations
func WithStorageDriver ¶
WithStorageDriver sets the Helm storage driver (secret, configmap, or memory)
func WithTimeout ¶
WithTimeout sets the default timeout for Helm operations