diff --git a/go.mod b/go.mod index cdf39997df..de896669b8 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( cloud.google.com/go/storage v1.22.0 - contrib.go.opencensus.io/exporter/stackdriver v0.13.11 + contrib.go.opencensus.io/exporter/stackdriver v0.13.12 github.com/Delta456/box-cli-maker/v2 v2.2.2 github.com/GoogleCloudPlatform/docker-credential-gcr v0.0.0-20210713212222-faed5e8b8ca2 github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.4.0 @@ -81,16 +81,16 @@ require ( golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 golang.org/x/text v0.3.7 gonum.org/v1/plot v0.11.0 - google.golang.org/api v0.74.0 + google.golang.org/api v0.75.0 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.23.5 - k8s.io/apimachinery v0.23.5 - k8s.io/client-go v0.23.5 + k8s.io/api v0.23.6 + k8s.io/apimachinery v0.23.6 + k8s.io/client-go v0.23.6 k8s.io/cluster-bootstrap v0.0.0 - k8s.io/component-base v0.23.5 + k8s.io/component-base v0.23.6 k8s.io/klog/v2 v2.60.1 - k8s.io/kubectl v0.23.5 + k8s.io/kubectl v0.23.6 k8s.io/utils v0.0.0-20211116205334-6203023598ed libvirt.org/go/libvirt v1.8002.0 sigs.k8s.io/sig-storage-lib-external-provisioner/v6 v6.3.0 @@ -104,7 +104,7 @@ require ( require ( cloud.google.com/go v0.100.2 // indirect - cloud.google.com/go/compute v1.5.0 // indirect + cloud.google.com/go/compute v1.6.0 // indirect cloud.google.com/go/iam v0.3.0 // indirect cloud.google.com/go/monitoring v1.1.0 // indirect cloud.google.com/go/trace v1.2.0 // indirect @@ -180,6 +180,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.28.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect + github.com/prometheus/prometheus v2.5.0+incompatible // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect @@ -200,7 +201,7 @@ require ( golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac // indirect + google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 // indirect google.golang.org/grpc v1.45.0 // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index f880d1bc11..c169f4b34d 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,9 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0 h1:b1zWmYuuHz7gO9kDcM/EpHGr06UgsYNRpNJzI2kFiLM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0 h1:XdQIN5mdPTSBVwSIVDuY5e8ZzVAccsHvD3qTEz4zIps= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -64,8 +65,8 @@ cloud.google.com/go/storage v1.22.0/go.mod h1:GbaLEoMqbVm6sx3Z0R++gSiBlgMv6yUi2q cloud.google.com/go/trace v1.0.0/go.mod h1:4iErSByzxkyHWzzlAj63/Gmjz0NH1ASqhJguHpGcr6A= cloud.google.com/go/trace v1.2.0 h1:oIaB4KahkIUOpLSAAjEJ8y2desbjY/x/RfP4O3KAtTI= cloud.google.com/go/trace v1.2.0/go.mod h1:Wc8y/uYyOhPy12KEnXG9XGrvfMz5F5SrYecQlbW1rwM= -contrib.go.opencensus.io/exporter/stackdriver v0.13.11 h1:YzmWJ2OT2K3ouXyMm5FmFQPoDs5TfLjx6Xn5x5CLN0I= -contrib.go.opencensus.io/exporter/stackdriver v0.13.11/go.mod h1:I5htMbyta491eUxufwwZPQdcKvvgzMB4O9ni41YnIM8= +contrib.go.opencensus.io/exporter/stackdriver v0.13.12 h1:bjBKzIf7/TAkxd7L2utGaLM78bmUWlCval5K9UeElbY= +contrib.go.opencensus.io/exporter/stackdriver v0.13.12/go.mod h1:mmxnWlrvrFdpiOHOhxBaVi1rkc0WOqhgfknj4Yg0SeQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik= @@ -986,6 +987,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/prometheus v2.5.0+incompatible h1:7QPitgO2kOFG8ecuRn9O/4L9+10He72rVRJvMXrE9Hg= +github.com/prometheus/prometheus v2.5.0+incompatible/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= @@ -1609,8 +1612,9 @@ google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tD google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0 h1:ExR2D+5TYIrMphWgs5JCgwRhEDlPDXXrLwHHMgPHTXE= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0 h1:0AYh/ae6l9TDUvIQrDw5QRpM100P6oHgD+o3dYHMzJg= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1699,8 +1703,10 @@ google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac h1:qSNTkEN+L2mvWcLgJOR+8bdHX9rN/IdU3A1Ghpfb1Rg= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1811,34 +1817,34 @@ k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.22.4/go.mod h1:Rgs+9gIGYC5laXQSZZ9JqT5NevNgoGiOdVWi1BAB3qk= -k8s.io/api v0.23.5 h1:zno3LUiMubxD/V1Zw3ijyKO3wxrhbUF1Ck+VjBvfaoA= -k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8= +k8s.io/api v0.23.6 h1:yOK34wbYECH4RsJbQ9sfkFK3O7f/DUHRlzFehkqZyVw= +k8s.io/api v0.23.6/go.mod h1:1kFaYxGCFHYp3qd6a85DAj/yW8aVD6XLZMqJclkoi9g= k8s.io/apimachinery v0.19.1/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.22.4/go.mod h1:yU6oA6Gnax9RrxGzVvPFFJ+mpnW6PBSqp0sx0I0HHW0= -k8s.io/apimachinery v0.23.5 h1:Va7dwhp8wgkUPWsEXk6XglXWU4IKYLKNlv8VkX7SDM0= -k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= +k8s.io/apimachinery v0.23.6 h1:RH1UweWJkWNTlFx0D8uxOpaU1tjIOvVVWV/bu5b3/NQ= +k8s.io/apimachinery v0.23.6/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= -k8s.io/cli-runtime v0.23.5/go.mod h1:oY6QDF2qo9xndSq32tqcmRp2UyXssdGrLfjAVymgbx4= +k8s.io/cli-runtime v0.23.6/go.mod h1:0Z3VR/HRIFKiLzKIAkm1mPtcH98GT/fXu2IU0E4vFmw= k8s.io/client-go v0.19.1/go.mod h1:AZOIVSI9UUtQPeJD3zJFp15CEhSjRgAuQP5PWRJrCIQ= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= -k8s.io/client-go v0.23.5 h1:zUXHmEuqx0RY4+CsnkOn5l0GU+skkRXKGJrhmE2SLd8= -k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4= +k8s.io/client-go v0.23.6 h1:7h4SctDVQAQbkHQnR4Kzi7EyUyvla5G1pFWf4+Od7hQ= +k8s.io/client-go v0.23.6/go.mod h1:Umt5icFOMLV/+qbtZ3PR0D+JA6lvvb3syzodv4irpK4= k8s.io/cluster-bootstrap v0.22.4 h1:2ZhV/1K4GiCrnmDHHbBnN3bERWn+Nxrtxmxp6uYYThI= k8s.io/cluster-bootstrap v0.22.4/go.mod h1:fTQZ6u9G6fg2LHhB8nEgZLnXIhCDSRYuLUUS5pgW8RY= -k8s.io/code-generator v0.23.5/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk= +k8s.io/code-generator v0.23.6/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/component-base v0.23.5 h1:8qgP5R6jG1BBSXmRYW+dsmitIrpk8F/fPEvgDenMCCE= -k8s.io/component-base v0.23.5/go.mod h1:c5Nq44KZyt1aLl0IpHX82fhsn84Sb0jjzwjpcA42bY0= -k8s.io/component-helpers v0.23.5/go.mod h1:5riXJgjTIs+ZB8xnf5M2anZ8iQuq37a0B/0BgoPQuSM= +k8s.io/component-base v0.23.6 h1:8dhVZ4VrRcNdV2EGjl8tj8YOHwX6ysgCGMJ2Oyy0NW8= +k8s.io/component-base v0.23.6/go.mod h1:FGMPeMrjYu0UZBSAFcfloVDplj9IvU+uRMTOdE23Fj0= +k8s.io/component-helpers v0.23.6/go.mod h1:kgvl6wvnYg9oebklLPpbW8UhvAZ9Qds26/RANEbny/8= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= @@ -1859,10 +1865,10 @@ k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2R k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 h1:E3J9oCLlaobFUqsjG9DfKbP2BmgwBL2p7pn0A3dG9W4= k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= -k8s.io/kubectl v0.23.5 h1:DmDULqCaF4qstj0Im143XmncvqWtJxHzK8IrW2BzlU0= -k8s.io/kubectl v0.23.5/go.mod h1:lLgw7cVY8xbd7o637vOXPca/w6HC205KsPCRDYRCxwE= +k8s.io/kubectl v0.23.6 h1:ajzrqj88GqlH/gpscMCts+mKNeSJprpkWJEHO8CR2Ss= +k8s.io/kubectl v0.23.6/go.mod h1:mMtJhc2QtQiSfvIQoMEUIjGHtZuP4uxMy/ees6j6zx8= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/metrics v0.23.5/go.mod h1:WNAtV2a5BYbmDS8+7jSqYYV6E3efuGTpIwJ8PTD1wgs= +k8s.io/metrics v0.23.6/go.mod h1:Fm9VzVMZ7KVEEeLStF2y3XogfcDwpGyI15o1xB6PbYk= k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= diff --git a/gui/cluster.cpp b/gui/cluster.cpp index da68e039d3..6e10a5473c 100644 --- a/gui/cluster.cpp +++ b/gui/cluster.cpp @@ -69,7 +69,7 @@ int ClusterModel::rowCount(const QModelIndex &) const int ClusterModel::columnCount(const QModelIndex &) const { - return 6; + return 7; } static QStringList binaryAbbrs = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB" }; @@ -81,7 +81,7 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const if (index.row() >= clusterList.size()) return QVariant(); - if (index.column() >= 6) + if (index.column() >= 7) return QVariant(); if (role == Qt::TextAlignmentRole) { @@ -97,6 +97,8 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const case 4: // fall-through case 5: + // fall-through + case 6: return QVariant(Qt::AlignHCenter | Qt::AlignVCenter); } } @@ -112,8 +114,10 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const case 3: return cluster.containerRuntime(); case 4: - return QString::number(cluster.cpus()); + return cluster.k8sVersion(); case 5: + return QString::number(cluster.cpus()); + case 6: return QString::number(cluster.memory()); } } @@ -136,8 +140,10 @@ QVariant ClusterModel::headerData(int section, Qt::Orientation orientation, int case 3: return tr("Container Runtime"); case 4: - return tr("CPUs"); + return tr("Kubernetes Version"); case 5: + return tr("CPUs"); + case 6: return tr("Memory (MB)"); } } diff --git a/gui/cluster.h b/gui/cluster.h index 7e4b5fb82c..b61496457a 100644 --- a/gui/cluster.h +++ b/gui/cluster.h @@ -64,7 +64,13 @@ class Cluster public: Cluster() : Cluster("") { } Cluster(const QString &name) - : m_name(name), m_status(""), m_driver(""), m_container_runtime(""), m_cpus(0), m_memory(0) + : m_name(name), + m_status(""), + m_driver(""), + m_container_runtime(""), + m_k8s_version(""), + m_cpus(0), + m_memory(0) { } @@ -75,16 +81,20 @@ public: void setDriver(QString driver) { m_driver = driver; } QString containerRuntime() const { return m_container_runtime; } void setContainerRuntime(QString containerRuntime) { m_container_runtime = containerRuntime; } + QString k8sVersion() const { return m_k8s_version; } + void setK8sVersion(QString k8sVersion) { m_k8s_version = k8sVersion; } int cpus() const { return m_cpus; } void setCpus(int cpus) { m_cpus = cpus; } int memory() const { return m_memory; } void setMemory(int memory) { m_memory = memory; } + bool isEmpty() { return m_name.isEmpty(); } private: QString m_name; QString m_status; QString m_driver; QString m_container_runtime; + QString m_k8s_version; int m_cpus; int m_memory; }; diff --git a/gui/window.cpp b/gui/window.cpp index 6ee3dee6a1..a05aff9d19 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -129,6 +129,7 @@ void Window::createBasicView() { basicStartButton = new QPushButton(tr("Start")); basicStopButton = new QPushButton(tr("Stop")); + basicPauseButton = new QPushButton(tr("Pause")); basicDeleteButton = new QPushButton(tr("Delete")); basicRefreshButton = new QPushButton(tr("Refresh")); basicSSHButton = new QPushButton(tr("SSH")); @@ -140,6 +141,7 @@ void Window::createBasicView() catBox->setLayout(buttonLayout); buttonLayout->addWidget(basicStartButton); buttonLayout->addWidget(basicStopButton); + buttonLayout->addWidget(basicPauseButton); buttonLayout->addWidget(basicDeleteButton); buttonLayout->addWidget(basicRefreshButton); buttonLayout->addWidget(basicSSHButton); @@ -152,6 +154,7 @@ void Window::createBasicView() connect(basicDashboardButton, &QAbstractButton::clicked, this, &Window::dashboardBrowser); connect(basicStartButton, &QAbstractButton::clicked, this, &Window::startSelectedMinikube); connect(basicStopButton, &QAbstractButton::clicked, this, &Window::stopMinikube); + connect(basicPauseButton, &QAbstractButton::clicked, this, &Window::pauseOrUnpauseMinikube); connect(basicDeleteButton, &QAbstractButton::clicked, this, &Window::deleteMinikube); connect(basicRefreshButton, &QAbstractButton::clicked, this, &Window::updateClusters); connect(advancedViewButton, &QAbstractButton::clicked, this, &Window::toAdvancedView); @@ -177,6 +180,7 @@ void Window::createAdvancedView() connect(dashboardButton, &QAbstractButton::clicked, this, &Window::dashboardBrowser); connect(startButton, &QAbstractButton::clicked, this, &Window::startSelectedMinikube); connect(stopButton, &QAbstractButton::clicked, this, &Window::stopMinikube); + connect(pauseButton, &QAbstractButton::clicked, this, &Window::pauseOrUnpauseMinikube); connect(deleteButton, &QAbstractButton::clicked, this, &Window::deleteMinikube); connect(refreshButton, &QAbstractButton::clicked, this, &Window::updateClusters); connect(createButton, &QAbstractButton::clicked, this, &Window::initMachine); @@ -227,6 +231,15 @@ void Window::createActions() quitAction = new QAction(tr("&Quit"), this); connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit); + + startAction = new QAction(tr("Start"), this); + connect(startAction, &QAction::triggered, this, &Window::startSelectedMinikube); + + pauseAction = new QAction(tr("Pause"), this); + connect(pauseAction, &QAction::triggered, this, &Window::pauseOrUnpauseMinikube); + + stopAction = new QAction(tr("Stop"), this); + connect(stopAction, &QAction::triggered, this, &Window::stopMinikube); } void Window::iconActivated(QSystemTrayIcon::ActivationReason reason) @@ -271,6 +284,10 @@ static QString minikubePath() void Window::createTrayIcon() { trayIconMenu = new QMenu(this); + trayIconMenu->addAction(startAction); + trayIconMenu->addAction(pauseAction); + trayIconMenu->addAction(stopAction); + trayIconMenu->addSeparator(); trayIconMenu->addAction(minimizeAction); trayIconMenu->addAction(restoreAction); trayIconMenu->addSeparator(); @@ -298,29 +315,43 @@ void Window::startMinikube(QStringList moreArgs) void Window::startSelectedMinikube() { - QStringList args = { "-p", selectedCluster() }; + QStringList args = { "-p", selectedClusterName() }; return startMinikube(args); } void Window::stopMinikube() { - QStringList args = { "stop", "-p", selectedCluster() }; + QStringList args = { "stop", "-p", selectedClusterName() }; + sendMinikubeCommand(args); + updateClusters(); +} + +void Window::pauseMinikube() +{ + QStringList args = { "pause", "-p", selectedClusterName() }; + sendMinikubeCommand(args); + updateClusters(); +} + +void Window::unpauseMinikube() +{ + QStringList args = { "unpause", "-p", selectedClusterName() }; sendMinikubeCommand(args); updateClusters(); } void Window::deleteMinikube() { - QStringList args = { "delete", "-p", selectedCluster() }; + QStringList args = { "delete", "-p", selectedClusterName() }; sendMinikubeCommand(args); updateClusters(); } void Window::updateClusters() { - QString cluster = selectedCluster(); + QString cluster = selectedClusterName(); clusterModel->setClusters(getClusters()); - setSelectedCluster(cluster); + setSelectedClusterName(cluster); updateButtons(); } @@ -397,10 +428,14 @@ Cluster Window::createClusterObject(QJsonObject obj) QString containerRuntime = k8sConfig["ContainerRuntime"].toString(); cluster.setContainerRuntime(containerRuntime); } + if (k8sConfig.contains("KubernetesVersion")) { + QString k8sVersion = k8sConfig["KubernetesVersion"].toString(); + cluster.setK8sVersion(k8sVersion); + } return cluster; } -QString Window::selectedCluster() +QString Window::selectedClusterName() { if (isBasicView) { return "minikube"; @@ -413,7 +448,7 @@ QString Window::selectedCluster() return variant.toString(); } -void Window::setSelectedCluster(QString cluster) +void Window::setSelectedClusterName(QString cluster) { QAbstractItemModel *model = clusterListView->model(); QModelIndex start = model->index(0, 0); @@ -441,12 +476,14 @@ void Window::createClusterGroupBox() clusterListView->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents); clusterListView->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents); clusterListView->horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents); - setSelectedCluster("default"); + clusterListView->horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + setSelectedClusterName("default"); connect(clusterListView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateButtons())); startButton = new QPushButton(tr("Start")); stopButton = new QPushButton(tr("Stop")); + pauseButton = new QPushButton(tr("Pause")); deleteButton = new QPushButton(tr("Delete")); refreshButton = new QPushButton(tr("Refresh")); createButton = new QPushButton(tr("Create")); @@ -464,6 +501,7 @@ void Window::createClusterGroupBox() QHBoxLayout *bottomButtonLayout = new QHBoxLayout; bottomButtonLayout->addWidget(startButton); bottomButtonLayout->addWidget(stopButton); + bottomButtonLayout->addWidget(pauseButton); bottomButtonLayout->addWidget(deleteButton); bottomButtonLayout->addWidget(sshButton); bottomButtonLayout->addWidget(dashboardButton); @@ -477,73 +515,94 @@ void Window::createClusterGroupBox() void Window::updateButtons() { + Cluster cluster = selectedCluster(); if (isBasicView) { - updateBasicButtons(); + updateBasicButtons(cluster); } else { - updateAdvancedButtons(); + updateAdvancedButtons(cluster); } + updateTrayActions(cluster); } -void Window::updateBasicButtons() +void Window::updateTrayActions(Cluster cluster) { - Cluster *cluster = new Cluster(); - ClusterList list = getClusters(); - for (int i = 0; i < list.length(); i++) { - Cluster curr = list[i]; - if (curr.name() != "minikube") { - continue; - } - cluster = &curr; - break; + bool isRunning = cluster.status() == "Running"; + bool isPaused = cluster.status() == "Paused"; + pauseAction->setEnabled(isRunning || isPaused); + stopAction->setEnabled(isRunning || isPaused); + QString pauseLabel = tr("Pause"); + if (isPaused) { + pauseLabel = tr("Unpause"); } - bool exists = cluster->name() == "minikube"; - bool isRunning = exists && cluster->status() == "Running"; - basicStartButton->setEnabled(isRunning == false); - basicStopButton->setEnabled(isRunning == true); - basicDeleteButton->setEnabled(exists == true); - basicDashboardButton->setEnabled(isRunning == true); -#if __linux__ - basicSSHButton->setEnabled(isRunning == true); -#else - basicSSHButton->setEnabled(false); -#endif + pauseAction->setText(pauseLabel); } -void Window::updateAdvancedButtons() +Cluster Window::selectedCluster() { - QString cluster = selectedCluster(); - if (cluster.isEmpty()) { - startButton->setEnabled(false); - stopButton->setEnabled(false); - deleteButton->setEnabled(false); - sshButton->setEnabled(false); - dashboardButton->setEnabled(false); - return; + QString clusterName = selectedClusterName(); + if (clusterName.isEmpty()) { + return Cluster(); } - deleteButton->setEnabled(true); - Cluster clusterHash = getClusterHash()[cluster]; - if (clusterHash.status() == "Running") { - startButton->setEnabled(false); - stopButton->setEnabled(true); -#if __linux__ - sshButton->setEnabled(true); -#endif - dashboardButton->setEnabled(true); - } else { - startButton->setEnabled(true); - stopButton->setEnabled(false); - } -} - -ClusterHash Window::getClusterHash() -{ ClusterList clusters = getClusters(); ClusterHash clusterHash; for (int i = 0; i < clusters.size(); i++) { Cluster cluster = clusters.at(i); clusterHash[cluster.name()] = cluster; } - return clusterHash; + return clusterHash[clusterName]; +} + +void Window::updateBasicButtons(Cluster cluster) +{ + bool exists = !cluster.isEmpty(); + bool isRunning = cluster.status() == "Running"; + bool isPaused = cluster.status() == "Paused"; + basicStopButton->setEnabled(isRunning || isPaused); + basicPauseButton->setEnabled(isRunning || isPaused); + basicDeleteButton->setEnabled(exists); + basicDashboardButton->setEnabled(isRunning); +#if __linux__ + basicSSHButton->setEnabled(exists); +#else + basicSSHButton->setEnabled(false); +#endif + QString pauseLabel = tr("Pause"); + if (isPaused) { + pauseLabel = tr("Unpause"); + } + basicPauseButton->setText(pauseLabel); +} + +void Window::pauseOrUnpauseMinikube() +{ + Cluster cluster = selectedCluster(); + if (cluster.status() == "Paused") { + unpauseMinikube(); + return; + } + pauseMinikube(); +} + +void Window::updateAdvancedButtons(Cluster cluster) +{ + bool exists = !cluster.isEmpty(); + bool isRunning = cluster.status() == "Running"; + bool isPaused = cluster.status() == "Paused"; + startButton->setEnabled(exists); + stopButton->setEnabled(isRunning || isPaused); + pauseButton->setEnabled(isRunning || isPaused); + deleteButton->setEnabled(exists); + dashboardButton->setEnabled(isRunning); +#if __linux__ + sshButton->setEnabled(exists); +#else + sshButton->setEnabled(false); +#endif + QString pauseLabel = tr("Pause"); + if (isPaused) { + pauseLabel = tr("Unpause"); + } + pauseButton->setText(pauseLabel); } bool Window::sendMinikubeCommand(QStringList cmds) @@ -721,13 +780,12 @@ void Window::outputFailedStart(QString text) errorMessage->setStyleSheet("background-color:white;"); createLabel("Link to documentation", url, &form, true); createLabel("Link to related issue", issues, &form, true); - // Enabling once https://github.com/kubernetes/minikube/issues/13925 is fixed - // QLabel *fileLabel = new QLabel(this); - // fileLabel->setOpenExternalLinks(true); - // fileLabel->setWordWrap(true); - // QString logFile = QDir::homePath() + "/.minikube/logs/lastStart.txt"; - // fileLabel->setText("View log file"); - // form.addRow(fileLabel); + QLabel *fileLabel = new QLabel(this); + fileLabel->setOpenExternalLinks(true); + fileLabel->setWordWrap(true); + QString logFile = QDir::homePath() + "/.minikube/logs/lastStart.txt"; + fileLabel->setText("View log file"); + form.addRow(fileLabel); QDialogButtonBox buttonBox(Qt::Horizontal, &dialog); buttonBox.addButton(QString(tr("OK")), QDialogButtonBox::AcceptRole); connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); @@ -773,7 +831,7 @@ void Window::sshConsole() console->setTerminalFont(font); console->setColorScheme("Tango"); console->setShellProgram(program); - QStringList args = { "ssh", "-p", selectedCluster() }; + QStringList args = { "ssh", "-p", selectedClusterName() }; console->setArgs(args); console->startShellProgram(); @@ -792,7 +850,7 @@ void Window::sshConsole() } } - QStringList arguments = { "-e", QString("%1 ssh -p %2").arg(program, selectedCluster()) }; + QStringList arguments = { "-e", QString("%1 ssh -p %2").arg(program, selectedClusterName()) }; QProcess *process = new QProcess(this); process->start(QStandardPaths::findExecutable(terminal), arguments); #endif @@ -804,7 +862,7 @@ void Window::dashboardBrowser() QString program = minikubePath(); QProcess *process = new QProcess(this); - QStringList arguments = { "dashboard", "-p", selectedCluster() }; + QStringList arguments = { "dashboard", "-p", selectedClusterName() }; process->start(program, arguments); dashboardProcess = process; diff --git a/gui/window.h b/gui/window.h index 82e2a8b28e..118000115e 100644 --- a/gui/window.h +++ b/gui/window.h @@ -102,10 +102,14 @@ private: // Tray icon void createTrayIcon(); void createActions(); + void updateTrayActions(Cluster cluster); void iconActivated(QSystemTrayIcon::ActivationReason reason); QAction *minimizeAction; QAction *restoreAction; QAction *quitAction; + QAction *startAction; + QAction *pauseAction; + QAction *stopAction; QSystemTrayIcon *trayIcon; QMenu *trayIconMenu; QIcon *trayIconIcon; @@ -113,15 +117,10 @@ private: // Basic view void createBasicView(); void toBasicView(); - void updateBasicButtons(); - void basicStartMinikube(); - void basicStopMinikube(); - void basicDeleteMinikube(); - void basicRefreshMinikube(); - void basicSSHMinikube(); - void basicDashboardMinikube(); + void updateBasicButtons(Cluster cluster); QPushButton *basicStartButton; QPushButton *basicStopButton; + QPushButton *basicPauseButton; QPushButton *basicDeleteButton; QPushButton *basicRefreshButton; QPushButton *basicSSHButton; @@ -131,9 +130,10 @@ private: void createAdvancedView(); void toAdvancedView(); void createClusterGroupBox(); - void updateAdvancedButtons(); + void updateAdvancedButtons(Cluster cluster); QPushButton *startButton; QPushButton *stopButton; + QPushButton *pauseButton; QPushButton *deleteButton; QPushButton *refreshButton; QPushButton *createButton; @@ -142,9 +142,9 @@ private: QGroupBox *clusterGroupBox; // Cluster table - QString selectedCluster(); - void setSelectedCluster(QString cluster); - ClusterHash getClusterHash(); + QString selectedClusterName(); + void setSelectedClusterName(QString cluster); + Cluster selectedCluster(); ClusterList getClusters(); void updateClusters(); ClusterModel *clusterModel; @@ -161,6 +161,9 @@ private: void startMinikube(QStringList args); void startSelectedMinikube(); void stopMinikube(); + void pauseMinikube(); + void unpauseMinikube(); + void pauseOrUnpauseMinikube(); void deleteMinikube(); bool sendMinikubeCommand(QStringList cmds); bool sendMinikubeCommand(QStringList cmds, QString &text); diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index b22938943b..39d16e56d9 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -123,7 +123,7 @@ const ( ExistingContainerHostEnv = MinikubeExistingPrefix + "CONTAINER_HOST" // TimeFormat is the format that should be used when outputting time - TimeFormat = time.RFC1123 + TimeFormat = time.RFC822 // MaxResources is the value that can be passed into the memory and cpus flags to specify to use maximum resources MaxResources = "max" diff --git a/pkg/minikube/constants/constants_kubeadm_images.go b/pkg/minikube/constants/constants_kubeadm_images.go index f99fa6e295..5c11be816d 100644 --- a/pkg/minikube/constants/constants_kubeadm_images.go +++ b/pkg/minikube/constants/constants_kubeadm_images.go @@ -18,10 +18,15 @@ package constants var ( KubeadmImages = map[string]map[string]string{ + "v1.25": { + "coredns/coredns": "v1.8.6", + "etcd": "3.5.3-0", + "pause": "3.7", + }, "v1.24": { "coredns/coredns": "v1.8.6", - "etcd": "3.5.1-0", - "pause": "3.6", + "etcd": "3.5.3-0", + "pause": "3.7", }, "v1.23": { "coredns/coredns": "v1.8.6", diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index 7391ad6905..75e2595479 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -29,11 +29,13 @@ import ( "strings" "testing" + "github.com/blang/semver/v4" "github.com/docker/machine/libmachine/state" "github.com/google/go-cmp/cmp" "k8s.io/minikube/pkg/minikube/bootstrapper/images" "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/detect" + "k8s.io/minikube/pkg/util" ) // TestStartStop tests starting, stopping and restarting a minikube clusters with various Kubernetes versions and configurations @@ -112,6 +114,21 @@ func TestStartStop(t *testing.T) { startArgs = append(startArgs, StartArgs()...) startArgs = append(startArgs, fmt.Sprintf("--kubernetes-version=%s", tc.version)) + version, err := util.ParseKubernetesVersion(tc.version) + if err != nil { + t.Errorf("failed to parse %s: %v", tc.version, err) + } + if version.GTE(semver.MustParse("1.24.0-alpha.2")) { + args := []string{} + for _, arg := range args { + if arg == "--extra-config=kubelet.network-plugin=cni" { + continue + } + args = append(args, arg) + } + startArgs = args + } + t.Run("serial", func(t *testing.T) { serialTests := []struct { name string