Skip to content

Commit

Permalink
Adding HelmChart as well as OCIRepository as a ref source
Browse files Browse the repository at this point in the history
This commit add 2 possible sources references: OCIRepository and
existing HelmCharts. It takes into account switching from a chart
template to a referenced source (garbage collection).

Signed-off-by: Soule BA <[email protected]>
  • Loading branch information
souleb committed Mar 9, 2024
1 parent d01518c commit 87fd317
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 46 deletions.
5 changes: 3 additions & 2 deletions api/v2beta2/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ type PostRenderer struct {
}

// HelmReleaseSpec defines the desired state of a Helm release.
// +kubebuilder:validation:XValidation:rule="(has(self.chart) && !has(self.chartRef) || (!has(self.chart) && has(self.chartRef))", message="either chart or chartRef must be set"
// +kubebuilder:validation:XValidation:rule="(has(self.chart) && !has(self.chartRef)) || (!has(self.chart) && has(self.chartRef))", message="either chart or chartRef must be set"
type HelmReleaseSpec struct {
// Chart defines the template of the v1beta2.HelmChart that should be created
// for this HelmRelease.
// +optional
Chart HelmChartTemplate `json:"chart"`

// ChartRef holds a reference to a v1beta2.HelmChart resource
// ChartRef holds a reference to a source controller resource containing the
// Helm chart artifact.
// +optional
ChartRef *CrosssNameSpaceSourceReference `json:"chartRef,omitempty"`

Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2032,8 +2032,8 @@ spec:
type: object
x-kubernetes-validations:
- message: either chart or chartRef must be set
rule: (has(self.chart) && !has(self.chartRef) || (!has(self.chart) &&
has(self.chartRef))
rule: (has(self.chart) && !has(self.chartRef)) || (!has(self.chart)
&& has(self.chartRef))
status:
default:
observedGeneration: -1
Expand Down
116 changes: 102 additions & 14 deletions docs/api/v2beta2/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,27 @@ HelmChartTemplate
</em>
</td>
<td>
<em>(Optional)</em>
<p>Chart defines the template of the v1beta2.HelmChart that should be created
for this HelmRelease.</p>
</td>
</tr>
<tr>
<td>
<code>chartRef</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.CrosssNameSpaceSourceReference">
CrosssNameSpaceSourceReference
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ChartRef holds a reference to a v1beta2.HelmChart resource</p>
</td>
</tr>
<tr>
<td>
<code>interval</code><br>
<em>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
Expand Down Expand Up @@ -469,6 +484,74 @@ string
</table>
</div>
</div>
<h3 id="helm.toolkit.fluxcd.io/v2beta2.CrosssNameSpaceSourceReference">CrosssNameSpaceSourceReference
</h3>
<p>
(<em>Appears on:</em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.HelmReleaseSpec">HelmReleaseSpec</a>)
</p>
<p>CrosssNameSpaceSourceReference contains enough information to let you locate
the typed referenced object at cluster level.</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code><br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>APIVersion of the referent.</p>
</td>
</tr>
<tr>
<td>
<code>kind</code><br>
<em>
string
</em>
</td>
<td>
<p>Kind of the referent.</p>
</td>
</tr>
<tr>
<td>
<code>name</code><br>
<em>
string
</em>
</td>
<td>
<p>Name of the referent.</p>
</td>
</tr>
<tr>
<td>
<code>namespace</code><br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Namespace of the referent.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 id="helm.toolkit.fluxcd.io/v2beta2.DriftDetection">DriftDetection
</h3>
<p>
Expand Down Expand Up @@ -534,10 +617,6 @@ handle differences between the manifest in the Helm storage and the resources
currently existing in the cluster.</p>
<h3 id="helm.toolkit.fluxcd.io/v2beta2.Filter">Filter
</h3>
<p>
(<em>Appears on:</em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.Test">Test</a>)
</p>
<p>Filter holds the configuration for individual Helm test filters.</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
Expand Down Expand Up @@ -1009,12 +1088,27 @@ HelmChartTemplate
</em>
</td>
<td>
<em>(Optional)</em>
<p>Chart defines the template of the v1beta2.HelmChart that should be created
for this HelmRelease.</p>
</td>
</tr>
<tr>
<td>
<code>chartRef</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.CrosssNameSpaceSourceReference">
CrosssNameSpaceSourceReference
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ChartRef holds a reference to a v1beta2.HelmChart resource</p>
</td>
</tr>
<tr>
<td>
<code>interval</code><br>
<em>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Duration">
Expand Down Expand Up @@ -2267,9 +2361,7 @@ Kubernetes meta/v1.Time
<td>
<code>testHooks</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.TestHookStatus">
TestHookStatus
</a>
map[string]*github.com/fluxcd/helm-controller/api/v2beta2.TestHookStatus
</em>
</td>
<td>
Expand All @@ -2283,7 +2375,7 @@ run by the controller.</p>
</div>
</div>
<h3 id="helm.toolkit.fluxcd.io/v2beta2.Snapshots">Snapshots
(<code>[]*./api/v2beta2.Snapshot</code> alias)</h3>
(<code>[]*github.com/fluxcd/helm-controller/api/v2beta2.Snapshot</code> alias)</h3>
<p>
(<em>Appears on:</em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.HelmReleaseStatus">HelmReleaseStatus</a>)
Expand Down Expand Up @@ -2352,8 +2444,8 @@ actions in &lsquo;Install.IgnoreTestFailures&rsquo; and &lsquo;Upgrade.IgnoreTes
<td>
<code>filters</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.Filter">
Filter
<a href="#helm.toolkit.fluxcd.io/v2beta2.[]github.com/fluxcd/helm-controller/api/v2beta2.Filter">
[]github.com/fluxcd/helm-controller/api/v2beta2.Filter
</a>
</em>
</td>
Expand All @@ -2367,10 +2459,6 @@ Filter
</div>
<h3 id="helm.toolkit.fluxcd.io/v2beta2.TestHookStatus">TestHookStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.Snapshot">Snapshot</a>)
</p>
<p>TestHookStatus holds the status information for a test hook as observed
to be run by the controller.</p>
<div class="md-typeset__scrollwrap">
Expand Down
Loading

0 comments on commit 87fd317

Please sign in to comment.