Skip to content

Commit

Permalink
Remove deprecated patchesStrategicMerge and patchesJson6902 from …
Browse files Browse the repository at this point in the history
…v2 API

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed May 4, 2024
1 parent 49edb16 commit 5da51b0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 273 deletions.
16 changes: 0 additions & 16 deletions api/v2/condition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,7 @@ const (
// HelmRelease failed.
ArtifactFailedReason string = "ArtifactFailed"

// InitFailedReason represents the fact that the initialization of the Helm
// configuration failed.
InitFailedReason string = "InitFailed"

// GetLastReleaseFailedReason represents the fact that observing the last
// release failed.
GetLastReleaseFailedReason string = "GetLastReleaseFailed"

// DependencyNotReadyReason represents the fact that
// one of the dependencies is not ready.
DependencyNotReadyReason string = "DependencyNotReady"

// ReconciliationSucceededReason represents the fact that
// the reconciliation succeeded.
ReconciliationSucceededReason string = "ReconciliationSucceeded"

// ReconciliationFailedReason represents the fact that
// the reconciliation failed.
ReconciliationFailedReason string = "ReconciliationFailed"
)
10 changes: 0 additions & 10 deletions api/v2/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ type Kustomize struct {
// +optional
Patches []kustomize.Patch `json:"patches,omitempty"`

// Strategic merge patches, defined as inline YAML objects.
// Deprecated: use Patches instead.
// +optional
PatchesStrategicMerge []apiextensionsv1.JSON `json:"patchesStrategicMerge,omitempty"`

// JSON 6902 patches, defined as inline YAML objects.
// Deprecated: use Patches instead.
// +optional
PatchesJSON6902 []kustomize.JSON6902Patch `json:"patchesJson6902,omitempty"`

// Images is a list of (image name, new name, new tag or digest)
// for changing image names, tags or digests. This can also be achieved with a
// patch, but this operator is simpler to specify.
Expand Down
36 changes: 11 additions & 25 deletions api/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 0 additions & 103 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -581,109 +581,6 @@ spec:
- patch
type: object
type: array
patchesJson6902:
description: |-
JSON 6902 patches, defined as inline YAML objects.
Deprecated: use Patches instead.
items:
description: JSON6902Patch contains a JSON6902 patch and
the target the patch should be applied to.
properties:
patch:
description: Patch contains the JSON6902 patch document
with an array of operation objects.
items:
description: |-
JSON6902 is a JSON6902 operation object.
https://datatracker.ietf.org/doc/html/rfc6902#section-4
properties:
from:
description: |-
From contains a JSON-pointer value that references a location within the target document where the operation is
performed. The meaning of the value depends on the value of Op, and is NOT taken into account by all operations.
type: string
op:
description: |-
Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
"test".
https://datatracker.ietf.org/doc/html/rfc6902#section-4
enum:
- test
- remove
- add
- replace
- move
- copy
type: string
path:
description: |-
Path contains the JSON-pointer value that references a location within the target document where the operation
is performed. The meaning of the value depends on the value of Op.
type: string
value:
description: |-
Value contains a valid JSON structure. The meaning of the value depends on the value of Op, and is NOT taken into
account by all operations.
x-kubernetes-preserve-unknown-fields: true
required:
- op
- path
type: object
type: array
target:
description: Target points to the resources that the
patch document should be applied to.
properties:
annotationSelector:
description: |-
AnnotationSelector is a string that follows the label selection expression
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource annotations.
type: string
group:
description: |-
Group is the API group to select resources from.
Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
type: string
kind:
description: |-
Kind of the API Group to select resources from.
Together with Group and Version it is capable of unambiguously
identifying and/or selecting resources.
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
type: string
labelSelector:
description: |-
LabelSelector is a string that follows the label selection expression
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
It matches with the resource labels.
type: string
name:
description: Name to match resources with.
type: string
namespace:
description: Namespace to select resources from.
type: string
version:
description: |-
Version of the API Group to select resources from.
Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
type: string
type: object
required:
- patch
- target
type: object
type: array
patchesStrategicMerge:
description: |-
Strategic merge patches, defined as inline YAML objects.
Deprecated: use Patches instead.
items:
x-kubernetes-preserve-unknown-fields: true
type: array
type: object
type: object
type: array
Expand Down
30 changes: 0 additions & 30 deletions docs/api/v2/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -1983,36 +1983,6 @@ capable of targeting objects based on kind, label and annotation selectors.</p>
</tr>
<tr>
<td>
<code>patchesStrategicMerge</code><br>
<em>
<a href="https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1?tab=doc#JSON">
[]Kubernetes pkg/apis/apiextensions/v1.JSON
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Strategic merge patches, defined as inline YAML objects.
Deprecated: use Patches instead.</p>
</td>
</tr>
<tr>
<td>
<code>patchesJson6902</code><br>
<em>
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/kustomize#JSON6902Patch">
[]github.com/fluxcd/pkg/apis/kustomize.JSON6902Patch
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>JSON 6902 patches, defined as inline YAML objects.
Deprecated: use Patches instead.</p>
</td>
</tr>
<tr>
<td>
<code>images</code><br>
<em>
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/kustomize#Image">
Expand Down
6 changes: 2 additions & 4 deletions internal/postrender/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ func BuildPostRenderers(rel *v2.HelmRelease) helmpostrender.PostRenderer {
for _, r := range rel.Spec.PostRenderers {
if r.Kustomize != nil {
renderers = append(renderers, &Kustomize{
Patches: r.Kustomize.Patches,
PatchesStrategicMerge: r.Kustomize.PatchesStrategicMerge,
PatchesJSON6902: r.Kustomize.PatchesJSON6902,
Images: r.Kustomize.Images,
Patches: r.Kustomize.Patches,
Images: r.Kustomize.Images,
})
}
}
Expand Down
24 changes: 0 additions & 24 deletions internal/postrender/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"sync"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"sigs.k8s.io/kustomize/api/krusty"
"sigs.k8s.io/kustomize/api/resmap"
kustypes "sigs.k8s.io/kustomize/api/types"
Expand All @@ -34,12 +33,6 @@ import (
type Kustomize struct {
// Patches is a list of patches to apply to the rendered manifests.
Patches []kustomize.Patch
// PatchesStrategicMerge is a list of strategic merge patches to apply to
// the rendered manifests.
PatchesStrategicMerge []apiextensionsv1.JSON
// PatchesJSON6902 is a list of JSON patches to apply to the rendered
// manifests.
PatchesJSON6902 []kustomize.JSON6902Patch
// Images is a list of images to replace in the rendered manifests.
Images []kustomize.Image
}
Expand All @@ -66,23 +59,6 @@ func (k *Kustomize) Run(renderedManifests *bytes.Buffer) (modifiedManifests *byt
})
}

// Add strategic merge patches.
for _, m := range k.PatchesStrategicMerge {
cfg.PatchesStrategicMerge = append(cfg.PatchesStrategicMerge, kustypes.PatchStrategicMerge(m.Raw))
}

// Add JSON 6902 patches.
for i, m := range k.PatchesJSON6902 {
patch, err := json.Marshal(m.Patch)
if err != nil {
return nil, err
}
cfg.PatchesJson6902 = append(cfg.PatchesJson6902, kustypes.Patch{
Patch: string(patch),
Target: adaptSelector(&k.PatchesJSON6902[i].Target),
})
}

// Write kustomization config to file.
kustomization, err := json.Marshal(cfg)
if err != nil {
Expand Down
Loading

0 comments on commit 5da51b0

Please sign in to comment.