Skip to content

Commit aac1646

Browse files
authoredJun 23, 2023
Issue 664: Updating go version to 1.20 (#665)
* Issue 664: Updating go version to 1.20 Signed-off-by: anisha.kj <[email protected]> * Updating go version in ci.yaml Signed-off-by: anisha.kj <[email protected]> * Commenting deletion of cluster for debugging Signed-off-by: anisha.kj <[email protected]> * Removing comments Signed-off-by: anisha.kj <[email protected]> --------- Signed-off-by: anisha.kj <[email protected]>
1 parent 52e9a98 commit aac1646

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed
 

‎.github/workflows/CI.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
check:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- name: Set up Go 1.18
20+
- name: Set up Go 1.20
2121
uses: actions/setup-go@v2
2222
with:
23-
go-version: 1.18
23+
go-version: "1.20"
2424
id: go
2525
- name: Get current date
2626
id: date
@@ -112,7 +112,7 @@ jobs:
112112
sleep 30s
113113
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl -n default create -f /root/pravega-operator/test/e2e/resources/bk/bk-cluster.yaml"
114114
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"
115-
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"
115+
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"
116116
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl create -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml"
117117
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml"
118118
ssh -o StrictHostKeyChecking=no root@$CLUSTER_IP "kubectl create -f /root/pravega-operator/config/crd/bases/pravega.pravega.io_pravegaclusters.yaml"

‎Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# http://www.apache.org/licenses/LICENSE-2.0
99
#
1010
ARG DOCKER_REGISTRY
11-
ARG GO_VERSION=1.18
12-
ARG ALPINE_VERSION=3.16
11+
ARG GO_VERSION=1.20
12+
ARG ALPINE_VERSION=3.18
1313

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

‎api/v1alpha1/groupversion_info.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ limitations under the License.
1515
*/
1616

1717
// Package v1alpha1 contains API Schema definitions for the pravegaclusters v1alpha1 API group
18-
//+kubebuilder:object:generate=true
19-
//+groupName=pravega.pravega.io
18+
// +kubebuilder:object:generate=true
19+
// +groupName=pravega.pravega.io
2020
package v1alpha1
2121

2222
import (

‎api/v1beta1/groupversion_info.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ limitations under the License.
1515
*/
1616

1717
// Package v1beta1 contains API Schema definitions for the pravegaclusters v1beta1 API group
18-
//+kubebuilder:object:generate=true
19-
//+groupName=pravega.pravega.io
18+
// +kubebuilder:object:generate=true
19+
// +groupName=pravega.pravega.io
2020
package v1beta1
2121

2222
import (

‎api/v1beta1/pravegacluster_types.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -306,20 +306,20 @@ func (p *PravegaCluster) ConfigMapNameForController() string {
306306
return fmt.Sprintf("%s-pravega-controller", p.Name)
307307
}
308308

309-
//to return name of segmentstore based on the version
309+
// to return name of segmentstore based on the version
310310
func (p *PravegaCluster) StatefulSetNameForSegmentstore() string {
311311
if util.IsVersionBelow(p.Spec.Version, "0.7.0") {
312312
return p.StatefulSetNameForSegmentstoreBelow07()
313313
}
314314
return p.StatefulSetNameForSegmentstoreAbove07()
315315
}
316316

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

322-
//if version is below 0.7 this name will be assigned
322+
// if version is below 0.7 this name will be assigned
323323
func (p *PravegaCluster) StatefulSetNameForSegmentstoreBelow07() string {
324324
return fmt.Sprintf("%s-pravega-segmentstore", p.Name)
325325
}

‎controllers/pravegacluster_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ func (r *PravegaClusterReconciler) isRollbackTriggered(p *pravegav1beta1.Pravega
10311031
return false
10321032
}
10331033

1034-
//this function will return true only in case of upgrading from a version below 0.7 to pravega version 0.7 or later
1034+
// this function will return true only in case of upgrading from a version below 0.7 to pravega version 0.7 or later
10351035
func (r *PravegaClusterReconciler) IsClusterUpgradingTo07(p *pravegav1beta1.PravegaCluster) bool {
10361036
if !util.IsVersionBelow(p.Spec.Version, "0.7.0") && util.IsVersionBelow(p.Status.CurrentVersion, "0.7.0") {
10371037
return true

‎controllers/upgrade.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,15 @@ func (r *PravegaClusterReconciler) syncSegmentStoreVersion(p *pravegav1beta1.Pra
424424
return false, nil
425425
}
426426

427-
//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
427+
// 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
428428
func (r *PravegaClusterReconciler) IsClusterRollbackingFrom07(p *pravegav1beta1.PravegaCluster) bool {
429429
if util.IsVersionBelow(p.Spec.Version, "0.7.0") && r.IsAbove07STSPresent(p) {
430430
return true
431431
}
432432
return false
433433
}
434434

435-
//This function checks if stsabove07 exsists
435+
// This function checks if stsabove07 exsists
436436
func (r *PravegaClusterReconciler) IsAbove07STSPresent(p *pravegav1beta1.PravegaCluster) bool {
437437
stsAbove07 := &appsv1.StatefulSet{}
438438
name := p.StatefulSetNameForSegmentstoreAbove07()
@@ -491,7 +491,7 @@ func (r *PravegaClusterReconciler) deleteExternalServices(p *pravegav1beta1.Prav
491491
return nil
492492
}
493493

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

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

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

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

615-
//This function will remove the pvc's attached with the old sts and deleted it when old sts replicas have become 0
615+
// This function will remove the pvc's attached with the old sts and deleted it when old sts replicas have become 0
616616
func (r *PravegaClusterReconciler) transitionToNewSTS(p *pravegav1beta1.PravegaCluster, newsts *appsv1.StatefulSet, oldsts *appsv1.StatefulSet) error {
617617
*newsts.Spec.Replicas = p.Spec.Pravega.SegmentStoreReplicas
618618
err := r.Client.Update(context.TODO(), newsts)

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/pravega/pravega-operator
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/hashicorp/go-version v1.2.0

‎pkg/util/pravegacluster.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func init() {
3636
versionRegexp = regexp.MustCompile(MajorMinorVersionRegexp)
3737
}
3838

39-
//function to check if v1 is below v2 or not
39+
// function to check if v1 is below v2 or not
4040
func IsVersionBelow(v1 string, v2 string) bool {
4141
if v1 == "" {
4242
return true

0 commit comments

Comments
 (0)
Please sign in to comment.