Skip to content

Commit

Permalink
introduce upgrade mechanism and add upgrade patch to v1 storage migra…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Jeeva Kandasamy <jkandasa@redhat.com>
  • Loading branch information
jkandasa committed Sep 5, 2023
1 parent 1764085 commit 3372a10
Show file tree
Hide file tree
Showing 65 changed files with 714 additions and 22,516 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ replace (
k8s.io/client-go => k8s.io/client-go v0.25.9
k8s.io/code-generator => k8s.io/code-generator v0.25.9
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515
knative.dev/pkg => knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0
knative.dev/pkg => knative.dev/pkg v0.0.0-20230718152110-aef227e72ead
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2240,8 +2240,8 @@ k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSn
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/eventing v0.38.0 h1:n6/k9IJ1kOvpZx4CMLqa1FG7g2iBiyKXwBu1Fy/81q4=
knative.dev/networking v0.0.0-20220404212543-dde40b019aff h1:pqzWi29qb44TY+5xtc9vty4mSyUYvojXZGCp0y/91eo=
knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 h1:EFQcoUo8I4bc+U3y6tR1B3ONYZSHWUdAfI7Vh7dae8g=
knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0/go.mod h1:2qWPP9Gjh9Q7ETti+WRHnBnGCSCq+6q7m3p/nmUQviE=
knative.dev/pkg v0.0.0-20230718152110-aef227e72ead h1:2dDzorpKuVZW3Qp7TbirMMq16FbId8f6bacQFX8jXLw=
knative.dev/pkg v0.0.0-20230718152110-aef227e72ead/go.mod h1:WmrwRV/P+hGHoMraAEfwg6ec+fBTf+Obu41v354Iabc=
knative.dev/serving v0.30.1-0.20220402124840-21c05dc9d9a4 h1:iRFWsFKsA5ddhi+eKZVJdf8gPBomTfjIyRAKk9Uh7Ko=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/operator/v1alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const (
InstallerSetType = "operator.tekton.dev/type"
LabelOperandName = "operator.tekton.dev/operand-name"
DbSecretHash = "operator.tekton.dev/db-secret-hash"
LastAppliedUpgrade = "operator.tekton.dev/last-applied-upgrade"

// this key will be updated in the "upgrade" package
// "upgrade" package uses const from here. Hence importing "upgrade" package leads import cyclic error
// to avoid this import cyclic error, environment key is used.
LatestUpgradeVersionEnvKey = "LATEST_UPGRADE_VERSION"

UpgradePending = "upgrade pending"
Reinstalling = "reinstalling"
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/operator/v1alpha1/tektonconfig_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@ package v1alpha1

import (
"context"
"os"
"strings"

"knative.dev/pkg/ptr"
)

func (tc *TektonConfig) SetDefaults(ctx context.Context) {

// update recent upgrade script version, if it is a fresh installation
if tc.GetAnnotations()[LastAppliedUpgrade] == "" {
if tc.Annotations == nil {
tc.Annotations = map[string]string{}
}
tc.Annotations[LastAppliedUpgrade] = os.Getenv(LatestUpgradeVersionEnvKey)
}

if tc.Spec.Profile == "" {
tc.Spec.Profile = ProfileBasic
}
Expand Down

0 comments on commit 3372a10

Please sign in to comment.