Skip to content

Commit

Permalink
Issue 664: Updating go version to 1.20 (#665)
Browse files Browse the repository at this point in the history
* Issue 664: Updating go version to 1.20

Signed-off-by: anisha.kj <anisha.kj@dell.com>

* Updating go version in ci.yaml

Signed-off-by: anisha.kj <anisha.kj@dell.com>

* Commenting deletion of cluster for debugging

Signed-off-by: anisha.kj <anisha.kj@dell.com>

* Removing comments

Signed-off-by: anisha.kj <anisha.kj@dell.com>

---------

Signed-off-by: anisha.kj <anisha.kj@dell.com>
  • Loading branch information
anishakj authored Jun 23, 2023
1 parent 52e9a98 commit aac1646
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
- name: Set up Go 1.20
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: "1.20"
id: go
- name: Get current date
id: date
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
sleep 30s
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl -n default create -f /root/pravega-operator/test/e2e/resources/bk/bk-cluster.yaml"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl -n default create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=testpravegaop --docker-password=c155d654-3c09-48aa-a62d-2d5178454784 --docker-email=prabhaker.saxena75g@gmail.com"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer);source /root/.gvm/scripts/gvm;gvm install go1.18 --binary;gvm use go1.18 --default;git config --global --add safe.directory /root/pravega-operator"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer);source /root/.gvm/scripts/gvm;gvm install go1.20 --binary;gvm use go1.20 --default;git config --global --add safe.directory /root/pravega-operator"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl create -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml"
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl create -f /root/pravega-operator/config/crd/bases/pravega.pravega.io_pravegaclusters.yaml"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
ARG DOCKER_REGISTRY
ARG GO_VERSION=1.18
ARG ALPINE_VERSION=3.16
ARG GO_VERSION=1.20
ARG ALPINE_VERSION=3.18

FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:${GO_VERSION}-alpine${ALPINE_VERSION} as go-builder

Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the pravegaclusters v1alpha1 API group
//+kubebuilder:object:generate=true
//+groupName=pravega.pravega.io
// +kubebuilder:object:generate=true
// +groupName=pravega.pravega.io
package v1alpha1

import (
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1beta1 contains API Schema definitions for the pravegaclusters v1beta1 API group
//+kubebuilder:object:generate=true
//+groupName=pravega.pravega.io
// +kubebuilder:object:generate=true
// +groupName=pravega.pravega.io
package v1beta1

import (
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/pravegacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,20 @@ func (p *PravegaCluster) ConfigMapNameForController() string {
return fmt.Sprintf("%s-pravega-controller", p.Name)
}

//to return name of segmentstore based on the version
// to return name of segmentstore based on the version
func (p *PravegaCluster) StatefulSetNameForSegmentstore() string {
if util.IsVersionBelow(p.Spec.Version, "0.7.0") {
return p.StatefulSetNameForSegmentstoreBelow07()
}
return p.StatefulSetNameForSegmentstoreAbove07()
}

//if version is above or equals to 0.7 this name will be assigned
// if version is above or equals to 0.7 this name will be assigned
func (p *PravegaCluster) StatefulSetNameForSegmentstoreAbove07() string {
return fmt.Sprintf("%s-%s", p.Name, p.Spec.Pravega.SegmentStoreStsNameSuffix)
}

//if version is below 0.7 this name will be assigned
// if version is below 0.7 this name will be assigned
func (p *PravegaCluster) StatefulSetNameForSegmentstoreBelow07() string {
return fmt.Sprintf("%s-pravega-segmentstore", p.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/pravegacluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ func (r *PravegaClusterReconciler) isRollbackTriggered(p *pravegav1beta1.Pravega
return false
}

//this function will return true only in case of upgrading from a version below 0.7 to pravega version 0.7 or later
// this function will return true only in case of upgrading from a version below 0.7 to pravega version 0.7 or later
func (r *PravegaClusterReconciler) IsClusterUpgradingTo07(p *pravegav1beta1.PravegaCluster) bool {
if !util.IsVersionBelow(p.Spec.Version, "0.7.0") && util.IsVersionBelow(p.Status.CurrentVersion, "0.7.0") {
return true
Expand Down
14 changes: 7 additions & 7 deletions controllers/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,15 @@ func (r *PravegaClusterReconciler) syncSegmentStoreVersion(p *pravegav1beta1.Pra
return false, nil
}

//this function is to check are we doing a rollback in case of a upgrade failure while upgrading from a version below 07 to a version above 07
// this function is to check are we doing a rollback in case of a upgrade failure while upgrading from a version below 07 to a version above 07
func (r *PravegaClusterReconciler) IsClusterRollbackingFrom07(p *pravegav1beta1.PravegaCluster) bool {
if util.IsVersionBelow(p.Spec.Version, "0.7.0") && r.IsAbove07STSPresent(p) {
return true
}
return false
}

//This function checks if stsabove07 exsists
// This function checks if stsabove07 exsists
func (r *PravegaClusterReconciler) IsAbove07STSPresent(p *pravegav1beta1.PravegaCluster) bool {
stsAbove07 := &appsv1.StatefulSet{}
name := p.StatefulSetNameForSegmentstoreAbove07()
Expand Down Expand Up @@ -491,7 +491,7 @@ func (r *PravegaClusterReconciler) deleteExternalServices(p *pravegav1beta1.Prav
return nil
}

//To handle upgrade/rollback from Pravega version < 0.7 to Pravega Version >= 0.7
// To handle upgrade/rollback from Pravega version < 0.7 to Pravega Version >= 0.7
func (r *PravegaClusterReconciler) syncSegmentStoreVersionTo07(p *pravegav1beta1.PravegaCluster) (synced bool, err error) {
p.Status.UpdateProgress(pravegav1beta1.UpdatingSegmentstoreReason, "0")
newsts := MakeSegmentStoreStatefulSet(p)
Expand Down Expand Up @@ -581,23 +581,23 @@ func (r *PravegaClusterReconciler) syncSegmentStoreVersionTo07(p *pravegav1beta1
return false, nil
}

//this function will check if furter increment or decrement in pods needed in case of rollback from version 0.7
// this function will check if furter increment or decrement in pods needed in case of rollback from version 0.7
func (r *PravegaClusterReconciler) rollbackConditionFor07(p *pravegav1beta1.PravegaCluster, sts *appsv1.StatefulSet) bool {
if r.IsClusterRollbackingFrom07(p) && sts.Status.ReadyReplicas == *sts.Spec.Replicas {
return true
}
return false
}

//this function will check if furter increment or decrement in pods needed in case of upgrade to version 0.7 or above
// this function will check if furter increment or decrement in pods needed in case of upgrade to version 0.7 or above
func (r *PravegaClusterReconciler) upgradeConditionFor07(p *pravegav1beta1.PravegaCluster, newsts *appsv1.StatefulSet, oldsts *appsv1.StatefulSet) bool {
if oldsts.Status.ReadyReplicas+newsts.Status.ReadyReplicas == p.Spec.Pravega.SegmentStoreReplicas && newsts.Status.ReadyReplicas == *newsts.Spec.Replicas {
return true
}
return false
}

//this function will increase two replicas of the new sts and delete 2 replicas of the old sts everytime it's called
// this function will increase two replicas of the new sts and delete 2 replicas of the old sts everytime it's called
func (r *PravegaClusterReconciler) scaleSegmentStoreSTS(p *pravegav1beta1.PravegaCluster, newsts *appsv1.StatefulSet, oldsts *appsv1.StatefulSet) error {
*newsts.Spec.Replicas = *newsts.Spec.Replicas + 2
err := r.Client.Update(context.TODO(), newsts)
Expand All @@ -612,7 +612,7 @@ func (r *PravegaClusterReconciler) scaleSegmentStoreSTS(p *pravegav1beta1.Praveg
return nil
}

//This function will remove the pvc's attached with the old sts and deleted it when old sts replicas have become 0
// This function will remove the pvc's attached with the old sts and deleted it when old sts replicas have become 0
func (r *PravegaClusterReconciler) transitionToNewSTS(p *pravegav1beta1.PravegaCluster, newsts *appsv1.StatefulSet, oldsts *appsv1.StatefulSet) error {
*newsts.Spec.Replicas = p.Spec.Pravega.SegmentStoreReplicas
err := r.Client.Update(context.TODO(), newsts)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pravega/pravega-operator

go 1.18
go 1.20

require (
github.com/hashicorp/go-version v1.2.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/pravegacluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func init() {
versionRegexp = regexp.MustCompile(MajorMinorVersionRegexp)
}

//function to check if v1 is below v2 or not
// function to check if v1 is below v2 or not
func IsVersionBelow(v1 string, v2 string) bool {
if v1 == "" {
return true
Expand Down

0 comments on commit aac1646

Please sign in to comment.