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

Upgrade to golang 1.12.6 #29

Merged
merged 2 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/frameworkbarrier/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE

FROM golang:alpine as builder
FROM golang:1.12.6-alpine as builder

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


FROM alpine:latest
FROM alpine:3.10.1

ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkbarrier

Expand Down
4 changes: 2 additions & 2 deletions build/frameworkcontroller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE

FROM golang:alpine as builder
FROM golang:1.12.6-alpine as builder

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


FROM alpine:latest
FROM alpine:3.10.1

ENV INSTALL_DIR=/opt/frameworkcontroller/frameworkcontroller

Expand Down
2 changes: 1 addition & 1 deletion cmd/frameworkbarrier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
package main

import (
"github.com/microsoft/frameworkcontroller/pkg/common"
"github.com/microsoft/frameworkcontroller/pkg/barrier"
"github.com/microsoft/frameworkcontroller/pkg/common"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/frameworkcontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
package main

import (
"github.com/microsoft/frameworkcontroller/pkg/common"
"github.com/microsoft/frameworkcontroller/pkg/controller"
"os"
"os/signal"
"syscall"
"github.com/microsoft/frameworkcontroller/pkg/common"
"github.com/microsoft/frameworkcontroller/pkg/controller"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion example/run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ docker run -e KUBECONFIG=/mnt/.kube/config \

**Prerequisite**

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.
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.

Then build the FrameworkController binary distribution:
```shell
Expand Down
30 changes: 15 additions & 15 deletions pkg/apis/frameworkcontroller/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
package v1

import (
"os"
"fmt"
"github.com/microsoft/frameworkcontroller/pkg/common"
"io/ioutil"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"github.com/microsoft/frameworkcontroller/pkg/common"
"os"
)

type Config struct {
Expand Down Expand Up @@ -112,34 +112,34 @@ func NewConfig() *Config {
errPrefix := "Config Validation Failed: "
if *c.WorkerNumber <= 0 {
panic(fmt.Errorf(errPrefix+
"WorkerNumber %v should be positive",
"WorkerNumber %v should be positive",
*c.WorkerNumber))
}
if *c.CRDEstablishedCheckIntervalSec < 1 {
panic(fmt.Errorf(errPrefix+
"CRDEstablishedCheckIntervalSec %v should not be less than 1",
"CRDEstablishedCheckIntervalSec %v should not be less than 1",
*c.CRDEstablishedCheckIntervalSec))
}
if *c.CRDEstablishedCheckTimeoutSec < 10 {
panic(fmt.Errorf(errPrefix+
"CRDEstablishedCheckTimeoutSec %v should not be less than 10",
"CRDEstablishedCheckTimeoutSec %v should not be less than 10",
*c.CRDEstablishedCheckTimeoutSec))
}
if *c.ObjectLocalCacheCreationTimeoutSec < 60 {
panic(fmt.Errorf(errPrefix+
"ObjectLocalCacheCreationTimeoutSec %v should not be less than 60",
"ObjectLocalCacheCreationTimeoutSec %v should not be less than 60",
*c.ObjectLocalCacheCreationTimeoutSec))
}
if *c.FrameworkMinRetryDelaySecForTransientConflictFailed < 0 {
panic(fmt.Errorf(errPrefix+
"FrameworkMinRetryDelaySecForTransientConflictFailed %v should not be negative",
"FrameworkMinRetryDelaySecForTransientConflictFailed %v should not be negative",
*c.FrameworkMinRetryDelaySecForTransientConflictFailed))
}
if *c.FrameworkMaxRetryDelaySecForTransientConflictFailed <
*c.FrameworkMinRetryDelaySecForTransientConflictFailed {
*c.FrameworkMinRetryDelaySecForTransientConflictFailed {
panic(fmt.Errorf(errPrefix+
"FrameworkMaxRetryDelaySecForTransientConflictFailed %v should not be less than "+
"FrameworkMinRetryDelaySecForTransientConflictFailed %v",
"FrameworkMaxRetryDelaySecForTransientConflictFailed %v should not be less than "+
"FrameworkMinRetryDelaySecForTransientConflictFailed %v",
*c.FrameworkMaxRetryDelaySecForTransientConflictFailed,
*c.FrameworkMinRetryDelaySecForTransientConflictFailed))
}
Expand Down Expand Up @@ -177,15 +177,15 @@ func initConfig() *Config {
return &c
}

func BuildKubeConfig(cConfig *Config) (*rest.Config) {
func BuildKubeConfig(cConfig *Config) *rest.Config {
kConfig, err := clientcmd.BuildConfigFromFlags(
*cConfig.KubeApiServerAddress, *cConfig.KubeConfigFilePath)
if err != nil {
panic(fmt.Errorf("Failed to build KubeConfig, please ensure "+
"config kubeApiServerAddress or config kubeConfigFilePath or "+
"${KUBE_APISERVER_ADDRESS} or ${KUBECONFIG} or ${HOME}/.kube/config or "+
"${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} is valid: "+
"Error: %v", err))
"config kubeApiServerAddress or config kubeConfigFilePath or "+
"${KUBE_APISERVER_ADDRESS} or ${KUBECONFIG} or ${HOME}/.kube/config or "+
"${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT} is valid: "+
"Error: %v", err))
}
return kConfig
}
2 changes: 1 addition & 1 deletion pkg/apis/frameworkcontroller/v1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
package v1

import (
"os"
core "k8s.io/api/core/v1"
"os"
)

///////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/frameworkcontroller/v1/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
package v1

import (
"github.com/microsoft/frameworkcontroller/pkg/common"
apiExtensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/microsoft/frameworkcontroller/pkg/common"
)

const (
Expand Down
42 changes: 21 additions & 21 deletions pkg/apis/frameworkcontroller/v1/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ package v1

import (
"fmt"
"strings"
"strconv"
"github.com/microsoft/frameworkcontroller/pkg/common"
log "github.com/sirupsen/logrus"
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/microsoft/frameworkcontroller/pkg/common"
"k8s.io/apimachinery/pkg/types"
"strconv"
"strings"
)

///////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -63,7 +63,7 @@ func GetFrameworkAttemptInstanceUID(frameworkAttemptID int32, configMapUID *type
}

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

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

func (f *Framework) IsCompleting() bool {
return f.Status.State == FrameworkAttemptDeletionPending ||
f.Status.State == FrameworkAttemptDeletionRequested ||
f.Status.State == FrameworkAttemptDeleting
f.Status.State == FrameworkAttemptDeletionRequested ||
f.Status.State == FrameworkAttemptDeleting
}

func (ts *TaskStatus) IsCompleting() bool {
return ts.State == TaskAttemptDeletionPending ||
ts.State == TaskAttemptDeletionRequested ||
ts.State == TaskAttemptDeleting
ts.State == TaskAttemptDeletionRequested ||
ts.State == TaskAttemptDeleting
}

func (ct CompletionType) IsSucceeded() bool {
Expand Down Expand Up @@ -419,7 +419,7 @@ func (f *Framework) NewFrameworkStatus() *FrameworkStatus {
}

func (f *Framework) NewFrameworkAttemptStatus(
frameworkAttemptID int32) FrameworkAttemptStatus {
frameworkAttemptID int32) FrameworkAttemptStatus {
return FrameworkAttemptStatus{
ID: frameworkAttemptID,
StartTime: meta.Now(),
Expand Down Expand Up @@ -461,7 +461,7 @@ func (f *Framework) NewTaskStatus(taskRoleName string, taskIndex int32) *TaskSta
}

func (f *Framework) NewTaskAttemptStatus(
taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus {
taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus {
return TaskAttemptStatus{
ID: taskAttemptID,
StartTime: meta.Now(),
Expand Down Expand Up @@ -510,16 +510,16 @@ func (rd RetryDecision) String() string {
}

func (rp RetryPolicySpec) ShouldRetry(
rps RetryPolicyStatus,
cs *CompletionStatus,
minDelaySecForTransientConflictFailed int64,
maxDelaySecForTransientConflictFailed int64) RetryDecision {
rps RetryPolicyStatus,
cs *CompletionStatus,
minDelaySecForTransientConflictFailed int64,
maxDelaySecForTransientConflictFailed int64) RetryDecision {
ct := cs.Type

// 0. Built-in Always-on RetryPolicy
if cs.Code == CompletionCodePodSpecInvalid ||
cs.Code == CompletionCodeStopFrameworkRequested ||
cs.Code == CompletionCodeFrameworkAttemptCompletion {
cs.Code == CompletionCodeStopFrameworkRequested ||
cs.Code == CompletionCodeFrameworkAttemptCompletion {
return RetryDecision{false, true, 0, cs.Diagnostics}
}

Expand Down Expand Up @@ -547,8 +547,8 @@ func (rp RetryPolicySpec) ShouldRetry(

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

// This is the only interface to modify TaskState
func (f *Framework) TransitionTaskState(
taskRoleName string, taskIndex int32, dstState TaskState) {
taskRoleName string, taskIndex int32, dstState TaskState) {
taskStatus := f.TaskStatus(taskRoleName, taskIndex)
srcState := taskStatus.State
if srcState == dstState {
Expand Down
16 changes: 8 additions & 8 deletions pkg/apis/frameworkcontroller/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ package v1

import (
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)

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

// +genclient
Expand Down Expand Up @@ -79,10 +79,10 @@ type FrameworkList struct {
// 2. Do not change the OwnerReferences of the managed ConfigMap and Pods.
//////////////////////////////////////////////////////////////////////////////////////////////////
type Framework struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata"`
Spec FrameworkSpec `json:"spec"`
Status *FrameworkStatus `json:"status"`
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata"`
Spec FrameworkSpec `json:"spec"`
Status *FrameworkStatus `json:"status"`
}

//////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading