Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to golang1.15.0 #2166

Closed
wants to merge 2 commits into from
Closed

Update to golang1.15.0 #2166

wants to merge 2 commits into from

Conversation

warmchang
Copy link
Contributor

@warmchang warmchang commented Aug 26, 2020

Proposed changes

Update the golang compiler to 1.15.0 (go1.14 is being skipped by the k/k community)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Verification

$ ./dist/artifacts/k3s --version
k3s version v1.18.8+k3s-d03351df-dirty (d03351df)
$ ./dist/artifacts/k3s server &
[1] 2263
$ INFO[0000] Preparing data dir /var/lib/rancher/k3s/data/e3127e60c3b3e0ecec03f03adc71d616fa04bc52d0db70b2cdaec50a2869c6b2
INFO[2020-08-26T07:35:59.596796295Z] Starting k3s v1.18.8+k3s-d03351df-dirty (d03351df)
INFO[2020-08-26T07:35:59.630763829Z] Kine listening on unix://kine.sock
INFO[2020-08-26T07:35:59.643631928Z] certificate CN=system:admin,O=system:masters signed by CN=k3s-client-ca@1598427359: notBefore=2020-08-26 07:35:59 +0000 UTC notAfter=2021-08-26 07:35:59 +0000 UTC
INFO[2020-08-26T07:35:59.644215689Z] certificate CN=system:kube-controller-manager signed by CN=k3s-client-ca@1598427359: notBefore=2020-08-26 07:35:59 +0000 UTCnotAfter=2021-08-26 07:35:59 +0000 UTC
INFO[2020-08-26T07:35:59.644695877Z] certificate CN=system:kube-scheduler signed by CN=k3s-client-ca@1598427359: notBefore=2020-08-26 07:35:59 +0000 UTC notAfter=2021-08-26 07:35:59 +0000 UTC
...

$
$ ./dist/artifacts/k3s kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8+k3s-d03351df-dirty", GitCommit:"d03351dfe2f39dea2916a33bdcea0c7feff82a4c", GitTreeState:"dirty", BuildDate:"2020-08-26T07:27:52Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8+k3s-d03351df-dirty", GitCommit:"d03351dfe2f39dea2916a33bdcea0c7feff82a4c", GitTreeState:"dirty", BuildDate:"2020-08-26T07:27:52Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
$
$ ./dist/artifacts/k3s kubectl get all -A
NAMESPACE     NAME                                          READY   STATUS      RESTARTS   AGE
kube-system   pod/metrics-server-7566d596c8-4fnjr           1/1     Running     0          74s
kube-system   pod/local-path-provisioner-5597b6889b-fq2v7   1/1     Running     0          74s
kube-system   pod/coredns-6c7f74c576-cw2rt                  1/1     Running     0          74s
kube-system   pod/helm-install-traefik-4845h                0/1     Completed   0          75s
kube-system   pod/svclb-traefik-bkxzl                       2/2     Running     0          56s
kube-system   pod/traefik-758cd5fc85-95qwj                  1/1     Running     0          56s

NAMESPACE     NAME                         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
default       service/kubernetes           ClusterIP      10.43.0.1       <none>        443/TCP                      89s
kube-system   service/kube-dns             ClusterIP      10.43.0.10      <none>        53/UDP,53/TCP,9153/TCP       86s
kube-system   service/metrics-server       ClusterIP      10.43.202.236   <none>        443/TCP                      86s
kube-system   service/traefik-prometheus   ClusterIP      10.43.199.126   <none>        9100/TCP                     56s
kube-system   service/traefik              LoadBalancer   10.43.183.138   172.17.0.70   80:32165/TCP,443:31070/TCP   56s

NAMESPACE     NAME                           DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
kube-system   daemonset.apps/svclb-traefik   1         1         1       1            1           <none>          56s

NAMESPACE     NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
kube-system   deployment.apps/metrics-server           1/1     1            1           86s
kube-system   deployment.apps/local-path-provisioner   1/1     1            1           86s
kube-system   deployment.apps/coredns                  1/1     1            1           86s
kube-system   deployment.apps/traefik                  1/1     1            1           56s

NAMESPACE     NAME                                                DESIRED   CURRENT   READY   AGE
kube-system   replicaset.apps/metrics-server-7566d596c8           1         1         1       74s
kube-system   replicaset.apps/local-path-provisioner-5597b6889b   1         1         1       74s
kube-system   replicaset.apps/coredns-6c7f74c576                  1         1         1       74s
kube-system   replicaset.apps/traefik-758cd5fc85                  1         1         1       56s

NAMESPACE     NAME                             COMPLETIONS   DURATION   AGE
kube-system   job.batch/helm-install-traefik   1/1           20s        85s
$

Linked Issues

#2086

Further comments

go1.15 is awesome, it reduces binary sizes ~10% compared to go1.13.

  • Build with go1.15.0
$ tree -alph ./dist/
./dist/
└── [drwxr-xr-x 4.0K]  artifacts
    ├── [-rwxr-xr-x  73M]  k3s
    ├── [-rw------- 351M]  k3s-airgap-images-amd64.tar
    └── [-rw-r--r--  272]  k3s-images.txt

1 directory, 3 files
$ tree -alph ./build/
./build/
├── [drwxr-xr-x 4.0K]  data
├── [drwxr-xr-x 4.0K]  out
│   └── [-rw-r--r--  46M]  data.tar.gz
└── [drwxr-xr-x 4.0K]  static
    └── [drwxr-xr-x 4.0K]  charts
        └── [-rw-r--r--  27K]  traefik-1.81.0.tgz

4 directories, 2 files
$
  • Build with go1.13.4
$ tree -alph ./dist/
./dist/
└── [drwxr-xr-x 4.0K]  artifacts
    ├── [-rwxr-xr-x  81M]  k3s
    ├── [-rw------- 351M]  k3s-airgap-images-amd64.tar
    └── [-rw-r--r--  272]  k3s-images.txt

1 directory, 3 files
$ tree -alph ./build/
./build/
├── [drwxr-xr-x 4.0K]  data
├── [drwxr-xr-x 4.0K]  out
│   └── [-rw-r--r--  50M]  data.tar.gz
└── [drwxr-xr-x 4.0K]  static
    └── [drwxr-xr-x 4.0K]  charts
        └── [-rw-r--r--  27K]  traefik-1.81.0.tgz

4 directories, 2 files
$ 

@warmchang warmchang requested a review from a team as a code owner August 26, 2020 06:56
Signed-off-by: William Zhang <warmchang@outlook.com>
Signed-off-by: William Zhang <warmchang@outlook.com>

del tempfile

Signed-off-by: William Zhang <warmchang@outlook.com>
@warmchang
Copy link
Contributor Author

I made the local build by clasic method ( ./scripts/download && ./scripts/build && ./scripts/package-cli ), all looks good.

But the pipeline is failing, I have no idea about this. 😕

$ go version
go version go1.15 linux/amd64
$ uname -a
Linux minikube 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$
$ git log --oneline -3
4f5f20e9a3 (HEAD -> localtest) Update go.mod & vendor/modules.txt
d03351dfe2 Update to golang 1.15
c4ac620b8b (origin/master, origin/HEAD, master) Merge pull request #2159 from brandond/config_file_rename
$
$ tree -alph ./dist/
./dist/
└── [drwxr-xr-x 4.0K]  artifacts
    └── [-rwxr-xr-x  80M]  k3s

1 directory, 1 file
$ tree -alph ./build/
./build/
├── [drwxr-xr-x 4.0K]  data
│   └── [-rw-r--r--  54M]  32f45b9c085a9a36b6ece58e6dfa3fbbaadbb824f063e921f28d1535f454e766.tgz
├── [drwxr-xr-x 4.0K]  out
│   └── [-rw-r--r--  54M]  data.tar.gz
└── [drwxr-xr-x 4.0K]  static
    └── [drwxr-xr-x 4.0K]  charts
        └── [-rw-r--r--  27K]  traefik-1.81.0.tgz

4 directories, 3 files
$
$ ./dist/artifacts/k3s --version
k3s version v1.18.8+k3s-4f5f20e9 (4f5f20e9)
$ ./dist/artifacts/k3s kubectl version
INFO[0000] Preparing data dir /var/lib/rancher/k3s/data/32f45b9c085a9a36b6ece58e6dfa3fbbaadbb824f063e921f28d1535f454e766
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8-k3s1", GitCommit:"b86d0e4a07fd882c2f9718f4e82b06dfd4b55195", GitTreeState:"clean", BuildDate:"2020-08-13T18:53:34Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
$

@brandond
Copy link
Contributor

Thanks for the PR! We will likely follow upstream to golang 1.15 for k3s 1.19, but for now we're going to stick with golang 1.13 for the release-1.x branches (and master, as long as it's still on k/k 1.18). It is unlikely that we would merge this at the moment, since we have a large volume of work queued up in the background to support the 1.19 release that will include something similar to this.

@warmchang
Copy link
Contributor Author

Thanks for the PR! We will likely follow upstream to golang 1.15 for k3s 1.19, but for now we're going to stick with golang 1.13 for the release-1.x branches (and master, as long as it's still on k/k 1.18). It is unlikely that we would merge this at the moment, since we have a large volume of work queued up in the background to support the 1.19 release that will include something similar to this.

Got it, and we also need to keep an eye on that the k/k upstream backport go1.15 updates to v1.18 & v1.17 branches.
FYI: kubernetes/kubernetes#94037

@erikwilson
Copy link
Contributor

Thanks for the PR @warmchang! This was also updated in #2098 as part of the 1.19 update, so closing this.

@erikwilson erikwilson closed this Aug 29, 2020
@warmchang warmchang deleted the golang1.15 branch August 31, 2020 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants