Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 2caad5b

Browse files
authored
Upgrade to golang 1.12.6 (#29)
1 parent 243996c commit 2caad5b

File tree

16 files changed

+206
-207
lines changed

16 files changed

+206
-207
lines changed

build/frameworkbarrier/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE
2222

23-
FROM golang:alpine as builder
23+
FROM golang:1.12.6-alpine as builder
2424

2525
ENV PROJECT_DIR=${GOPATH}/src/github.com/microsoft/frameworkcontroller
2626
ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkbarrier
@@ -32,7 +32,7 @@ RUN ${PROJECT_DIR}/build/frameworkbarrier/go-build.sh && \
3232
mv ${PROJECT_DIR}/dist/frameworkbarrier/* ${INSTALL_DIR}
3333

3434

35-
FROM alpine:latest
35+
FROM alpine:3.10.1
3636

3737
ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkbarrier
3838

build/frameworkcontroller/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE
2222

23-
FROM golang:alpine as builder
23+
FROM golang:1.12.6-alpine as builder
2424

2525
ENV PROJECT_DIR=${GOPATH}/src/github.com/microsoft/frameworkcontroller
2626
ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkcontroller
@@ -32,7 +32,7 @@ RUN ${PROJECT_DIR}/build/frameworkcontroller/go-build.sh && \
3232
mv ${PROJECT_DIR}/dist/frameworkcontroller/* ${INSTALL_DIR}
3333

3434

35-
FROM alpine:latest
35+
FROM alpine:3.10.1
3636

3737
ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkcontroller
3838

cmd/frameworkbarrier/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
package main
2424

2525
import (
26-
"github.com/microsoft/frameworkcontroller/pkg/common"
2726
"github.com/microsoft/frameworkcontroller/pkg/barrier"
27+
"github.com/microsoft/frameworkcontroller/pkg/common"
2828
)
2929

3030
func init() {

cmd/frameworkcontroller/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
package main
2424

2525
import (
26+
"github.com/microsoft/frameworkcontroller/pkg/common"
27+
"github.com/microsoft/frameworkcontroller/pkg/controller"
2628
"os"
2729
"os/signal"
2830
"syscall"
29-
"github.com/microsoft/frameworkcontroller/pkg/common"
30-
"github.com/microsoft/frameworkcontroller/pkg/controller"
3131
)
3232

3333
func init() {

example/run/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ docker run -e KUBECONFIG=/mnt/.kube/config \
9797

9898
**Prerequisite**
9999

100-
Ensure you have installed [Golang 1.10 or above](https://golang.org/doc/install#install) and the [${GOPATH}](https://golang.org/doc/code.html#GOPATH) is valid.
100+
Ensure you have installed [Golang 1.12.6 or above](https://golang.org/doc/install#install) and the [${GOPATH}](https://golang.org/doc/code.html#GOPATH) is valid.
101101

102102
Then build the FrameworkController binary distribution:
103103
```shell

pkg/apis/frameworkcontroller/v1/config.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
package v1
2424

2525
import (
26-
"os"
2726
"fmt"
27+
"github.com/microsoft/frameworkcontroller/pkg/common"
2828
"io/ioutil"
2929
"k8s.io/client-go/rest"
3030
"k8s.io/client-go/tools/clientcmd"
31-
"github.com/microsoft/frameworkcontroller/pkg/common"
31+
"os"
3232
)
3333

3434
type Config struct {
@@ -112,34 +112,34 @@ func NewConfig() *Config {
112112
errPrefix := "Config Validation Failed: "
113113
if *c.WorkerNumber <= 0 {
114114
panic(fmt.Errorf(errPrefix+
115-
"WorkerNumber %v should be positive",
115+
"WorkerNumber %v should be positive",
116116
*c.WorkerNumber))
117117
}
118118
if *c.CRDEstablishedCheckIntervalSec < 1 {
119119
panic(fmt.Errorf(errPrefix+
120-
"CRDEstablishedCheckIntervalSec %v should not be less than 1",
120+
"CRDEstablishedCheckIntervalSec %v should not be less than 1",
121121
*c.CRDEstablishedCheckIntervalSec))
122122
}
123123
if *c.CRDEstablishedCheckTimeoutSec < 10 {
124124
panic(fmt.Errorf(errPrefix+
125-
"CRDEstablishedCheckTimeoutSec %v should not be less than 10",
125+
"CRDEstablishedCheckTimeoutSec %v should not be less than 10",
126126
*c.CRDEstablishedCheckTimeoutSec))
127127
}
128128
if *c.ObjectLocalCacheCreationTimeoutSec < 60 {
129129
panic(fmt.Errorf(errPrefix+
130-
"ObjectLocalCacheCreationTimeoutSec %v should not be less than 60",
130+
"ObjectLocalCacheCreationTimeoutSec %v should not be less than 60",
131131
*c.ObjectLocalCacheCreationTimeoutSec))
132132
}
133133
if *c.FrameworkMinRetryDelaySecForTransientConflictFailed < 0 {
134134
panic(fmt.Errorf(errPrefix+
135-
"FrameworkMinRetryDelaySecForTransientConflictFailed %v should not be negative",
135+
"FrameworkMinRetryDelaySecForTransientConflictFailed %v should not be negative",
136136
*c.FrameworkMinRetryDelaySecForTransientConflictFailed))
137137
}
138138
if *c.FrameworkMaxRetryDelaySecForTransientConflictFailed <
139-
*c.FrameworkMinRetryDelaySecForTransientConflictFailed {
139+
*c.FrameworkMinRetryDelaySecForTransientConflictFailed {
140140
panic(fmt.Errorf(errPrefix+
141-
"FrameworkMaxRetryDelaySecForTransientConflictFailed %v should not be less than "+
142-
"FrameworkMinRetryDelaySecForTransientConflictFailed %v",
141+
"FrameworkMaxRetryDelaySecForTransientConflictFailed %v should not be less than "+
142+
"FrameworkMinRetryDelaySecForTransientConflictFailed %v",
143143
*c.FrameworkMaxRetryDelaySecForTransientConflictFailed,
144144
*c.FrameworkMinRetryDelaySecForTransientConflictFailed))
145145
}
@@ -177,15 +177,15 @@ func initConfig() *Config {
177177
return &c
178178
}
179179

180-
func BuildKubeConfig(cConfig *Config) (*rest.Config) {
180+
func BuildKubeConfig(cConfig *Config) *rest.Config {
181181
kConfig, err := clientcmd.BuildConfigFromFlags(
182182
*cConfig.KubeApiServerAddress, *cConfig.KubeConfigFilePath)
183183
if err != nil {
184184
panic(fmt.Errorf("Failed to build KubeConfig, please ensure "+
185-
"config kubeApiServerAddress or config kubeConfigFilePath or "+
186-
"${KUBE_APISERVER_ADDRESS} or ${KUBECONFIG} or ${HOME}/.kube/config or "+
187-
"${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} is valid: "+
188-
"Error: %v", err))
185+
"config kubeApiServerAddress or config kubeConfigFilePath or "+
186+
"${KUBE_APISERVER_ADDRESS} or ${KUBECONFIG} or ${HOME}/.kube/config or "+
187+
"${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} is valid: "+
188+
"Error: %v", err))
189189
}
190190
return kConfig
191191
}

pkg/apis/frameworkcontroller/v1/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
package v1
2424

2525
import (
26-
"os"
2726
core "k8s.io/api/core/v1"
27+
"os"
2828
)
2929

3030
///////////////////////////////////////////////////////////////////////////////////////

pkg/apis/frameworkcontroller/v1/crd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
package v1
2424

2525
import (
26+
"github.com/microsoft/frameworkcontroller/pkg/common"
2627
apiExtensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
2728
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
28-
"github.com/microsoft/frameworkcontroller/pkg/common"
2929
)
3030

3131
const (

pkg/apis/frameworkcontroller/v1/funcs.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ package v1
2424

2525
import (
2626
"fmt"
27-
"strings"
28-
"strconv"
27+
"github.com/microsoft/frameworkcontroller/pkg/common"
2928
log "github.com/sirupsen/logrus"
3029
core "k8s.io/api/core/v1"
31-
"k8s.io/apimachinery/pkg/types"
3230
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
33-
"github.com/microsoft/frameworkcontroller/pkg/common"
31+
"k8s.io/apimachinery/pkg/types"
32+
"strconv"
33+
"strings"
3434
)
3535

3636
///////////////////////////////////////////////////////////////////////////////////////
@@ -63,7 +63,7 @@ func GetFrameworkAttemptInstanceUID(frameworkAttemptID int32, configMapUID *type
6363
}
6464

6565
func SplitFrameworkAttemptInstanceUID(frameworkAttemptInstanceUID *types.UID) (
66-
frameworkAttemptID int32, configMapUID *types.UID) {
66+
frameworkAttemptID int32, configMapUID *types.UID) {
6767
parts := strings.Split(string(*frameworkAttemptInstanceUID), "_")
6868
i, err := strconv.ParseInt(parts[0], 10, 32)
6969
if err != nil {
@@ -79,7 +79,7 @@ func GetTaskAttemptInstanceUID(taskAttemptID int32, podUID *types.UID) *types.UI
7979
}
8080

8181
func SplitTaskAttemptInstanceUID(taskAttemptInstanceUID *types.UID) (
82-
taskAttemptID int32, podUID *types.UID) {
82+
taskAttemptID int32, podUID *types.UID) {
8383
parts := strings.Split(string(*taskAttemptInstanceUID), "_")
8484
i, err := strconv.ParseInt(parts[0], 10, 32)
8585
if err != nil {
@@ -193,14 +193,14 @@ func (ts *TaskStatus) IsRunning() bool {
193193

194194
func (f *Framework) IsCompleting() bool {
195195
return f.Status.State == FrameworkAttemptDeletionPending ||
196-
f.Status.State == FrameworkAttemptDeletionRequested ||
197-
f.Status.State == FrameworkAttemptDeleting
196+
f.Status.State == FrameworkAttemptDeletionRequested ||
197+
f.Status.State == FrameworkAttemptDeleting
198198
}
199199

200200
func (ts *TaskStatus) IsCompleting() bool {
201201
return ts.State == TaskAttemptDeletionPending ||
202-
ts.State == TaskAttemptDeletionRequested ||
203-
ts.State == TaskAttemptDeleting
202+
ts.State == TaskAttemptDeletionRequested ||
203+
ts.State == TaskAttemptDeleting
204204
}
205205

206206
func (ct CompletionType) IsSucceeded() bool {
@@ -419,7 +419,7 @@ func (f *Framework) NewFrameworkStatus() *FrameworkStatus {
419419
}
420420

421421
func (f *Framework) NewFrameworkAttemptStatus(
422-
frameworkAttemptID int32) FrameworkAttemptStatus {
422+
frameworkAttemptID int32) FrameworkAttemptStatus {
423423
return FrameworkAttemptStatus{
424424
ID: frameworkAttemptID,
425425
StartTime: meta.Now(),
@@ -461,7 +461,7 @@ func (f *Framework) NewTaskStatus(taskRoleName string, taskIndex int32) *TaskSta
461461
}
462462

463463
func (f *Framework) NewTaskAttemptStatus(
464-
taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus {
464+
taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus {
465465
return TaskAttemptStatus{
466466
ID: taskAttemptID,
467467
StartTime: meta.Now(),
@@ -510,16 +510,16 @@ func (rd RetryDecision) String() string {
510510
}
511511

512512
func (rp RetryPolicySpec) ShouldRetry(
513-
rps RetryPolicyStatus,
514-
cs *CompletionStatus,
515-
minDelaySecForTransientConflictFailed int64,
516-
maxDelaySecForTransientConflictFailed int64) RetryDecision {
513+
rps RetryPolicyStatus,
514+
cs *CompletionStatus,
515+
minDelaySecForTransientConflictFailed int64,
516+
maxDelaySecForTransientConflictFailed int64) RetryDecision {
517517
ct := cs.Type
518518

519519
// 0. Built-in Always-on RetryPolicy
520520
if cs.Code == CompletionCodePodSpecInvalid ||
521-
cs.Code == CompletionCodeStopFrameworkRequested ||
522-
cs.Code == CompletionCodeFrameworkAttemptCompletion {
521+
cs.Code == CompletionCodeStopFrameworkRequested ||
522+
cs.Code == CompletionCodeFrameworkAttemptCompletion {
523523
return RetryDecision{false, true, 0, cs.Diagnostics}
524524
}
525525

@@ -547,8 +547,8 @@ func (rp RetryPolicySpec) ShouldRetry(
547547

548548
// 2. NormalRetryPolicy
549549
if (rp.MaxRetryCount == ExtendedUnlimitedValue) ||
550-
(ct.IsFailed() && rp.MaxRetryCount == UnlimitedValue) ||
551-
(ct.IsFailed() && rps.AccountableRetriedCount < rp.MaxRetryCount) {
550+
(ct.IsFailed() && rp.MaxRetryCount == UnlimitedValue) ||
551+
(ct.IsFailed() && rps.AccountableRetriedCount < rp.MaxRetryCount) {
552552
return RetryDecision{true, true, 0, fmt.Sprintf(
553553
"AccountableRetriedCount %v has not reached MaxRetryCount %v",
554554
rps.AccountableRetriedCount, rp.MaxRetryCount)}
@@ -584,7 +584,7 @@ func (f *Framework) TransitionFrameworkState(dstState FrameworkState) {
584584

585585
// This is the only interface to modify TaskState
586586
func (f *Framework) TransitionTaskState(
587-
taskRoleName string, taskIndex int32, dstState TaskState) {
587+
taskRoleName string, taskIndex int32, dstState TaskState) {
588588
taskStatus := f.TaskStatus(taskRoleName, taskIndex)
589589
srcState := taskStatus.State
590590
if srcState == dstState {

pkg/apis/frameworkcontroller/v1/types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ package v1
2424

2525
import (
2626
core "k8s.io/api/core/v1"
27-
"k8s.io/apimachinery/pkg/types"
2827
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
28+
"k8s.io/apimachinery/pkg/types"
2929
)
3030

3131
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3232
type FrameworkList struct {
33-
meta.TypeMeta `json:",inline"`
34-
meta.ListMeta `json:"metadata"`
35-
Items []Framework `json:"items"`
33+
meta.TypeMeta `json:",inline"`
34+
meta.ListMeta `json:"metadata"`
35+
Items []Framework `json:"items"`
3636
}
3737

3838
// +genclient
@@ -79,10 +79,10 @@ type FrameworkList struct {
7979
// 2. Do not change the OwnerReferences of the managed ConfigMap and Pods.
8080
//////////////////////////////////////////////////////////////////////////////////////////////////
8181
type Framework struct {
82-
meta.TypeMeta `json:",inline"`
83-
meta.ObjectMeta `json:"metadata"`
84-
Spec FrameworkSpec `json:"spec"`
85-
Status *FrameworkStatus `json:"status"`
82+
meta.TypeMeta `json:",inline"`
83+
meta.ObjectMeta `json:"metadata"`
84+
Spec FrameworkSpec `json:"spec"`
85+
Status *FrameworkStatus `json:"status"`
8686
}
8787

8888
//////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)