Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Extract decrytor to internal package #739

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions controllers/kustomization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"

kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
"github.com/fluxcd/kustomize-controller/internal/decryptor"
)

// +kubebuilder:rbac:groups=kustomize.toolkit.fluxcd.io,resources=kustomizations,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -597,7 +598,7 @@ func (r *KustomizationReconciler) generate(kustomization kustomizev1.Kustomizati
}

func (r *KustomizationReconciler) build(ctx context.Context, workDir string, kustomization kustomizev1.Kustomization, dirPath string) ([]byte, error) {
dec, cleanup, err := NewTempDecryptor(workDir, r.Client, kustomization)
dec, cleanup, err := decryptor.NewTempDecryptor(workDir, r.Client, kustomization)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -728,7 +729,7 @@ func (r *KustomizationReconciler) apply(ctx context.Context, manager *ssa.Resour
resultSet := ssa.NewChangeSet()

for _, u := range objects {
if IsEncryptedSecret(u) {
if decryptor.IsEncryptedSecret(u) {
return false, nil,
fmt.Errorf("%s is SOPS encrypted, configuring decryption is required for this secret to be reconciled",
ssa.FmtUnstructured(u))
Expand Down
Loading