Skip to content

Commit

Permalink
constant deployment times
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Nov 16, 2021
1 parent f925036 commit 9c41495
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/base/helm_functions.go
Expand Up @@ -10,7 +10,6 @@ import (

rspb "helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage"
"helm.sh/helm/v3/pkg/time"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -41,7 +40,8 @@ func newSecretsObject(rls *rspb.Release) (*v1.Secret, error) {
}

lbs := map[string]string{
"createdAt": strconv.Itoa(int(time.Now().Unix())),
//"createdAt": strconv.Itoa(int(time.Now().Unix())),
"createdAt": strconv.Itoa(1), // make a constant so that there aren't spurious diffs
"version": strconv.Itoa(rls.Version),
"status": rls.Info.Status.String(),
"owner": owner,
Expand Down
6 changes: 6 additions & 0 deletions pkg/base/helm_v3.go
Expand Up @@ -6,12 +6,14 @@ import (
"os"
"regexp"
"strings"
"time"

"github.com/pkg/errors"
"github.com/replicatedhq/kots/pkg/util"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
rspb "helm.sh/helm/v3/pkg/release"
helmtime "helm.sh/helm/v3/pkg/time"
k8syaml "sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -90,6 +92,10 @@ func renderHelmV3(chartName string, chartPath string, vals map[string]interface{
}
rel.Info.Status = rspb.StatusDeployed

// override deployed times to avoid spurious diffs
rel.Info.FirstDeployed, _ = helmtime.Parse(time.RFC3339, "1970-01-01T01:00:00")
rel.Info.LastDeployed, _ = helmtime.Parse(time.RFC3339, "1970-01-01T01:00:00")

helmReleaseSecretObj, err := newSecretsObject(rel)
if err != nil {
return nil, errors.Wrap(err, "failed to generate helm secret")
Expand Down

0 comments on commit 9c41495

Please sign in to comment.