mirror of https://github.com/kubernetes/kops.git
				
				
				
			Merge pull request #6798 from justinsb/golang_1_11_5
Switch to golang 1.11.5
This commit is contained in:
		
						commit
						732121d226
					
				
							
								
								
									
										10
									
								
								.travis.yml
								
								
								
								
							
							
						
						
									
										10
									
								
								.travis.yml
								
								
								
								
							| 
						 | 
				
			
			@ -3,12 +3,12 @@ os:
 | 
			
		|||
  - linux
 | 
			
		||||
  - osx
 | 
			
		||||
go:
 | 
			
		||||
  # 1.8 & 1.9 are now best-effort; we recommend 1.10; k8s apimachinery relies on 1.10
 | 
			
		||||
  # - 1.8
 | 
			
		||||
  # - 1.9
 | 
			
		||||
  - "1.10"
 | 
			
		||||
  # 1.10 is now best-effort; we recommend 1.11; 1.12 is in the wild but not the k8s recommended version
 | 
			
		||||
  #- "1.10" gofmt changes mean this fails testing
 | 
			
		||||
  - "1.11"
 | 
			
		||||
  - "1.12"
 | 
			
		||||
 | 
			
		||||
go_import_path: k8s.io/kops
 | 
			
		||||
 | 
			
		||||
script:
 | 
			
		||||
  - make ci
 | 
			
		||||
  - make travis-ci
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,3 +21,10 @@ go_library(
 | 
			
		|||
    ],
 | 
			
		||||
    importpath = "k8s.io/kops",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
load("@io_k8s_repo_infra//defs:run_in_workspace.bzl", "workspace_binary")
 | 
			
		||||
 | 
			
		||||
workspace_binary(
 | 
			
		||||
    name = "gofmt",
 | 
			
		||||
    cmd = "@go_sdk//:bin/gofmt",
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										27
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										27
									
								
								Makefile
								
								
								
								
							| 
						 | 
				
			
			@ -21,7 +21,7 @@ GCS_URL=$(GCS_LOCATION:gs://%=https://storage.googleapis.com/%)
 | 
			
		|||
LATEST_FILE?=latest-ci.txt
 | 
			
		||||
GOPATH_1ST:=$(shell go env | grep GOPATH | cut -f 2 -d \")
 | 
			
		||||
UNIQUE:=$(shell date +%s)
 | 
			
		||||
GOVERSION=1.10.8
 | 
			
		||||
GOVERSION=1.11.5
 | 
			
		||||
BUILD=$(GOPATH_1ST)/src/k8s.io/kops/.build
 | 
			
		||||
LOCAL=$(BUILD)/local
 | 
			
		||||
BINDATA_TARGETS=upup/models/bindata.go
 | 
			
		||||
| 
						 | 
				
			
			@ -500,20 +500,7 @@ dep-ensure: dep-prereqs
 | 
			
		|||
 | 
			
		||||
.PHONY: gofmt
 | 
			
		||||
gofmt:
 | 
			
		||||
	gofmt -w -s channels/
 | 
			
		||||
	gofmt -w -s cloudmock/
 | 
			
		||||
	gofmt -w -s cmd/
 | 
			
		||||
	gofmt -w -s examples/
 | 
			
		||||
	gofmt -w -s nodeup/
 | 
			
		||||
	gofmt -w -s util/
 | 
			
		||||
	gofmt -w -s upup/pkg/
 | 
			
		||||
	gofmt -w -s pkg/
 | 
			
		||||
	gofmt -w -s tests/
 | 
			
		||||
	gofmt -w -s protokube/cmd
 | 
			
		||||
	gofmt -w -s protokube/pkg
 | 
			
		||||
	gofmt -w -s protokube/tests
 | 
			
		||||
	gofmt -w -s dns-controller/cmd
 | 
			
		||||
	gofmt -w -s dns-controller/pkg
 | 
			
		||||
	find -name "*.go" | grep -v vendor | xargs bazel run //:gofmt -- -w -s
 | 
			
		||||
 | 
			
		||||
.PHONY: goimports
 | 
			
		||||
goimports:
 | 
			
		||||
| 
						 | 
				
			
			@ -562,7 +549,8 @@ verify-gendocs: ${KOPS}
 | 
			
		|||
.PHONY: verify-bazel
 | 
			
		||||
verify-bazel:
 | 
			
		||||
	hack/verify-bazel.sh
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# ci target is for developers, it aims to cover all the CI jobs
 | 
			
		||||
# verify-gendocs will call kops target
 | 
			
		||||
# verify-package has to be after verify-gendoc, because with .gitignore for federation bindata
 | 
			
		||||
# it bombs in travis. verify-gendoc generates the bindata file.
 | 
			
		||||
| 
						 | 
				
			
			@ -570,6 +558,13 @@ verify-bazel:
 | 
			
		|||
ci: govet verify-gofmt verify-boilerplate verify-bazel verify-misspelling nodeup examples test | verify-gendocs verify-packages verify-apimachinery
 | 
			
		||||
	echo "Done!"
 | 
			
		||||
 | 
			
		||||
# travis-ci is the target that travis-ci calls
 | 
			
		||||
# we skip tasks that rely on bazel and are covered by other jobs
 | 
			
		||||
#  verify-gofmt: uses bazel, covered by pull-kops-verify-gofmt
 | 
			
		||||
.PHONY: travis-ci
 | 
			
		||||
travis-ci: govet verify-boilerplate verify-bazel verify-misspelling nodeup examples test | verify-gendocs verify-packages verify-apimachinery
 | 
			
		||||
	echo "Done!"
 | 
			
		||||
 | 
			
		||||
.PHONY: pr
 | 
			
		||||
pr:
 | 
			
		||||
	@echo "Test passed!"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_to
 | 
			
		|||
go_rules_dependencies()
 | 
			
		||||
 | 
			
		||||
go_register_toolchains(
 | 
			
		||||
    go_version = "1.10.8",
 | 
			
		||||
    go_version = "1.11.5",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
 | 
			
		||||
| 
						 | 
				
			
			@ -113,3 +113,10 @@ http_file(
 | 
			
		|||
    urls = ["https://kubeupv2.s3.amazonaws.com/kops/1.11.1/linux/amd64/utils.tar.gz"],
 | 
			
		||||
    sha256 = "0e685eb751a32f782705311049b2592c4724add6f19ffdad1e7ce4f55816d7d8",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
git_repository(
 | 
			
		||||
    name = "io_k8s_repo_infra",
 | 
			
		||||
    commit = "4ce715fbe67d8fbed05ec2bb47a148e754100a4b",
 | 
			
		||||
    remote = "https://github.com/kubernetes/repo-infra.git",
 | 
			
		||||
    shallow_since = "1517262872 -0800",
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,13 +58,13 @@ func (m *MockAutoscaling) CreateAutoScalingGroup(input *autoscaling.CreateAutoSc
 | 
			
		|||
		DefaultCooldown:      input.DefaultCooldown,
 | 
			
		||||
		DesiredCapacity:      input.DesiredCapacity,
 | 
			
		||||
		// EnabledMetrics:          input.EnabledMetrics,
 | 
			
		||||
		HealthCheckGracePeriod:  input.HealthCheckGracePeriod,
 | 
			
		||||
		HealthCheckType:         input.HealthCheckType,
 | 
			
		||||
		Instances:               []*autoscaling.Instance{},
 | 
			
		||||
		LaunchConfigurationName: input.LaunchConfigurationName,
 | 
			
		||||
		LoadBalancerNames:       input.LoadBalancerNames,
 | 
			
		||||
		MaxSize:                 input.MaxSize,
 | 
			
		||||
		MinSize:                 input.MinSize,
 | 
			
		||||
		HealthCheckGracePeriod:           input.HealthCheckGracePeriod,
 | 
			
		||||
		HealthCheckType:                  input.HealthCheckType,
 | 
			
		||||
		Instances:                        []*autoscaling.Instance{},
 | 
			
		||||
		LaunchConfigurationName:          input.LaunchConfigurationName,
 | 
			
		||||
		LoadBalancerNames:                input.LoadBalancerNames,
 | 
			
		||||
		MaxSize:                          input.MaxSize,
 | 
			
		||||
		MinSize:                          input.MinSize,
 | 
			
		||||
		NewInstancesProtectedFromScaleIn: input.NewInstancesProtectedFromScaleIn,
 | 
			
		||||
		PlacementGroup:                   input.PlacementGroup,
 | 
			
		||||
		// Status:                           input.Status,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@
 | 
			
		|||
 | 
			
		||||
FROM alpine:3.8
 | 
			
		||||
 | 
			
		||||
ARG GO_VERSION=1.10.8
 | 
			
		||||
ARG GO_VERSION=1.11.5
 | 
			
		||||
 | 
			
		||||
# KOPS_GITISH: Modify to build at an explicit tag/gitish
 | 
			
		||||
ARG KOPS_GITISH=release
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,9 +16,9 @@
 | 
			
		|||
 | 
			
		||||
. $(dirname "${BASH_SOURCE}")/common.sh
 | 
			
		||||
 | 
			
		||||
GOFMT="gofmt -s -w"
 | 
			
		||||
GOFMT="bazel run //:gofmt -- -s -w"
 | 
			
		||||
 | 
			
		||||
bad_files=$(git ls-files "*.go" | grep -v vendor | xargs -I {} $GOFMT -l {})
 | 
			
		||||
bad_files=$(git ls-files "*.go" | grep -v vendor | xargs $GOFMT -l)
 | 
			
		||||
if [[ -n "${bad_files}" ]]; then
 | 
			
		||||
  echo "FAIL: '$GOFMT' needs to be run on the following files: "
 | 
			
		||||
  echo "${bad_files}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ RUN apt-get update && apt-get install --yes --reinstall lsb-base \
 | 
			
		|||
  && rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
# Install golang
 | 
			
		||||
RUN curl -L https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz | tar zx -C /usr/local
 | 
			
		||||
RUN curl -L https://storage.googleapis.com/golang/go1.11.5.linux-amd64.tar.gz | tar zx -C /usr/local
 | 
			
		||||
ENV PATH $PATH:/usr/local/go/bin
 | 
			
		||||
 | 
			
		||||
COPY onbuild.sh /onbuild.sh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ RUN apt-get update && apt-get install --yes --reinstall lsb-base \
 | 
			
		|||
  && rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
# Install golang
 | 
			
		||||
RUN curl -L https://storage.googleapis.com/golang/go1.10.3.linux-amd64.tar.gz | tar zx -C /usr/local
 | 
			
		||||
RUN curl -L https://storage.googleapis.com/golang/go1.11.5.linux-amd64.tar.gz | tar zx -C /usr/local
 | 
			
		||||
ENV PATH $PATH:/usr/local/go/bin
 | 
			
		||||
 | 
			
		||||
COPY onbuild.sh /onbuild.sh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ func makeKubeconfig(ctx context.Context, config *Config, token string) ([]byte,
 | 
			
		|||
			{
 | 
			
		||||
				Name: clusterName,
 | 
			
		||||
				Cluster: v1.Cluster{
 | 
			
		||||
					Server: config.KubeAPI,
 | 
			
		||||
					Server:                   config.KubeAPI,
 | 
			
		||||
					CertificateAuthorityData: content,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -590,7 +590,7 @@ func (b *KubeletBuilder) buildMasterKubeletKubeconfig() (*nodetasks.File, error)
 | 
			
		|||
 | 
			
		||||
	template := &x509.Certificate{
 | 
			
		||||
		BasicConstraintsValid: true,
 | 
			
		||||
		IsCA: false,
 | 
			
		||||
		IsCA:                  false,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template.Subject = pkix.Name{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ func Test_SharedGroups(t *testing.T) {
 | 
			
		|||
func makeTestInstanceGroupSec(role kops.InstanceGroupRole, secGroup *string) *kops.InstanceGroup {
 | 
			
		||||
	return &kops.InstanceGroup{
 | 
			
		||||
		Spec: kops.InstanceGroupSpec{
 | 
			
		||||
			Role: role,
 | 
			
		||||
			Role:                  role,
 | 
			
		||||
			SecurityGroupOverride: secGroup,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ func TestGenerateCertificate(t *testing.T) {
 | 
			
		|||
		KeyUsage:              x509.KeyUsageCertSign | x509.KeyUsageCRLSign,
 | 
			
		||||
		ExtKeyUsage:           []x509.ExtKeyUsage{},
 | 
			
		||||
		BasicConstraintsValid: true,
 | 
			
		||||
		IsCA: true,
 | 
			
		||||
		IsCA:                  true,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cert, err := SignNewCertificate(key, template, nil, nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -417,16 +417,16 @@ func (c *ApplyClusterCmd) Run() error {
 | 
			
		|||
				"iamRolePolicy":          &awstasks.IAMRolePolicy{},
 | 
			
		||||
 | 
			
		||||
				// VPC / Networking
 | 
			
		||||
				"dhcpOptions":           &awstasks.DHCPOptions{},
 | 
			
		||||
				"internetGateway":       &awstasks.InternetGateway{},
 | 
			
		||||
				"route":                 &awstasks.Route{},
 | 
			
		||||
				"routeTable":            &awstasks.RouteTable{},
 | 
			
		||||
				"routeTableAssociation": &awstasks.RouteTableAssociation{},
 | 
			
		||||
				"securityGroup":         &awstasks.SecurityGroup{},
 | 
			
		||||
				"securityGroupRule":     &awstasks.SecurityGroupRule{},
 | 
			
		||||
				"subnet":                &awstasks.Subnet{},
 | 
			
		||||
				"vpc":                   &awstasks.VPC{},
 | 
			
		||||
				"ngw":                   &awstasks.NatGateway{},
 | 
			
		||||
				"dhcpOptions":                &awstasks.DHCPOptions{},
 | 
			
		||||
				"internetGateway":            &awstasks.InternetGateway{},
 | 
			
		||||
				"route":                      &awstasks.Route{},
 | 
			
		||||
				"routeTable":                 &awstasks.RouteTable{},
 | 
			
		||||
				"routeTableAssociation":      &awstasks.RouteTableAssociation{},
 | 
			
		||||
				"securityGroup":              &awstasks.SecurityGroup{},
 | 
			
		||||
				"securityGroupRule":          &awstasks.SecurityGroupRule{},
 | 
			
		||||
				"subnet":                     &awstasks.Subnet{},
 | 
			
		||||
				"vpc":                        &awstasks.VPC{},
 | 
			
		||||
				"ngw":                        &awstasks.NatGateway{},
 | 
			
		||||
				"vpcDHDCPOptionsAssociation": &awstasks.VPCDHCPOptionsAssociation{},
 | 
			
		||||
 | 
			
		||||
				// ELB
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,13 +169,13 @@ func (t *LaunchTemplate) Find(c *fi.Context) (*LaunchTemplate, error) {
 | 
			
		|||
	glog.V(3).Infof("found existing LaunchTemplate: %s", fi.StringValue(lt.LaunchTemplateName))
 | 
			
		||||
 | 
			
		||||
	actual := &LaunchTemplate{
 | 
			
		||||
		AssociatePublicIP:  fi.Bool(false),
 | 
			
		||||
		ID:                 lt.LaunchTemplateName,
 | 
			
		||||
		ImageID:            lt.LaunchTemplateData.ImageId,
 | 
			
		||||
		InstanceMonitoring: fi.Bool(false),
 | 
			
		||||
		InstanceType:       lt.LaunchTemplateData.InstanceType,
 | 
			
		||||
		Lifecycle:          t.Lifecycle,
 | 
			
		||||
		Name:               t.Name,
 | 
			
		||||
		AssociatePublicIP:      fi.Bool(false),
 | 
			
		||||
		ID:                     lt.LaunchTemplateName,
 | 
			
		||||
		ImageID:                lt.LaunchTemplateData.ImageId,
 | 
			
		||||
		InstanceMonitoring:     fi.Bool(false),
 | 
			
		||||
		InstanceType:           lt.LaunchTemplateData.InstanceType,
 | 
			
		||||
		Lifecycle:              t.Lifecycle,
 | 
			
		||||
		Name:                   t.Name,
 | 
			
		||||
		RootVolumeOptimization: lt.LaunchTemplateData.EbsOptimized,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -293,7 +293,7 @@ func buildCertificateTemplateForType(certificateType string) (*x509.Certificate,
 | 
			
		|||
 | 
			
		||||
	template := &x509.Certificate{
 | 
			
		||||
		BasicConstraintsValid: true,
 | 
			
		||||
		IsCA: false,
 | 
			
		||||
		IsCA:                  false,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tokens := strings.Split(certificateType, ",")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,7 +144,7 @@ func BuildCAX509Template() *x509.Certificate {
 | 
			
		|||
		KeyUsage:              x509.KeyUsageCertSign | x509.KeyUsageCRLSign,
 | 
			
		||||
		ExtKeyUsage:           []x509.ExtKeyUsage{},
 | 
			
		||||
		BasicConstraintsValid: true,
 | 
			
		||||
		IsCA: true,
 | 
			
		||||
		IsCA:                  true,
 | 
			
		||||
	}
 | 
			
		||||
	return template
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue