Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: new experimental deploy engine
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
- Loading branch information
1 parent
ae7c6ee
commit 8d431c2
Showing
43 changed files
with
830 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package helm | ||
|
||
import ( | ||
"fmt" | ||
|
||
"helm.sh/helm/v3/pkg/werf/common" | ||
"helm.sh/helm/v3/pkg/werf/mutator" | ||
"helm.sh/helm/v3/pkg/werf/resource" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
) | ||
|
||
var _ mutator.RuntimeResourceMutator = (*ExtraAnnotationsMutator)(nil) | ||
|
||
func NewExtraAnnotationsMutator(extraAnnos map[string]string) *ExtraAnnotationsMutator { | ||
return &ExtraAnnotationsMutator{ | ||
extraAnnos: extraAnnos, | ||
} | ||
} | ||
|
||
type ExtraAnnotationsMutator struct { | ||
extraAnnos map[string]string | ||
} | ||
|
||
func (m *ExtraAnnotationsMutator) Mutate(res resource.Resourcer, operationType common.ClientOperationType) (resource.Resourcer, error) { | ||
if !res.PartOfRelease() { | ||
return res, nil | ||
} | ||
|
||
switch operationType { | ||
case common.ClientOperationTypeCreate, common.ClientOperationTypeUpdate, common.ClientOperationTypeSmartApply: | ||
default: | ||
return res, nil | ||
} | ||
|
||
for k, v := range m.extraAnnos { | ||
if err := unstructured.SetNestedField(res.Unstructured().UnstructuredContent(), v, "metadata", "annotations", k); err != nil { | ||
return nil, fmt.Errorf("error adding extra annotation: %w", err) | ||
} | ||
} | ||
|
||
return res, nil | ||
} |
Oops, something went wrong.