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

🌱 Remove helmchartstatus after hook is finished #139

Merged
merged 1 commit into from
Apr 30, 2024
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
15 changes: 10 additions & 5 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ rules:
min-spaces-from-content: 1

yaml-files:
- '*.yaml'
- '*.yml'
- "*.yaml"
- "*.yml"

ignore:
- '**/vendor/**'
- '.cache'
- "**/vendor/**"
- ".cache"
- _artifacts
- config/crd/**/*.yaml
- config/rbac/**/*.yaml
- config/webhook/**/*.yaml
- config/webhook/**/*.yaml
- test/infrastructure/**/config/webhook/**/*.yaml
- test/infrastructure/**/config/crd/**/*.yaml
- test/infrastructure/**/config/rbac/**/*.yaml
- test/releases/**
- test/cluster-stacks/**
8 changes: 7 additions & 1 deletion internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@

clusterAddon.Spec.ClusterStack = cluster.Spec.Topology.Class

// store the release kubernetes version and current hook
// remove the helm chart status from the status.
clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions)
clusterAddon.Status.Ready = true

return ctrl.Result{}, nil
Expand Down Expand Up @@ -387,6 +388,11 @@
// clusterAddon.Spec.Version = metadata.Versions.Components.ClusterAddon
conditions.MarkTrue(clusterAddon, csov1alpha1.HelmChartAppliedCondition)

// remove the helm chart status from the status.
clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions)

// store the release kubernetes version and current hook
clusterAddon.Status.KubernetesVersion = releaseAsset.Meta.Versions.Kubernetes
clusterAddon.Status.CurrentHook = clusterAddon.Spec.Hook
clusterAddon.Status.Ready = true
}
Expand Down Expand Up @@ -470,7 +476,7 @@
return addonStages, nil
}

func (r *ClusterAddonReconciler) templateAndApplyClusterAddonHelmChart(ctx context.Context, in templateAndApplyClusterAddonInput, shouldDelete bool) (bool, error) {

Check failure on line 479 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

hugeParam: in is heavy (144 bytes); consider passing it by pointer (gocritic)
clusterAddonChart := in.clusterAddonChartPath
var shouldRequeue bool

Expand All @@ -495,7 +501,7 @@
return shouldRequeue, nil
}

func (r *ClusterAddonReconciler) executeStage(ctx context.Context, stage clusteraddon.Stage, in templateAndApplyClusterAddonInput) (bool, error) {

Check failure on line 504 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

hugeParam: stage is heavy (112 bytes); consider passing it by pointer (gocritic)
var (
shouldRequeue bool
err error
Expand Down Expand Up @@ -677,7 +683,7 @@
return releaseAsset.ClusterAddonChartPath(), false, nil
}

func helmTemplateAndApplyNewClusterStack(ctx context.Context, in templateAndApplyClusterAddonInput, helmChartName string) (bool, error) {

Check failure on line 686 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

hugeParam: in is heavy (144 bytes); consider passing it by pointer (gocritic)
logger := log.FromContext(ctx)

var (
Expand Down Expand Up @@ -711,14 +717,14 @@
}

func helmTemplateAndDeleteNewClusterStack(ctx context.Context, in templateAndApplyClusterAddonInput, helmChartName string) (bool, error) {
// logger := log.FromContext(ctx)

Check failure on line 720 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

commentedOutCode: may want to remove commented-out code (gocritic)
var (
buildTemplate []byte
// oldHelmTemplate []byte
err error
)

// if in.oldDestinationClusterAddonChartDir != "" {

Check failure on line 727 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

commentedOutCode: may want to remove commented-out code (gocritic)
// oldClusterStackSubDirPath := filepath.Join(in.oldDestinationClusterAddonChartDir, helmChartName)
// oldHelmTemplate, err = helmTemplateClusterAddon(oldClusterStackSubDirPath, buildTemplate, true)
// if err != nil {
Expand All @@ -732,7 +738,7 @@
if err != nil {
return false, fmt.Errorf("failed to template new helm chart: %w", err)
}
// logger.Info("newClusterStackSubDirPath v1", "path", newClusterStackSubDirPath)

Check failure on line 741 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

commentedOutCode: may want to remove commented-out code (gocritic)

shouldRequeue, err := in.kubeClient.DeleteNewClusterStack(ctx, newHelmTemplate)
if err != nil {
Expand Down
Loading