NAME

IO::K8s::Role::HelmManaged - Role for K3s Helm chart management

VERSION

version 1.108

SYNOPSIS

package My::K3s::HelmChart;
use IO::K8s::APIObject
    api_version     => 'helm.cattle.io/v1',
    resource_plural => 'helmcharts';
with 'IO::K8s::Role::HelmManaged';

package main;
my $k8s = IO::K8s->new(with => ['IO::K8s::K3s']);
my $chart = $k8s->new_object('HelmChart',
    metadata => { name => 'traefik', namespace => 'kube-system' },
);
$chart->from_repo('https://traefik.github.io/charts', 'traefik')
      ->set_version('25.0.0')
      ->set_values(replicas => 3);

DESCRIPTION

This role provides the fluent setters documented in README's K3s section for working with HelmChart and HelmChartConfig CRDs from IO::K8s::K3s. Each setter writes through IO::K8s::Role::SpecBuilder's spec_* methods, so the methods work whether the underlying spec attribute is a plain hash or a typed object.

Use this role on a custom CRD class with api_version => 'helm.cattle.io/v1' or api_version => 'k3s.cattle.io/v1', or compose it on the bundled IO::K8s::K3s::V1::HelmChart / IO::K8s::K3s::V1::HelmChartConfig classes to add the helpers at runtime.

from_repo

$chart->from_repo($repo_url, $chart_name);

Sets the chart's spec.repo to $repo_url and spec.chart to $chart_name, matching the HelmChart CRD's spec.chart + spec.repo fields under helm.cattle.io/v1. Returns $self for chaining.

$chart->from_repo('https://traefik.github.io/charts', 'traefik');

set_version

$chart->set_version($version);

Sets the chart's spec.version -- the Helm chart version to pin against, not the apiVersion of the CRD. Returns $self for chaining.

$chart->set_version('25.0.0');

set_values

$chart->set_values(key1 => $value1, key2 => $value2, ...);

Merges the given key/value pairs into the chart's spec.set hash, preserving any values already present. This is the K3s equivalent of helm install --set key=value ... and ends up on the wire as the spec.set block the HelmChart CRD supports. Returns $self for chaining.

$chart->set_values(replicas => 3, logLevel => 'info');

set_values_yaml

$chart->set_values_yaml($yaml_str);

Sets the chart's spec.valuesContent to a literal YAML blob. This is the K3s equivalent of helm install --values values.yaml -- the YAML is shipped inside the manifest rather than being merged key by key. Returns $self for chaining.

$chart->set_values_yaml(<<'YAML');
replicas: 3
service:
  type: LoadBalancer
YAML

SEE ALSO

IO::K8s::K3s, IO::K8s::Role::SpecBuilder, IO::K8s::APIObject

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/pplu/io-k8s-p5/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHORS

  • Torsten Raudssus <getty@cpan.org>

  • Jose Luis Martinez Torres <jlmartin@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004