From 3dcc32748bbc54e53c360df5e001d75734bc455b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 Aug 2024 05:55:51 +0000 Subject: [PATCH] fix(deps): update module github.com/longhorn/longhorn-manager to v1.7.0 --- go.mod | 16 +- go.sum | 32 +- .../gorilla/websocket/.editorconfig | 20 - .../github.com/gorilla/websocket/.gitignore | 26 +- .../gorilla/websocket/.golangci.yml | 3 - vendor/github.com/gorilla/websocket/AUTHORS | 9 + vendor/github.com/gorilla/websocket/LICENSE | 39 +- vendor/github.com/gorilla/websocket/Makefile | 34 - vendor/github.com/gorilla/websocket/README.md | 15 +- vendor/github.com/gorilla/websocket/client.go | 26 +- .../gorilla/websocket/compression.go | 9 +- vendor/github.com/gorilla/websocket/conn.go | 75 +-- vendor/github.com/gorilla/websocket/mask.go | 4 - vendor/github.com/gorilla/websocket/proxy.go | 17 +- vendor/github.com/gorilla/websocket/server.go | 38 +- .../gorilla/websocket/tls_handshake.go | 3 + .../gorilla/websocket/tls_handshake_116.go | 21 + vendor/github.com/gorilla/websocket/util.go | 4 +- .../gorilla/websocket/x_net_proxy.go | 473 +++++++++++++ .../pkg/apis/longhorn/v1beta1/backingimage.go | 1 + .../pkg/apis/longhorn/v1beta2/backingimage.go | 21 + .../v1beta2/backingimagedatasource.go | 8 +- .../k8s/pkg/apis/longhorn/v1beta2/backup.go | 19 + .../apis/longhorn/v1beta2/instancemanager.go | 5 + .../k8s/pkg/apis/longhorn/v1beta2/node.go | 35 +- .../pkg/apis/longhorn/v1beta2/recurringjob.go | 7 + .../k8s/pkg/apis/longhorn/v1beta2/setting.go | 10 + .../pkg/apis/longhorn/v1beta2/systembackup.go | 17 +- .../k8s/pkg/apis/longhorn/v1beta2/volume.go | 30 +- .../longhorn/v1beta2/zz_generated.deepcopy.go | 65 ++ .../typed/longhorn/v1beta2/setting.go | 17 + .../longhorn/longhorn-manager/types/deploy.go | 40 ++ .../longhorn-manager/types/setting.go | 629 ++++++++++-------- .../longhorn/longhorn-manager/types/types.go | 197 ++++-- .../longhorn-manager/util/multierror.go | 3 + .../longhorn/longhorn-manager/util/util.go | 24 +- .../longhorn/longhorn-manager/util/volume.go | 4 + .../power-devops/perfstat/cpustat.go | 1 - .../github.com/power-devops/perfstat/doc.go | 12 +- .../power-devops/perfstat/helpers.go | 54 ++ .../power-devops/perfstat/lparstat.go | 13 + .../power-devops/perfstat/systemcfg.go | 58 +- .../power-devops/perfstat/types_disk.go | 4 +- .../power-devops/perfstat/types_lpar.go | 61 ++ vendor/golang.org/x/net/LICENSE | 4 +- vendor/golang.org/x/net/http2/transport.go | 4 - vendor/golang.org/x/sync/LICENSE | 4 +- vendor/golang.org/x/term/LICENSE | 4 +- vendor/golang.org/x/text/LICENSE | 4 +- vendor/golang.org/x/time/rate/rate.go | 2 + vendor/modules.txt | 20 +- 51 files changed, 1620 insertions(+), 621 deletions(-) delete mode 100644 vendor/github.com/gorilla/websocket/.editorconfig delete mode 100644 vendor/github.com/gorilla/websocket/.golangci.yml create mode 100644 vendor/github.com/gorilla/websocket/AUTHORS delete mode 100644 vendor/github.com/gorilla/websocket/Makefile create mode 100644 vendor/github.com/gorilla/websocket/tls_handshake_116.go create mode 100644 vendor/github.com/gorilla/websocket/x_net_proxy.go diff --git a/go.mod b/go.mod index 542ba8b5..1a36794e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.2 require ( github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f - github.com/longhorn/longhorn-manager v1.6.2 + github.com/longhorn/longhorn-manager v1.7.0 github.com/otiai10/copy v1.14.0 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 @@ -50,7 +50,7 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -72,7 +72,7 @@ require ( github.com/opencontainers/runc v1.1.13 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect - github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect + github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/robfig/cron v1.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil/v3 v3.24.5 // indirect @@ -81,13 +81,13 @@ require ( github.com/xlab/treeprint v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect + golang.org/x/time v0.5.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 2a20a7ce..6428c522 100644 --- a/go.sum +++ b/go.sum @@ -254,8 +254,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -331,8 +331,8 @@ github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffkt github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f h1:hjqUs3WVodkzrWwlUMVsnKAlom3uohoNlhZBGLsRvQY= github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo= -github.com/longhorn/longhorn-manager v1.6.2 h1:CKrC4b80QnvITpbrxEUGWEcozgiENCMgxS/LEarsKQA= -github.com/longhorn/longhorn-manager v1.6.2/go.mod h1:kvwZ6cFvs4PWJNOikPWWC5YiTBJnZq/TbUw2gYnD1ek= +github.com/longhorn/longhorn-manager v1.7.0 h1:JCXzJsmunXFCz3d1Y2dn6AN5PC+gIIp0+qCQKy0ysGQ= +github.com/longhorn/longhorn-manager v1.7.0/go.mod h1:Mbv/DwsOjTSKi6CagpMSBFW1iFxtpuEAWJR07viraO4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -419,8 +419,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig= -github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= +github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= @@ -626,8 +626,8 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -644,8 +644,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -705,8 +705,8 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -714,15 +714,15 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/gorilla/websocket/.editorconfig b/vendor/github.com/gorilla/websocket/.editorconfig deleted file mode 100644 index 2940ec92..00000000 --- a/vendor/github.com/gorilla/websocket/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -; https://editorconfig.org/ - -root = true - -[*] -insert_final_newline = true -charset = utf-8 -trim_trailing_whitespace = true -indent_style = space -indent_size = 2 - -[{Makefile,go.mod,go.sum,*.go,.gitmodules}] -indent_style = tab -indent_size = 4 - -[*.md] -indent_size = 4 -trim_trailing_whitespace = false - -eclint_indent_style = unset diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore index 84039fec..cd3fcd1e 100644 --- a/vendor/github.com/gorilla/websocket/.gitignore +++ b/vendor/github.com/gorilla/websocket/.gitignore @@ -1 +1,25 @@ -coverage.coverprofile +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +.idea/ +*.iml diff --git a/vendor/github.com/gorilla/websocket/.golangci.yml b/vendor/github.com/gorilla/websocket/.golangci.yml deleted file mode 100644 index 34882139..00000000 --- a/vendor/github.com/gorilla/websocket/.golangci.yml +++ /dev/null @@ -1,3 +0,0 @@ -run: - skip-dirs: - - examples/*.go diff --git a/vendor/github.com/gorilla/websocket/AUTHORS b/vendor/github.com/gorilla/websocket/AUTHORS new file mode 100644 index 00000000..1931f400 --- /dev/null +++ b/vendor/github.com/gorilla/websocket/AUTHORS @@ -0,0 +1,9 @@ +# This is the official list of Gorilla WebSocket authors for copyright +# purposes. +# +# Please keep the list sorted. + +Gary Burd +Google LLC (https://opensource.google.com/) +Joachim Bauch + diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE index bb9d80bc..9171c972 100644 --- a/vendor/github.com/gorilla/websocket/LICENSE +++ b/vendor/github.com/gorilla/websocket/LICENSE @@ -1,27 +1,22 @@ -Copyright (c) 2023 The Gorilla Authors. All rights reserved. +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/gorilla/websocket/Makefile b/vendor/github.com/gorilla/websocket/Makefile deleted file mode 100644 index 603a63f5..00000000 --- a/vendor/github.com/gorilla/websocket/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') -GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest - -GO_SEC=$(shell which gosec 2> /dev/null || echo '') -GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest - -GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') -GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest - -.PHONY: golangci-lint -golangci-lint: - $(if $(GO_LINT), ,go install $(GO_LINT_URI)) - @echo "##### Running golangci-lint" - golangci-lint run -v - -.PHONY: gosec -gosec: - $(if $(GO_SEC), ,go install $(GO_SEC_URI)) - @echo "##### Running gosec" - gosec -exclude-dir examples ./... - -.PHONY: govulncheck -govulncheck: - $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) - @echo "##### Running govulncheck" - govulncheck ./... - -.PHONY: verify -verify: golangci-lint gosec govulncheck - -.PHONY: test -test: - @echo "##### Running tests" - go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md index 1fd5e9c4..d33ed7fd 100644 --- a/vendor/github.com/gorilla/websocket/README.md +++ b/vendor/github.com/gorilla/websocket/README.md @@ -1,13 +1,10 @@ -# gorilla/websocket +# Gorilla WebSocket -![testing](https://github.com/gorilla/websocket/actions/workflows/test.yml/badge.svg) -[![codecov](https://codecov.io/github/gorilla/websocket/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/websocket) -[![godoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) -[![sourcegraph](https://sourcegraph.com/github.com/gorilla/websocket/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/websocket?badge) +[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) +[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket) -Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. - -![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5) +Gorilla WebSocket is a [Go](http://golang.org/) implementation of the +[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. ### Documentation @@ -17,7 +14,6 @@ Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket * [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) * [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) * [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch) -* [Write buffer pool example](https://github.com/gorilla/websocket/tree/master/examples/bufferpool) ### Status @@ -34,3 +30,4 @@ package API is stable. The Gorilla WebSocket package passes the server tests in the [Autobahn Test Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn). + diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go index 815b0ca5..04fdafee 100644 --- a/vendor/github.com/gorilla/websocket/client.go +++ b/vendor/github.com/gorilla/websocket/client.go @@ -11,16 +11,13 @@ import ( "errors" "fmt" "io" - "log" - + "io/ioutil" "net" "net/http" "net/http/httptrace" "net/url" "strings" "time" - - "golang.org/x/net/proxy" ) // ErrBadHandshake is returned when the server response to opening handshake is @@ -228,7 +225,6 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h k == "Connection" || k == "Sec-Websocket-Key" || k == "Sec-Websocket-Version" || - //#nosec G101 (CWE-798): Potential HTTP request smuggling via parameter pollution k == "Sec-Websocket-Extensions" || (k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0): return nil, nil, errors.New("websocket: duplicate header not allowed: " + k) @@ -294,9 +290,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } err = c.SetDeadline(deadline) if err != nil { - if err := c.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } + c.Close() return nil, err } return c, nil @@ -310,7 +304,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h return nil, nil, err } if proxyURL != nil { - dialer, err := proxy.FromURL(proxyURL, netDialerFunc(netDial)) + dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial)) if err != nil { return nil, nil, err } @@ -336,9 +330,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h defer func() { if netConn != nil { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } + netConn.Close() } }() @@ -408,7 +400,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h // debugging. buf := make([]byte, 1024) n, _ := io.ReadFull(resp.Body, buf) - resp.Body = io.NopCloser(bytes.NewReader(buf[:n])) + resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n])) return nil, resp, ErrBadHandshake } @@ -426,19 +418,17 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h break } - resp.Body = io.NopCloser(bytes.NewReader([]byte{})) + resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol") - if err := netConn.SetDeadline(time.Time{}); err != nil { - return nil, nil, err - } + netConn.SetDeadline(time.Time{}) netConn = nil // to avoid close in defer. return conn, resp, nil } func cloneTLSConfig(cfg *tls.Config) *tls.Config { if cfg == nil { - return &tls.Config{MinVersion: tls.VersionTLS12} + return &tls.Config{} } return cfg.Clone() } diff --git a/vendor/github.com/gorilla/websocket/compression.go b/vendor/github.com/gorilla/websocket/compression.go index 9fed0ef5..813ffb1e 100644 --- a/vendor/github.com/gorilla/websocket/compression.go +++ b/vendor/github.com/gorilla/websocket/compression.go @@ -8,7 +8,6 @@ import ( "compress/flate" "errors" "io" - "log" "strings" "sync" ) @@ -34,9 +33,7 @@ func decompressNoContextTakeover(r io.Reader) io.ReadCloser { "\x01\x00\x00\xff\xff" fr, _ := flateReaderPool.Get().(io.ReadCloser) - if err := fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil); err != nil { - panic(err) - } + fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil) return &flateReadWrapper{fr} } @@ -135,9 +132,7 @@ func (r *flateReadWrapper) Read(p []byte) (int, error) { // Preemptively place the reader back in the pool. This helps with // scenarios where the application does not call NextReader() soon after // this final read. - if err := r.Close(); err != nil { - log.Printf("websocket: flateReadWrapper.Close() returned error: %v", err) - } + r.Close() } return n, err } diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go index 221e6cf7..5161ef81 100644 --- a/vendor/github.com/gorilla/websocket/conn.go +++ b/vendor/github.com/gorilla/websocket/conn.go @@ -6,11 +6,11 @@ package websocket import ( "bufio" - "crypto/rand" "encoding/binary" "errors" "io" - "log" + "io/ioutil" + "math/rand" "net" "strconv" "strings" @@ -181,20 +181,13 @@ var ( errInvalidControlFrame = errors.New("websocket: invalid control frame") ) -// maskRand is an io.Reader for generating mask bytes. The reader is initialized -// to crypto/rand Reader. Tests swap the reader to a math/rand reader for -// reproducible results. -var maskRand = rand.Reader - -// newMaskKey returns a new 32 bit value for masking client frames. func newMaskKey() [4]byte { - var k [4]byte - _, _ = io.ReadFull(maskRand, k[:]) - return k + n := rand.Uint32() + return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)} } func hideTempErr(err error) error { - if e, ok := err.(net.Error); ok { + if e, ok := err.(net.Error); ok && e.Temporary() { err = &netError{msg: e.Error(), timeout: e.Timeout()} } return err @@ -379,9 +372,7 @@ func (c *Conn) read(n int) ([]byte, error) { if err == io.EOF { err = errUnexpectedEOF } - if _, err := c.br.Discard(len(p)); err != nil { - return p, err - } + c.br.Discard(len(p)) return p, err } @@ -396,9 +387,7 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error return err } - if err := c.conn.SetWriteDeadline(deadline); err != nil { - return c.writeFatal(err) - } + c.conn.SetWriteDeadline(deadline) if len(buf1) == 0 { _, err = c.conn.Write(buf0) } else { @@ -408,7 +397,7 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error return c.writeFatal(err) } if frameType == CloseMessage { - _ = c.writeFatal(ErrCloseSent) + c.writeFatal(ErrCloseSent) } return nil } @@ -449,7 +438,7 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er d := 1000 * time.Hour if !deadline.IsZero() { - d = time.Until(deadline) + d = deadline.Sub(time.Now()) if d < 0 { return errWriteTimeout } @@ -471,15 +460,13 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er return err } - if err := c.conn.SetWriteDeadline(deadline); err != nil { - return c.writeFatal(err) - } + c.conn.SetWriteDeadline(deadline) _, err = c.conn.Write(buf) if err != nil { return c.writeFatal(err) } if messageType == CloseMessage { - _ = c.writeFatal(ErrCloseSent) + c.writeFatal(ErrCloseSent) } return err } @@ -490,9 +477,7 @@ func (c *Conn) beginMessage(mw *messageWriter, messageType int) error { // probably better to return an error in this situation, but we cannot // change this without breaking existing applications. if c.writer != nil { - if err := c.writer.Close(); err != nil { - log.Printf("websocket: discarding writer close error: %v", err) - } + c.writer.Close() c.writer = nil } @@ -645,7 +630,7 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error { } if final { - _ = w.endMessage(errWriteClosed) + w.endMessage(errWriteClosed) return nil } @@ -810,7 +795,7 @@ func (c *Conn) advanceFrame() (int, error) { // 1. Skip remainder of previous frame. if c.readRemaining > 0 { - if _, err := io.CopyN(io.Discard, c.br, c.readRemaining); err != nil { + if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil { return noFrame, err } } @@ -832,9 +817,7 @@ func (c *Conn) advanceFrame() (int, error) { rsv2 := p[0]&rsv2Bit != 0 rsv3 := p[0]&rsv3Bit != 0 mask := p[1]&maskBit != 0 - if err := c.setReadRemaining(int64(p[1] & 0x7f)); err != nil { - return noFrame, err - } + c.setReadRemaining(int64(p[1] & 0x7f)) c.readDecompress = false if rsv1 { @@ -939,9 +922,7 @@ func (c *Conn) advanceFrame() (int, error) { } if c.readLimit > 0 && c.readLength > c.readLimit { - if err := c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)); err != nil { - return noFrame, err - } + c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)) return noFrame, ErrReadLimit } @@ -953,9 +934,7 @@ func (c *Conn) advanceFrame() (int, error) { var payload []byte if c.readRemaining > 0 { payload, err = c.read(int(c.readRemaining)) - if err := c.setReadRemaining(0); err != nil { - return noFrame, err - } + c.setReadRemaining(0) if err != nil { return noFrame, err } @@ -1002,9 +981,7 @@ func (c *Conn) handleProtocolError(message string) error { if len(data) > maxControlFramePayloadSize { data = data[:maxControlFramePayloadSize] } - if err := c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)); err != nil { - return err - } + c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)) return errors.New("websocket: " + message) } @@ -1021,9 +998,7 @@ func (c *Conn) handleProtocolError(message string) error { func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { // Close previous reader, only relevant for decompression. if c.reader != nil { - if err := c.reader.Close(); err != nil { - log.Printf("websocket: discarding reader close error: %v", err) - } + c.reader.Close() c.reader = nil } @@ -1079,9 +1054,7 @@ func (r *messageReader) Read(b []byte) (int, error) { } rem := c.readRemaining rem -= int64(n) - if err := c.setReadRemaining(rem); err != nil { - return 0, err - } + c.setReadRemaining(rem) if c.readRemaining > 0 && c.readErr == io.EOF { c.readErr = errUnexpectedEOF } @@ -1121,7 +1094,7 @@ func (c *Conn) ReadMessage() (messageType int, p []byte, err error) { if err != nil { return messageType, nil, err } - p, err = io.ReadAll(r) + p, err = ioutil.ReadAll(r) return messageType, p, err } @@ -1163,9 +1136,7 @@ func (c *Conn) SetCloseHandler(h func(code int, text string) error) { if h == nil { h = func(code int, text string) error { message := FormatCloseMessage(code, "") - if err := c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)); err != nil { - return err - } + c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)) return nil } } @@ -1190,7 +1161,7 @@ func (c *Conn) SetPingHandler(h func(appData string) error) { err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait)) if err == ErrCloseSent { return nil - } else if _, ok := err.(net.Error); ok { + } else if e, ok := err.(net.Error); ok && e.Temporary() { return nil } return err diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go index 67d0968b..d0742bf2 100644 --- a/vendor/github.com/gorilla/websocket/mask.go +++ b/vendor/github.com/gorilla/websocket/mask.go @@ -9,7 +9,6 @@ package websocket import "unsafe" -// #nosec G103 -- (CWE-242) Has been audited const wordSize = int(unsafe.Sizeof(uintptr(0))) func maskBytes(key [4]byte, pos int, b []byte) int { @@ -23,7 +22,6 @@ func maskBytes(key [4]byte, pos int, b []byte) int { } // Mask one byte at a time to word boundary. - //#nosec G103 -- (CWE-242) Has been audited if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { n = wordSize - n for i := range b[:n] { @@ -38,13 +36,11 @@ func maskBytes(key [4]byte, pos int, b []byte) int { for i := range k { k[i] = key[(pos+i)&3] } - //#nosec G103 -- (CWE-242) Has been audited kw := *(*uintptr)(unsafe.Pointer(&k)) // Mask one word at a time. n := (len(b) / wordSize) * wordSize for i := 0; i < n; i += wordSize { - //#nosec G103 -- (CWE-242) Has been audited *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw } diff --git a/vendor/github.com/gorilla/websocket/proxy.go b/vendor/github.com/gorilla/websocket/proxy.go index 80f55d1e..e0f466b7 100644 --- a/vendor/github.com/gorilla/websocket/proxy.go +++ b/vendor/github.com/gorilla/websocket/proxy.go @@ -8,13 +8,10 @@ import ( "bufio" "encoding/base64" "errors" - "log" "net" "net/http" "net/url" "strings" - - "golang.org/x/net/proxy" ) type netDialerFunc func(network, addr string) (net.Conn, error) @@ -24,7 +21,7 @@ func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) { } func init() { - proxy.RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy.Dialer) (proxy.Dialer, error) { + proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) { return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil }) } @@ -58,9 +55,7 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) } if err := connectReq.Write(conn); err != nil { - if err := conn.Close(); err != nil { - log.Printf("httpProxyDialer: failed to close connection: %v", err) - } + conn.Close() return nil, err } @@ -69,16 +64,12 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) br := bufio.NewReader(conn) resp, err := http.ReadResponse(br, connectReq) if err != nil { - if err := conn.Close(); err != nil { - log.Printf("httpProxyDialer: failed to close connection: %v", err) - } + conn.Close() return nil, err } if resp.StatusCode != 200 { - if err := conn.Close(); err != nil { - log.Printf("httpProxyDialer: failed to close connection: %v", err) - } + conn.Close() f := strings.SplitN(resp.Status, " ", 2) return nil, errors.New(f[1]) } diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go index 1e720e1d..bb335974 100644 --- a/vendor/github.com/gorilla/websocket/server.go +++ b/vendor/github.com/gorilla/websocket/server.go @@ -8,7 +8,6 @@ import ( "bufio" "errors" "io" - "log" "net/http" "net/url" "strings" @@ -184,9 +183,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade } if brw.Reader.Buffered() > 0 { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } + netConn.Close() return nil, errors.New("websocket: client sent data before handshake is complete") } @@ -251,34 +248,17 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade p = append(p, "\r\n"...) // Clear deadlines set by HTTP server. - if err := netConn.SetDeadline(time.Time{}); err != nil { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } - return nil, err - } + netConn.SetDeadline(time.Time{}) if u.HandshakeTimeout > 0 { - if err := netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)); err != nil { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } - return nil, err - } + netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)) } if _, err = netConn.Write(p); err != nil { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } + netConn.Close() return nil, err } if u.HandshakeTimeout > 0 { - if err := netConn.SetWriteDeadline(time.Time{}); err != nil { - if err := netConn.Close(); err != nil { - log.Printf("websocket: failed to close network connection: %v", err) - } - return nil, err - } + netConn.SetWriteDeadline(time.Time{}) } return c, nil @@ -376,12 +356,8 @@ func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte { // bufio.Writer's underlying writer. var wh writeHook bw.Reset(&wh) - if err := bw.WriteByte(0); err != nil { - panic(err) - } - if err := bw.Flush(); err != nil { - log.Printf("websocket: bufioWriterBuffer: Flush: %v", err) - } + bw.WriteByte(0) + bw.Flush() bw.Reset(originalWriter) diff --git a/vendor/github.com/gorilla/websocket/tls_handshake.go b/vendor/github.com/gorilla/websocket/tls_handshake.go index 7f386453..a62b68cc 100644 --- a/vendor/github.com/gorilla/websocket/tls_handshake.go +++ b/vendor/github.com/gorilla/websocket/tls_handshake.go @@ -1,3 +1,6 @@ +//go:build go1.17 +// +build go1.17 + package websocket import ( diff --git a/vendor/github.com/gorilla/websocket/tls_handshake_116.go b/vendor/github.com/gorilla/websocket/tls_handshake_116.go new file mode 100644 index 00000000..e1b2b44f --- /dev/null +++ b/vendor/github.com/gorilla/websocket/tls_handshake_116.go @@ -0,0 +1,21 @@ +//go:build !go1.17 +// +build !go1.17 + +package websocket + +import ( + "context" + "crypto/tls" +) + +func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error { + if err := tlsConn.Handshake(); err != nil { + return err + } + if !cfg.InsecureSkipVerify { + if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/gorilla/websocket/util.go b/vendor/github.com/gorilla/websocket/util.go index 9b1a629b..31a5dee6 100644 --- a/vendor/github.com/gorilla/websocket/util.go +++ b/vendor/github.com/gorilla/websocket/util.go @@ -6,7 +6,7 @@ package websocket import ( "crypto/rand" - "crypto/sha1" //#nosec G505 -- (CWE-327) https://datatracker.ietf.org/doc/html/rfc6455#page-54 + "crypto/sha1" "encoding/base64" "io" "net/http" @@ -17,7 +17,7 @@ import ( var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") func computeAcceptKey(challengeKey string) string { - h := sha1.New() //#nosec G401 -- (CWE-326) https://datatracker.ietf.org/doc/html/rfc6455#page-54 + h := sha1.New() h.Write([]byte(challengeKey)) h.Write(keyGUID) return base64.StdEncoding.EncodeToString(h.Sum(nil)) diff --git a/vendor/github.com/gorilla/websocket/x_net_proxy.go b/vendor/github.com/gorilla/websocket/x_net_proxy.go new file mode 100644 index 00000000..2e668f6b --- /dev/null +++ b/vendor/github.com/gorilla/websocket/x_net_proxy.go @@ -0,0 +1,473 @@ +// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT. +//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy + +// Package proxy provides support for a variety of protocols to proxy network +// data. +// + +package websocket + +import ( + "errors" + "io" + "net" + "net/url" + "os" + "strconv" + "strings" + "sync" +) + +type proxy_direct struct{} + +// Direct is a direct proxy: one that makes network connections directly. +var proxy_Direct = proxy_direct{} + +func (proxy_direct) Dial(network, addr string) (net.Conn, error) { + return net.Dial(network, addr) +} + +// A PerHost directs connections to a default Dialer unless the host name +// requested matches one of a number of exceptions. +type proxy_PerHost struct { + def, bypass proxy_Dialer + + bypassNetworks []*net.IPNet + bypassIPs []net.IP + bypassZones []string + bypassHosts []string +} + +// NewPerHost returns a PerHost Dialer that directs connections to either +// defaultDialer or bypass, depending on whether the connection matches one of +// the configured rules. +func proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost { + return &proxy_PerHost{ + def: defaultDialer, + bypass: bypass, + } +} + +// Dial connects to the address addr on the given network through either +// defaultDialer or bypass. +func (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) { + host, _, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + + return p.dialerForRequest(host).Dial(network, addr) +} + +func (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer { + if ip := net.ParseIP(host); ip != nil { + for _, net := range p.bypassNetworks { + if net.Contains(ip) { + return p.bypass + } + } + for _, bypassIP := range p.bypassIPs { + if bypassIP.Equal(ip) { + return p.bypass + } + } + return p.def + } + + for _, zone := range p.bypassZones { + if strings.HasSuffix(host, zone) { + return p.bypass + } + if host == zone[1:] { + // For a zone ".example.com", we match "example.com" + // too. + return p.bypass + } + } + for _, bypassHost := range p.bypassHosts { + if bypassHost == host { + return p.bypass + } + } + return p.def +} + +// AddFromString parses a string that contains comma-separated values +// specifying hosts that should use the bypass proxy. Each value is either an +// IP address, a CIDR range, a zone (*.example.com) or a host name +// (localhost). A best effort is made to parse the string and errors are +// ignored. +func (p *proxy_PerHost) AddFromString(s string) { + hosts := strings.Split(s, ",") + for _, host := range hosts { + host = strings.TrimSpace(host) + if len(host) == 0 { + continue + } + if strings.Contains(host, "/") { + // We assume that it's a CIDR address like 127.0.0.0/8 + if _, net, err := net.ParseCIDR(host); err == nil { + p.AddNetwork(net) + } + continue + } + if ip := net.ParseIP(host); ip != nil { + p.AddIP(ip) + continue + } + if strings.HasPrefix(host, "*.") { + p.AddZone(host[1:]) + continue + } + p.AddHost(host) + } +} + +// AddIP specifies an IP address that will use the bypass proxy. Note that +// this will only take effect if a literal IP address is dialed. A connection +// to a named host will never match an IP. +func (p *proxy_PerHost) AddIP(ip net.IP) { + p.bypassIPs = append(p.bypassIPs, ip) +} + +// AddNetwork specifies an IP range that will use the bypass proxy. Note that +// this will only take effect if a literal IP address is dialed. A connection +// to a named host will never match. +func (p *proxy_PerHost) AddNetwork(net *net.IPNet) { + p.bypassNetworks = append(p.bypassNetworks, net) +} + +// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of +// "example.com" matches "example.com" and all of its subdomains. +func (p *proxy_PerHost) AddZone(zone string) { + if strings.HasSuffix(zone, ".") { + zone = zone[:len(zone)-1] + } + if !strings.HasPrefix(zone, ".") { + zone = "." + zone + } + p.bypassZones = append(p.bypassZones, zone) +} + +// AddHost specifies a host name that will use the bypass proxy. +func (p *proxy_PerHost) AddHost(host string) { + if strings.HasSuffix(host, ".") { + host = host[:len(host)-1] + } + p.bypassHosts = append(p.bypassHosts, host) +} + +// A Dialer is a means to establish a connection. +type proxy_Dialer interface { + // Dial connects to the given address via the proxy. + Dial(network, addr string) (c net.Conn, err error) +} + +// Auth contains authentication parameters that specific Dialers may require. +type proxy_Auth struct { + User, Password string +} + +// FromEnvironment returns the dialer specified by the proxy related variables in +// the environment. +func proxy_FromEnvironment() proxy_Dialer { + allProxy := proxy_allProxyEnv.Get() + if len(allProxy) == 0 { + return proxy_Direct + } + + proxyURL, err := url.Parse(allProxy) + if err != nil { + return proxy_Direct + } + proxy, err := proxy_FromURL(proxyURL, proxy_Direct) + if err != nil { + return proxy_Direct + } + + noProxy := proxy_noProxyEnv.Get() + if len(noProxy) == 0 { + return proxy + } + + perHost := proxy_NewPerHost(proxy, proxy_Direct) + perHost.AddFromString(noProxy) + return perHost +} + +// proxySchemes is a map from URL schemes to a function that creates a Dialer +// from a URL with such a scheme. +var proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error) + +// RegisterDialerType takes a URL scheme and a function to generate Dialers from +// a URL with that scheme and a forwarding Dialer. Registered schemes are used +// by FromURL. +func proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) { + if proxy_proxySchemes == nil { + proxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) + } + proxy_proxySchemes[scheme] = f +} + +// FromURL returns a Dialer given a URL specification and an underlying +// Dialer for it to make network requests. +func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) { + var auth *proxy_Auth + if u.User != nil { + auth = new(proxy_Auth) + auth.User = u.User.Username() + if p, ok := u.User.Password(); ok { + auth.Password = p + } + } + + switch u.Scheme { + case "socks5": + return proxy_SOCKS5("tcp", u.Host, auth, forward) + } + + // If the scheme doesn't match any of the built-in schemes, see if it + // was registered by another package. + if proxy_proxySchemes != nil { + if f, ok := proxy_proxySchemes[u.Scheme]; ok { + return f(u, forward) + } + } + + return nil, errors.New("proxy: unknown scheme: " + u.Scheme) +} + +var ( + proxy_allProxyEnv = &proxy_envOnce{ + names: []string{"ALL_PROXY", "all_proxy"}, + } + proxy_noProxyEnv = &proxy_envOnce{ + names: []string{"NO_PROXY", "no_proxy"}, + } +) + +// envOnce looks up an environment variable (optionally by multiple +// names) once. It mitigates expensive lookups on some platforms +// (e.g. Windows). +// (Borrowed from net/http/transport.go) +type proxy_envOnce struct { + names []string + once sync.Once + val string +} + +func (e *proxy_envOnce) Get() string { + e.once.Do(e.init) + return e.val +} + +func (e *proxy_envOnce) init() { + for _, n := range e.names { + e.val = os.Getenv(n) + if e.val != "" { + return + } + } +} + +// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address +// with an optional username and password. See RFC 1928 and RFC 1929. +func proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) { + s := &proxy_socks5{ + network: network, + addr: addr, + forward: forward, + } + if auth != nil { + s.user = auth.User + s.password = auth.Password + } + + return s, nil +} + +type proxy_socks5 struct { + user, password string + network, addr string + forward proxy_Dialer +} + +const proxy_socks5Version = 5 + +const ( + proxy_socks5AuthNone = 0 + proxy_socks5AuthPassword = 2 +) + +const proxy_socks5Connect = 1 + +const ( + proxy_socks5IP4 = 1 + proxy_socks5Domain = 3 + proxy_socks5IP6 = 4 +) + +var proxy_socks5Errors = []string{ + "", + "general failure", + "connection forbidden", + "network unreachable", + "host unreachable", + "connection refused", + "TTL expired", + "command not supported", + "address type not supported", +} + +// Dial connects to the address addr on the given network via the SOCKS5 proxy. +func (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) { + switch network { + case "tcp", "tcp6", "tcp4": + default: + return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network) + } + + conn, err := s.forward.Dial(s.network, s.addr) + if err != nil { + return nil, err + } + if err := s.connect(conn, addr); err != nil { + conn.Close() + return nil, err + } + return conn, nil +} + +// connect takes an existing connection to a socks5 proxy server, +// and commands the server to extend that connection to target, +// which must be a canonical address with a host and port. +func (s *proxy_socks5) connect(conn net.Conn, target string) error { + host, portStr, err := net.SplitHostPort(target) + if err != nil { + return err + } + + port, err := strconv.Atoi(portStr) + if err != nil { + return errors.New("proxy: failed to parse port number: " + portStr) + } + if port < 1 || port > 0xffff { + return errors.New("proxy: port number out of range: " + portStr) + } + + // the size here is just an estimate + buf := make([]byte, 0, 6+len(host)) + + buf = append(buf, proxy_socks5Version) + if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 { + buf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword) + } else { + buf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone) + } + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + if buf[0] != 5 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0]))) + } + if buf[1] == 0xff { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication") + } + + // See RFC 1929 + if buf[1] == proxy_socks5AuthPassword { + buf = buf[:0] + buf = append(buf, 1 /* password protocol version */) + buf = append(buf, uint8(len(s.user))) + buf = append(buf, s.user...) + buf = append(buf, uint8(len(s.password))) + buf = append(buf, s.password...) + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if buf[1] != 0 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password") + } + } + + buf = buf[:0] + buf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */) + + if ip := net.ParseIP(host); ip != nil { + if ip4 := ip.To4(); ip4 != nil { + buf = append(buf, proxy_socks5IP4) + ip = ip4 + } else { + buf = append(buf, proxy_socks5IP6) + } + buf = append(buf, ip...) + } else { + if len(host) > 255 { + return errors.New("proxy: destination host name too long: " + host) + } + buf = append(buf, proxy_socks5Domain) + buf = append(buf, byte(len(host))) + buf = append(buf, host...) + } + buf = append(buf, byte(port>>8), byte(port)) + + if _, err := conn.Write(buf); err != nil { + return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + if _, err := io.ReadFull(conn, buf[:4]); err != nil { + return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + failure := "unknown error" + if int(buf[1]) < len(proxy_socks5Errors) { + failure = proxy_socks5Errors[buf[1]] + } + + if len(failure) > 0 { + return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure) + } + + bytesToDiscard := 0 + switch buf[3] { + case proxy_socks5IP4: + bytesToDiscard = net.IPv4len + case proxy_socks5IP6: + bytesToDiscard = net.IPv6len + case proxy_socks5Domain: + _, err := io.ReadFull(conn, buf[:1]) + if err != nil { + return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + bytesToDiscard = int(buf[0]) + default: + return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr) + } + + if cap(buf) < bytesToDiscard { + buf = make([]byte, bytesToDiscard) + } else { + buf = buf[:bytesToDiscard] + } + if _, err := io.ReadFull(conn, buf); err != nil { + return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + // Also need to discard the port number + if _, err := io.ReadFull(conn, buf[:2]); err != nil { + return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error()) + } + + return nil +} diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1/backingimage.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1/backingimage.go index eb867161..6bb4c3e8 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1/backingimage.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1/backingimage.go @@ -105,6 +105,7 @@ func (bi *BackingImage) ConvertTo(dst conversion.Hub) error { biV1beta2.Spec.Disks = make(map[string]string) for name := range bi.Spec.Disks { biV1beta2.Spec.Disks[name] = "" + biV1beta2.Spec.DiskFileSpecMap[name] = &v1beta2.BackingImageDiskFileSpec{} } return nil default: diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimage.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimage.go index a68fc3e2..741bc380 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimage.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimage.go @@ -7,6 +7,9 @@ const ( BackingImageParameterDataSourceType = "backingImageDataSourceType" BackingImageParameterChecksum = "backingImageChecksum" BackingImageParameterDataSourceParameters = "backingImageDataSourceParameters" + BackingImageParameterMinNumberOfCopies = "backingImageMinNumberOfCopies" + BackingImageParameterNodeSelector = "backingImageNodeSelector" + BackingImageParameterDiskSelector = "backingImageDiskSelector" ) // BackingImageDownloadState is replaced by BackingImageState. @@ -36,16 +39,34 @@ type BackingImageDiskFileStatus struct { LastStateTransitionTime string `json:"lastStateTransitionTime"` } +type BackingImageDiskFileSpec struct { + // +optional + EvictionRequested bool `json:"evictionRequested"` +} + // BackingImageSpec defines the desired state of the Longhorn backing image type BackingImageSpec struct { + // Deprecated. We are now using DiskFileSpecMap to assign different spec to the file on different disks. // +optional Disks map[string]string `json:"disks"` // +optional + DiskFileSpecMap map[string]*BackingImageDiskFileSpec `json:"diskFileSpecMap"` + // +optional Checksum string `json:"checksum"` // +optional SourceType BackingImageDataSourceType `json:"sourceType"` // +optional SourceParameters map[string]string `json:"sourceParameters"` + // +optional + MinNumberOfCopies int `json:"minNumberOfCopies"` + // +optional + DiskSelector []string `json:"diskSelector"` + // +optional + NodeSelector []string `json:"nodeSelector"` + // +optional + Secret string `json:"secret"` + // +optional + SecretNamespace string `json:"secretNamespace"` } // BackingImageStatus defines the observed state of the Longhorn backing image status diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimagedatasource.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimagedatasource.go index 7eeba2f5..a5927952 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimagedatasource.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backingimagedatasource.go @@ -8,7 +8,7 @@ const ( DataSourceTypeExportParameterVolumeName = "volume-name" ) -// +kubebuilder:validation:Enum=download;upload;export-from-volume;restore +// +kubebuilder:validation:Enum=download;upload;export-from-volume;restore;clone type BackingImageDataSourceType string const ( @@ -16,6 +16,7 @@ const ( BackingImageDataSourceTypeUpload = BackingImageDataSourceType("upload") BackingImageDataSourceTypeExportFromVolume = BackingImageDataSourceType("export-from-volume") BackingImageDataSourceTypeRestore = BackingImageDataSourceType("restore") + BackingImageDataSourceTypeClone = BackingImageDataSourceType("clone") DataSourceTypeExportFromVolumeParameterVolumeName = "volume-name" DataSourceTypeExportFromVolumeParameterVolumeSize = "volume-size" @@ -24,6 +25,11 @@ const ( DataSourceTypeExportFromVolumeParameterFileSyncHTTPClientTimeout = "file-sync-http-client-timeout" DataSourceTypeRestoreParameterBackupURL = "backup-url" DataSourceTypeRestoreParameterConcurrentLimit = "concurrent-limit" + DataSourceTypeCloneParameterBackingImage = "backing-image" + DataSourceTypeCloneParameterBackingImageUUID = "backing-image-uuid" + DataSourceTypeCloneParameterEncryption = "encryption" + DataSourceTypeCloneParameterSecret = "secret" + DataSourceTypeCloneParameterSecretNamespace = "secret-namespace" ) // BackingImageDataSourceSpec defines the desired state of the Longhorn backing image data source diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backup.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backup.go index 45dd5dc5..7578e351 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backup.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/backup.go @@ -23,6 +23,15 @@ const ( BackupCompressionMethodGzip = BackupCompressionMethod("gzip") ) +// +kubebuilder:validation:Enum=full;incremental;"" +type BackupMode string + +const ( + BackupModeFull = BackupMode("full") + BackupModeIncremental = BackupMode("incremental") + BackupModeIncrementalNone = BackupMode("") +) + // BackupSpec defines the desired state of the Longhorn backup type BackupSpec struct { // The time to request run sync the remote backup. @@ -35,6 +44,10 @@ type BackupSpec struct { // The labels of snapshot backup. // +optional Labels map[string]string `json:"labels"` + // The backup mode of this backup. + // Can be "full" or "incremental" + // +optional + BackupMode BackupMode `json:"backupMode"` } // BackupStatus defines the observed state of the Longhorn backup @@ -97,6 +110,12 @@ type BackupStatus struct { // Compression method // +optional CompressionMethod BackupCompressionMethod `json:"compressionMethod"` + // Size in bytes of newly uploaded data + // +optional + NewlyUploadedDataSize string `json:"newlyUploadDataSize"` + // Size in bytes of reuploaded data + // +optional + ReUploadedDataSize string `json:"reUploadedDataSize"` } // +genclient diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/instancemanager.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/instancemanager.go index c3ef1c9c..7b2689f3 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/instancemanager.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/instancemanager.go @@ -7,6 +7,7 @@ type InstanceType string const ( InstanceTypeEngine = InstanceType("engine") InstanceTypeReplica = InstanceType("replica") + InstanceTypeNone = InstanceType("") ) type InstanceManagerState string @@ -133,6 +134,10 @@ type InstanceProcessStatus struct { // +optional PortStart int32 `json:"portStart"` // +optional + TargetPortEnd int32 `json:"targetPortEnd"` + // +optional + TargetPortStart int32 `json:"targetPortStart"` + // +optional State InstanceState `json:"state"` // +optional Type InstanceType `json:"type"` diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/node.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/node.go index e7b02d35..7943543b 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/node.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/node.go @@ -3,9 +3,12 @@ package v1beta2 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" const ( - NodeConditionTypeReady = "Ready" - NodeConditionTypeMountPropagation = "MountPropagation" - NodeConditionTypeSchedulable = "Schedulable" + NodeConditionTypeReady = "Ready" + NodeConditionTypeMountPropagation = "MountPropagation" + NodeConditionTypeMultipathd = "Multipathd" + NodeConditionTypeRequiredPackages = "RequiredPackages" + NodeConditionTypeNFSClientInstalled = "NFSClientInstalled" + NodeConditionTypeSchedulable = "Schedulable" ) const ( @@ -16,6 +19,12 @@ const ( NodeConditionReasonKubernetesNodePressure = "KubernetesNodePressure" NodeConditionReasonUnknownNodeConditionTrue = "UnknownNodeConditionTrue" NodeConditionReasonNoMountPropagationSupport = "NoMountPropagationSupport" + NodeConditionReasonMultipathdIsRunning = "MultipathdIsRunning" + NodeConditionReasonUnknownOS = "UnknownOS" + NodeConditionReasonNamespaceExecutorErr = "NamespaceExecutorErr" + NodeConditionReasonPackagesNotInstalled = "PackagesNotInstalled" + NodeConditionReasonKernelConfigIsNotFound = "KernelConfigIsNotFound" + NodeConditionReasonNFSClientIsNotFound = "NFSClientIsNotFound" NodeConditionReasonKubernetesNodeCordoned = "KubernetesNodeCordoned" ) @@ -44,6 +53,7 @@ const ( ErrorReplicaScheduleEngineImageNotReady = "none of the node candidates contains a ready engine image" ErrorReplicaScheduleHardNodeAffinityNotSatisfied = "hard affinity cannot be satisfied" ErrorReplicaScheduleSchedulingFailed = "replica scheduling failed" + ErrorReplicaSchedulePrecheckNewReplicaFailed = "precheck new replica failed" ) type DiskType string @@ -55,6 +65,14 @@ const ( DiskTypeBlock = DiskType("block") ) +type DiskDriver string + +const ( + DiskDriverNone = DiskDriver("") + DiskDriverAuto = DiskDriver("auto") + DiskDriverAio = DiskDriver("aio") +) + type SnapshotCheckStatus struct { // +optional LastPeriodicCheckedAt metav1.Time `json:"lastPeriodicCheckedAt"` @@ -66,6 +84,9 @@ type DiskSpec struct { Type DiskType `json:"diskType"` // +optional Path string `json:"path"` + // +kubebuilder:validation:Enum="";auto;aio + // +optional + DiskDriver DiskDriver `json:"diskDriver"` // +optional AllowScheduling bool `json:"allowScheduling"` // +optional @@ -92,9 +113,17 @@ type DiskStatus struct { // +optional DiskUUID string `json:"diskUUID"` // +optional + DiskName string `json:"diskName"` + // +optional + DiskPath string `json:"diskPath"` + // +optional Type DiskType `json:"diskType"` // +optional + DiskDriver DiskDriver `json:"diskDriver"` + // +optional FSType string `json:"filesystemType"` + // +optional + InstanceManagerName string `json:"instanceManagerName"` } // NodeSpec defines the desired state of the Longhorn node diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/recurringjob.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/recurringjob.go index 4fd1f07e..37452d5d 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/recurringjob.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/recurringjob.go @@ -53,6 +53,10 @@ type RecurringJobSpec struct { // The label of the snapshot/backup. // +optional Labels map[string]string `json:"labels,omitempty"` + // The parameters of the snapshot/backup. + // Support parameters: "full-backup-interval". + // +optional + Parameters map[string]string `json:"parameters,omitempty"` } // RecurringJobStatus defines the observed state of the Longhorn recurring job @@ -60,6 +64,9 @@ type RecurringJobStatus struct { // The owner ID which is responsible to reconcile this recurring job CR. // +optional OwnerID string `json:"ownerID"` + // The number of jobs that have been triggered. + // +optional + ExecutionCount int `json:"executionCount"` } // +genclient diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/setting.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/setting.go index 020319b3..4cdd1651 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/setting.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/setting.go @@ -8,6 +8,7 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // +kubebuilder:subresource:status // +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Value",type=string,JSONPath=`.value`,description="The value of the setting" +// +kubebuilder:printcolumn:name="Applied",type=boolean,JSONPath=`.status.applied`,description="The setting is applied" // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` // Setting is where Longhorn stores setting object. @@ -17,6 +18,15 @@ type Setting struct { // The value of the setting. Value string `json:"value"` + + // The status of the setting. + Status SettingStatus `json:"status,omitempty"` +} + +// SettingStatus defines the observed state of the Longhorn setting +type SettingStatus struct { + // The setting is applied. + Applied bool `json:"applied"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/systembackup.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/systembackup.go index 6bcb9a8e..a5a007a9 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/systembackup.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/systembackup.go @@ -5,14 +5,15 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" type SystemBackupState string const ( - SystemBackupStateDeleting = SystemBackupState("Deleting") - SystemBackupStateError = SystemBackupState("Error") - SystemBackupStateGenerating = SystemBackupState("Generating") - SystemBackupStateNone = SystemBackupState("") - SystemBackupStateReady = SystemBackupState("Ready") - SystemBackupStateSyncing = SystemBackupState("Syncing") - SystemBackupStateUploading = SystemBackupState("Uploading") - SystemBackupStateVolumeBackup = SystemBackupState("CreatingVolumeBackups") + SystemBackupStateDeleting = SystemBackupState("Deleting") + SystemBackupStateError = SystemBackupState("Error") + SystemBackupStateGenerating = SystemBackupState("Generating") + SystemBackupStateNone = SystemBackupState("") + SystemBackupStateReady = SystemBackupState("Ready") + SystemBackupStateSyncing = SystemBackupState("Syncing") + SystemBackupStateUploading = SystemBackupState("Uploading") + SystemBackupStateVolumeBackup = SystemBackupState("CreatingVolumeBackups") + SystemBackupStateBackingImageBackup = SystemBackupState("CreatingBackingImageBackups") SystemBackupConditionTypeError = "Error" diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/volume.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/volume.go index de2a03c9..528a4d28 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/volume.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/volume.go @@ -96,6 +96,10 @@ type VolumeCloneStatus struct { Snapshot string `json:"snapshot"` // +optional State VolumeCloneState `json:"state"` + // +optional + AttemptCount int `json:"attemptCount"` + // +optional + NextAllowedAttemptAt string `json:"nextAllowedAttemptAt"` } const ( @@ -160,6 +164,15 @@ const ( ReplicaDiskSoftAntiAffinityDisabled = ReplicaDiskSoftAntiAffinity("disabled") ) +// +kubebuilder:validation:Enum=ignored;enabled;disabled +type FreezeFilesystemForSnapshot string + +const ( + FreezeFilesystemForSnapshotDefault = FreezeFilesystemForSnapshot("ignored") + FreezeFilesystemForSnapshotEnabled = FreezeFilesystemForSnapshot("enabled") + FreezeFilesystemForSnapshotDisabled = FreezeFilesystemForSnapshot("disabled") +) + // Deprecated. type BackendStoreDriverType string @@ -177,14 +190,6 @@ const ( DataEngineTypeAll = DataEngineType("all") ) -type OfflineReplicaRebuilding string - -const ( - OfflineReplicaRebuildingIgnored = OfflineReplicaRebuilding("ignored") - OfflineReplicaRebuildingEnabled = OfflineReplicaRebuilding("enabled") - OfflineReplicaRebuildingDisabled = OfflineReplicaRebuilding("disabled") -) - type KubernetesStatus struct { // +optional PVName string `json:"pvName"` @@ -289,15 +294,14 @@ type VolumeSpec struct { // +kubebuilder:validation:Enum=v1;v2 // +optional DataEngine DataEngineType `json:"dataEngine"` - // OfflineReplicaRebuilding is used to determine if the offline replica rebuilding feature is enabled or not - // +kubebuilder:validation:Enum=ignored;disabled;enabled - // +optional - OfflineReplicaRebuilding OfflineReplicaRebuilding `json:"offlineReplicaRebuilding"` // +optional SnapshotMaxCount int `json:"snapshotMaxCount"` // +kubebuilder:validation:Type=string // +optional SnapshotMaxSize int64 `json:"snapshotMaxSize,string"` + // Setting that freezes the filesystem on the root partition before a snapshot is created. + // +optional + FreezeFilesystemForSnapshot FreezeFilesystemForSnapshot `json:"freezeFilesystemForSnapshot"` } // VolumeStatus defines the observed state of the Longhorn volume @@ -349,8 +353,6 @@ type VolumeStatus struct { ShareEndpoint string `json:"shareEndpoint"` // +optional ShareState ShareManagerState `json:"shareState"` - // +optional - OfflineReplicaRebuildingRequired bool `json:"offlineReplicaRebuildingRequired"` } // +genclient diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/zz_generated.deepcopy.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/zz_generated.deepcopy.go index 48cd18da..181d5100 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/zz_generated.deepcopy.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2/zz_generated.deepcopy.go @@ -204,6 +204,22 @@ func (in *BackingImageDataSourceStatus) DeepCopy() *BackingImageDataSourceStatus return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackingImageDiskFileSpec) DeepCopyInto(out *BackingImageDiskFileSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackingImageDiskFileSpec. +func (in *BackingImageDiskFileSpec) DeepCopy() *BackingImageDiskFileSpec { + if in == nil { + return nil + } + out := new(BackingImageDiskFileSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BackingImageDiskFileStatus) DeepCopyInto(out *BackingImageDiskFileStatus) { *out = *in @@ -386,6 +402,21 @@ func (in *BackingImageSpec) DeepCopyInto(out *BackingImageSpec) { (*out)[key] = val } } + if in.DiskFileSpecMap != nil { + in, out := &in.DiskFileSpecMap, &out.DiskFileSpecMap + *out = make(map[string]*BackingImageDiskFileSpec, len(*in)) + for key, val := range *in { + var outVal *BackingImageDiskFileSpec + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(BackingImageDiskFileSpec) + **out = **in + } + (*out)[key] = outVal + } + } if in.SourceParameters != nil { in, out := &in.SourceParameters, &out.SourceParameters *out = make(map[string]string, len(*in)) @@ -393,6 +424,16 @@ func (in *BackingImageSpec) DeepCopyInto(out *BackingImageSpec) { (*out)[key] = val } } + if in.DiskSelector != nil { + in, out := &in.DiskSelector, &out.DiskSelector + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -1894,6 +1935,13 @@ func (in *RecurringJobSpec) DeepCopyInto(out *RecurringJobSpec) { (*out)[key] = val } } + if in.Parameters != nil { + in, out := &in.Parameters, &out.Parameters + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } @@ -2039,6 +2087,7 @@ func (in *Setting) DeepCopyInto(out *Setting) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Status = in.Status return } @@ -2093,6 +2142,22 @@ func (in *SettingList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SettingStatus) DeepCopyInto(out *SettingStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SettingStatus. +func (in *SettingStatus) DeepCopy() *SettingStatus { + if in == nil { + return nil + } + out := new(SettingStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ShareManager) DeepCopyInto(out *ShareManager) { *out = *in diff --git a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/client/clientset/versioned/typed/longhorn/v1beta2/setting.go b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/client/clientset/versioned/typed/longhorn/v1beta2/setting.go index bd2f6055..94bea33a 100644 --- a/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/client/clientset/versioned/typed/longhorn/v1beta2/setting.go +++ b/vendor/github.com/longhorn/longhorn-manager/k8s/pkg/client/clientset/versioned/typed/longhorn/v1beta2/setting.go @@ -40,6 +40,7 @@ type SettingsGetter interface { type SettingInterface interface { Create(ctx context.Context, setting *v1beta2.Setting, opts v1.CreateOptions) (*v1beta2.Setting, error) Update(ctx context.Context, setting *v1beta2.Setting, opts v1.UpdateOptions) (*v1beta2.Setting, error) + UpdateStatus(ctx context.Context, setting *v1beta2.Setting, opts v1.UpdateOptions) (*v1beta2.Setting, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta2.Setting, error) @@ -135,6 +136,22 @@ func (c *settings) Update(ctx context.Context, setting *v1beta2.Setting, opts v1 return } +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *settings) UpdateStatus(ctx context.Context, setting *v1beta2.Setting, opts v1.UpdateOptions) (result *v1beta2.Setting, err error) { + result = &v1beta2.Setting{} + err = c.client.Put(). + Namespace(c.ns). + Resource("settings"). + Name(setting.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(setting). + Do(ctx). + Into(result) + return +} + // Delete takes name of the setting and deletes it. Returns an error if one occurs. func (c *settings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { return c.client.Delete(). diff --git a/vendor/github.com/longhorn/longhorn-manager/types/deploy.go b/vendor/github.com/longhorn/longhorn-manager/types/deploy.go index db885d0d..82d86f40 100644 --- a/vendor/github.com/longhorn/longhorn-manager/types/deploy.go +++ b/vendor/github.com/longhorn/longhorn-manager/types/deploy.go @@ -3,8 +3,12 @@ package types import ( "os" + "github.com/sirupsen/logrus" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + + longhorn "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" ) const ( @@ -89,3 +93,39 @@ func AddGoCoverDirToDaemonSet(daemonset *appsv1.DaemonSet) { }, ) } + +func UpdateDaemonSetTemplateBasedOnStorageNetwork(daemonSet *appsv1.DaemonSet, storageNetwork *longhorn.Setting, isStorageNetworkForRWXVolumeEnabled bool) { + if daemonSet == nil { + return + } + + logger := logrus.WithField("daemonSet", daemonSet.Name) + logger.Infof("Updating DaemonSet template for storage network %v", storageNetwork) + + isContainerNetworkNamespace := IsStorageNetworkForRWXVolume(storageNetwork, isStorageNetworkForRWXVolumeEnabled) + + updateAnnotation := func() { + annotKey := string(CNIAnnotationNetworks) + annotValue := "" + if isContainerNetworkNamespace { + annotValue = CreateCniAnnotationFromSetting(storageNetwork) + } + + logger.WithFields(logrus.Fields{ + "oldValue": daemonSet.Spec.Template.Annotations[annotKey], + "newValue": annotValue, + }).Debugf("Updating template %v annotation", annotKey) + + if daemonSet.Spec.Template.Annotations == nil { + daemonSet.Spec.Template.Annotations = make(map[string]string) + } + + daemonSet.Spec.Template.Annotations[annotKey] = annotValue + + if annotValue == "" { + delete(daemonSet.Spec.Template.Annotations, annotKey) + } + } + + updateAnnotation() +} diff --git a/vendor/github.com/longhorn/longhorn-manager/types/setting.go b/vendor/github.com/longhorn/longhorn-manager/types/setting.go index a831d938..0a15d00f 100644 --- a/vendor/github.com/longhorn/longhorn-manager/types/setting.go +++ b/vendor/github.com/longhorn/longhorn-manager/types/setting.go @@ -19,7 +19,6 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "github.com/longhorn/longhorn-manager/meta" - "github.com/longhorn/longhorn-manager/util" longhorn "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" ) @@ -41,6 +40,9 @@ const ( SettingTypeInt = SettingType("int") SettingTypeBool = SettingType("bool") SettingTypeDeprecated = SettingType("deprecated") + + ValueIntRangeMinimum = "minimum" + ValueIntRangeMaximum = "maximum" ) type SettingName string @@ -57,6 +59,7 @@ const ( SettingNameSupportBundleManagerImage = SettingName("support-bundle-manager-image") SettingNameReplicaSoftAntiAffinity = SettingName("replica-soft-anti-affinity") SettingNameReplicaAutoBalance = SettingName("replica-auto-balance") + SettingNameReplicaAutoBalanceDiskPressurePercentage = SettingName("replica-auto-balance-disk-pressure-percentage") SettingNameStorageOverProvisioningPercentage = SettingName("storage-over-provisioning-percentage") SettingNameStorageMinimalAvailablePercentage = SettingName("storage-minimal-available-percentage") SettingNameStorageReservedPercentageForDefaultDisk = SettingName("storage-reserved-percentage-for-default-disk") @@ -84,6 +87,7 @@ const ( SettingNameDisableRevisionCounter = SettingName("disable-revision-counter") SettingNameReplicaReplenishmentWaitInterval = SettingName("replica-replenishment-wait-interval") SettingNameConcurrentReplicaRebuildPerNodeLimit = SettingName("concurrent-replica-rebuild-per-node-limit") + SettingNameConcurrentBackingImageCopyReplenishPerNodeLimit = SettingName("concurrent-backing-image-replenish-per-node-limit") SettingNameConcurrentBackupRestorePerNodeLimit = SettingName("concurrent-volume-backup-restore-per-node-limit") SettingNameSystemManagedPodsImagePullPolicy = SettingName("system-managed-pods-image-pull-policy") SettingNameAllowVolumeCreationWithDegradedAvailability = SettingName("allow-volume-creation-with-degraded-availability") @@ -96,11 +100,13 @@ const ( SettingNameKubernetesClusterAutoscalerEnabled = SettingName("kubernetes-cluster-autoscaler-enabled") SettingNameOrphanAutoDeletion = SettingName("orphan-auto-deletion") SettingNameStorageNetwork = SettingName("storage-network") + SettingNameStorageNetworkForRWXVolumeEnabled = SettingName("storage-network-for-rwx-volume-enabled") SettingNameFailedBackupTTL = SettingName("failed-backup-ttl") SettingNameRecurringSuccessfulJobsHistoryLimit = SettingName("recurring-successful-jobs-history-limit") SettingNameRecurringFailedJobsHistoryLimit = SettingName("recurring-failed-jobs-history-limit") SettingNameRecurringJobMaxRetention = SettingName("recurring-job-max-retention") SettingNameSupportBundleFailedHistoryLimit = SettingName("support-bundle-failed-history-limit") + SettingNameSupportBundleNodeCollectionTimeout = SettingName("support-bundle-node-collection-timeout") SettingNameDeletingConfirmationFlag = SettingName("deleting-confirmation-flag") SettingNameEngineReplicaTimeout = SettingName("engine-replica-timeout") SettingNameSnapshotDataIntegrity = SettingName("snapshot-data-integrity") @@ -111,11 +117,11 @@ const ( SettingNameRemoveSnapshotsDuringFilesystemTrim = SettingName("remove-snapshots-during-filesystem-trim") SettingNameFastReplicaRebuildEnabled = SettingName("fast-replica-rebuild-enabled") SettingNameReplicaFileSyncHTTPClientTimeout = SettingName("replica-file-sync-http-client-timeout") + SettingNameLongGPRCTimeOut = SettingName("long-grpc-timeout") SettingNameBackupCompressionMethod = SettingName("backup-compression-method") SettingNameBackupConcurrentLimit = SettingName("backup-concurrent-limit") SettingNameRestoreConcurrentLimit = SettingName("restore-concurrent-limit") SettingNameLogLevel = SettingName("log-level") - SettingNameOfflineReplicaRebuilding = SettingName("offline-replica-rebuilding") SettingNameReplicaDiskSoftAntiAffinity = SettingName("replica-disk-soft-anti-affinity") SettingNameAllowEmptyNodeSelectorVolume = SettingName("allow-empty-node-selector-volume") SettingNameAllowEmptyDiskSelectorVolume = SettingName("allow-empty-disk-selector-volume") @@ -124,6 +130,12 @@ const ( SettingNameV2DataEngine = SettingName("v2-data-engine") SettingNameV2DataEngineHugepageLimit = SettingName("v2-data-engine-hugepage-limit") SettingNameV2DataEngineGuaranteedInstanceManagerCPU = SettingName("v2-data-engine-guaranteed-instance-manager-cpu") + SettingNameV2DataEngineLogLevel = SettingName("v2-data-engine-log-level") + SettingNameV2DataEngineLogFlags = SettingName("v2-data-engine-log-flags") + SettingNameFreezeFilesystemForSnapshot = SettingName("freeze-filesystem-for-snapshot") + SettingNameAutoCleanupSnapshotWhenDeleteBackup = SettingName("auto-cleanup-when-delete-backup") + SettingNameDefaultMinNumberOfBackingImageCopies = SettingName("default-min-number-of-backing-image-copies") + SettingNameRWXVolumeFastFailover = SettingName("rwx-volume-fast-failover") ) var ( @@ -139,6 +151,7 @@ var ( SettingNameSupportBundleManagerImage, SettingNameReplicaSoftAntiAffinity, SettingNameReplicaAutoBalance, + SettingNameReplicaAutoBalanceDiskPressurePercentage, SettingNameStorageOverProvisioningPercentage, SettingNameStorageMinimalAvailablePercentage, SettingNameStorageReservedPercentageForDefaultDisk, @@ -166,6 +179,7 @@ var ( SettingNameDisableRevisionCounter, SettingNameReplicaReplenishmentWaitInterval, SettingNameConcurrentReplicaRebuildPerNodeLimit, + SettingNameConcurrentBackingImageCopyReplenishPerNodeLimit, SettingNameConcurrentBackupRestorePerNodeLimit, SettingNameSystemManagedPodsImagePullPolicy, SettingNameAllowVolumeCreationWithDegradedAvailability, @@ -178,11 +192,13 @@ var ( SettingNameKubernetesClusterAutoscalerEnabled, SettingNameOrphanAutoDeletion, SettingNameStorageNetwork, + SettingNameStorageNetworkForRWXVolumeEnabled, SettingNameFailedBackupTTL, SettingNameRecurringSuccessfulJobsHistoryLimit, SettingNameRecurringFailedJobsHistoryLimit, SettingNameRecurringJobMaxRetention, SettingNameSupportBundleFailedHistoryLimit, + SettingNameSupportBundleNodeCollectionTimeout, SettingNameDeletingConfirmationFlag, SettingNameEngineReplicaTimeout, SettingNameSnapshotDataIntegrity, @@ -193,6 +209,7 @@ var ( SettingNameRemoveSnapshotsDuringFilesystemTrim, SettingNameFastReplicaRebuildEnabled, SettingNameReplicaFileSyncHTTPClientTimeout, + SettingNameLongGPRCTimeOut, SettingNameBackupCompressionMethod, SettingNameBackupConcurrentLimit, SettingNameRestoreConcurrentLimit, @@ -201,11 +218,16 @@ var ( SettingNameV2DataEngine, SettingNameV2DataEngineHugepageLimit, SettingNameV2DataEngineGuaranteedInstanceManagerCPU, - SettingNameOfflineReplicaRebuilding, + SettingNameV2DataEngineLogLevel, + SettingNameV2DataEngineLogFlags, SettingNameReplicaDiskSoftAntiAffinity, SettingNameAllowEmptyNodeSelectorVolume, SettingNameAllowEmptyDiskSelectorVolume, SettingNameDisableSnapshotPurge, + SettingNameFreezeFilesystemForSnapshot, + SettingNameAutoCleanupSnapshotWhenDeleteBackup, + SettingNameDefaultMinNumberOfBackingImageCopies, + SettingNameRWXVolumeFastFailover, } ) @@ -230,6 +252,8 @@ type SettingDefinition struct { ReadOnly bool `json:"readOnly"` Default string `json:"default"` Choices []string `json:"options,omitempty"` // +optional + // Use map to present minimum and maximum value instead of using int directly, so we can omitempy and distinguish 0 or nil at the same time. + ValueIntRange map[string]int `json:"range,omitempty"` // +optional } var settingDefinitionsLock sync.RWMutex @@ -247,6 +271,7 @@ var ( SettingNameSupportBundleManagerImage: SettingDefinitionSupportBundleManagerImage, SettingNameReplicaSoftAntiAffinity: SettingDefinitionReplicaSoftAntiAffinity, SettingNameReplicaAutoBalance: SettingDefinitionReplicaAutoBalance, + SettingNameReplicaAutoBalanceDiskPressurePercentage: SettingDefinitionReplicaAutoBalanceDiskPressurePercentage, SettingNameStorageOverProvisioningPercentage: SettingDefinitionStorageOverProvisioningPercentage, SettingNameStorageMinimalAvailablePercentage: SettingDefinitionStorageMinimalAvailablePercentage, SettingNameStorageReservedPercentageForDefaultDisk: SettingDefinitionStorageReservedPercentageForDefaultDisk, @@ -274,6 +299,7 @@ var ( SettingNameDisableRevisionCounter: SettingDefinitionDisableRevisionCounter, SettingNameReplicaReplenishmentWaitInterval: SettingDefinitionReplicaReplenishmentWaitInterval, SettingNameConcurrentReplicaRebuildPerNodeLimit: SettingDefinitionConcurrentReplicaRebuildPerNodeLimit, + SettingNameConcurrentBackingImageCopyReplenishPerNodeLimit: SettingDefinitionConcurrentBackingImageCopyReplenishPerNodeLimit, SettingNameConcurrentBackupRestorePerNodeLimit: SettingDefinitionConcurrentVolumeBackupRestorePerNodeLimit, SettingNameSystemManagedPodsImagePullPolicy: SettingDefinitionSystemManagedPodsImagePullPolicy, SettingNameAllowVolumeCreationWithDegradedAvailability: SettingDefinitionAllowVolumeCreationWithDegradedAvailability, @@ -286,11 +312,13 @@ var ( SettingNameKubernetesClusterAutoscalerEnabled: SettingDefinitionKubernetesClusterAutoscalerEnabled, SettingNameOrphanAutoDeletion: SettingDefinitionOrphanAutoDeletion, SettingNameStorageNetwork: SettingDefinitionStorageNetwork, + SettingNameStorageNetworkForRWXVolumeEnabled: SettingDefinitionStorageNetworkForRWXVolumeEnabled, SettingNameFailedBackupTTL: SettingDefinitionFailedBackupTTL, SettingNameRecurringSuccessfulJobsHistoryLimit: SettingDefinitionRecurringSuccessfulJobsHistoryLimit, SettingNameRecurringFailedJobsHistoryLimit: SettingDefinitionRecurringFailedJobsHistoryLimit, SettingNameRecurringJobMaxRetention: SettingDefinitionRecurringJobMaxRetention, SettingNameSupportBundleFailedHistoryLimit: SettingDefinitionSupportBundleFailedHistoryLimit, + SettingNameSupportBundleNodeCollectionTimeout: SettingDefinitionSupportBundleNodeCollectionTimeout, SettingNameDeletingConfirmationFlag: SettingDefinitionDeletingConfirmationFlag, SettingNameEngineReplicaTimeout: SettingDefinitionEngineReplicaTimeout, SettingNameSnapshotDataIntegrity: SettingDefinitionSnapshotDataIntegrity, @@ -301,6 +329,7 @@ var ( SettingNameRemoveSnapshotsDuringFilesystemTrim: SettingDefinitionRemoveSnapshotsDuringFilesystemTrim, SettingNameFastReplicaRebuildEnabled: SettingDefinitionFastReplicaRebuildEnabled, SettingNameReplicaFileSyncHTTPClientTimeout: SettingDefinitionReplicaFileSyncHTTPClientTimeout, + SettingNameLongGPRCTimeOut: SettingDefinitionLongGPRCTimeOut, SettingNameBackupCompressionMethod: SettingDefinitionBackupCompressionMethod, SettingNameBackupConcurrentLimit: SettingDefinitionBackupConcurrentLimit, SettingNameRestoreConcurrentLimit: SettingDefinitionRestoreConcurrentLimit, @@ -309,11 +338,16 @@ var ( SettingNameV2DataEngine: SettingDefinitionV2DataEngine, SettingNameV2DataEngineHugepageLimit: SettingDefinitionV2DataEngineHugepageLimit, SettingNameV2DataEngineGuaranteedInstanceManagerCPU: SettingDefinitionV2DataEngineGuaranteedInstanceManagerCPU, - SettingNameOfflineReplicaRebuilding: SettingDefinitionOfflineReplicaRebuilding, + SettingNameV2DataEngineLogLevel: SettingDefinitionV2DataEngineLogLevel, + SettingNameV2DataEngineLogFlags: SettingDefinitionV2DataEngineLogFlags, SettingNameReplicaDiskSoftAntiAffinity: SettingDefinitionReplicaDiskSoftAntiAffinity, SettingNameAllowEmptyNodeSelectorVolume: SettingDefinitionAllowEmptyNodeSelectorVolume, SettingNameAllowEmptyDiskSelectorVolume: SettingDefinitionAllowEmptyDiskSelectorVolume, SettingNameDisableSnapshotPurge: SettingDefinitionDisableSnapshotPurge, + SettingNameFreezeFilesystemForSnapshot: SettingDefinitionFreezeFilesystemForSnapshot, + SettingNameAutoCleanupSnapshotWhenDeleteBackup: SettingDefinitionAutoCleanupSnapshotWhenDeleteBackup, + SettingNameDefaultMinNumberOfBackingImageCopies: SettingDefinitionDefaultMinNumberOfBackingImageCopies, + SettingNameRWXVolumeFastFailover: SettingDefinitionRWXVolumeFastFailover, } SettingDefinitionBackupTarget = SettingDefinition{ @@ -354,6 +388,9 @@ var ( Required: true, ReadOnly: false, Default: "300", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionFailedBackupTTL = SettingDefinition{ @@ -367,6 +404,9 @@ var ( Required: true, ReadOnly: false, Default: "1440", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionRestoreVolumeRecurringJobs = SettingDefinition{ @@ -452,6 +492,16 @@ var ( Default: "false", } + SettingDefinitionFreezeFilesystemForSnapshot = SettingDefinition{ + DisplayName: "Freeze Filesystem For Snapshot", + Description: "Setting that freezes the filesystem on the root partition before a snapshot is created.", + Category: SettingCategorySnapshot, + Type: SettingTypeBool, + Required: true, + ReadOnly: false, + Default: "false", + } + SettingDefinitionReplicaAutoBalance = SettingDefinition{ DisplayName: "Replica Auto Balance", Description: "Enable this setting automatically rebalances replicas when discovered an available node.\n\n" + @@ -477,6 +527,22 @@ var ( }, } + SettingDefinitionReplicaAutoBalanceDiskPressurePercentage = SettingDefinition{ + DisplayName: "Replica Auto Balance Disk Pressure Threshold (%)", + Description: "Percentage of currently used storage that triggers automatic replica rebalancing.\n\n" + + "When the threshold is reached, Longhorn automatically rebuilds replicas that are under disk pressure on another disk within the same node.\n\n" + + "To disable this feature, set the value to 0.\n\n" + + "**Note:** This setting takes effect only when the following conditions are met:\n" + + "- **Replica Auto Balance** is set to **best-effort**.\n" + + "- At least one other disk on the node has sufficient available space.\n\n" + + "**Note:** This feature is not affected by the **Replica Node Level Soft Anti-Affinity** setting.", + Category: SettingCategoryScheduling, + Type: SettingTypeInt, + Required: true, + ReadOnly: false, + Default: "90", + } + SettingDefinitionStorageOverProvisioningPercentage = SettingDefinition{ DisplayName: "Storage Over Provisioning Percentage", Description: "The over-provisioning percentage defines how much storage can be allocated relative to the hard drive's capacity", @@ -485,6 +551,9 @@ var ( Required: true, ReadOnly: false, Default: "100", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionStorageMinimalAvailablePercentage = SettingDefinition{ @@ -495,6 +564,10 @@ var ( Required: true, ReadOnly: false, Default: "25", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + ValueIntRangeMaximum: 100, + }, } SettingDefinitionStorageReservedPercentageForDefaultDisk = SettingDefinition{ @@ -505,6 +578,10 @@ var ( Required: true, ReadOnly: false, Default: "30", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + ValueIntRangeMaximum: 100, + }, } SettingDefinitionUpgradeChecker = SettingDefinition{ @@ -564,6 +641,10 @@ var ( Required: true, ReadOnly: false, Default: "3", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + ValueIntRangeMaximum: 20, + }, } SettingDefinitionDefaultDataLocality = SettingDefinition{ @@ -760,12 +841,12 @@ var ( SettingDefinitionDisableRevisionCounter = SettingDefinition{ DisplayName: "Disable Revision Counter", - Description: "This setting is only for volumes created by UI. By default, this is false meaning there will be a revision counter file to track every write to the volume. During salvage recovering Longhorn will pick the repica with largest revision counter as candidate to recover the whole volume. If revision counter is disabled, Longhorn will not track every write to the volume. During the salvage recovering, Longhorn will use the 'volume-head-xxx.img' file last modification time and file size to pick the replica candidate to recover the whole volume.", + Description: "This setting is only for volumes created by UI. By default, this is true meaning Longhorn will not have revision counter file to track every write to the volume. During the salvage recovering, Longhorn will use the 'volume-head-xxx.img' file last modification time and file size to pick the replica candidate to recover the whole volume. If this setting is false, there will be a revision counter file to track every write to the volume. During salvage recovering Longhorn will pick the replica with largest revision counter as candidate to recover the whole volume.", Category: SettingCategoryGeneral, Type: SettingTypeBool, Required: true, ReadOnly: false, - Default: "false", + Default: "true", } SettingDefinitionReplicaReplenishmentWaitInterval = SettingDefinition{ @@ -777,6 +858,9 @@ var ( Required: true, ReadOnly: false, Default: "600", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionConcurrentReplicaRebuildPerNodeLimit = SettingDefinition{ @@ -792,6 +876,23 @@ var ( Required: true, ReadOnly: false, Default: "5", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, + } + + SettingDefinitionConcurrentBackingImageCopyReplenishPerNodeLimit = SettingDefinition{ + DisplayName: "Concurrent Backing Image Replenish Per Node Limit", + Description: "This setting controls how many backing images copy on a node can be replenished simultaneously. \n\n" + + "Typically, Longhorn can block the backing image copy starting once the current replenishing count on a node exceeds the limit. But when the value is 0, it means disabling the backing image replenish.", + Category: SettingCategoryDangerZone, + Type: SettingTypeInt, + Required: true, + ReadOnly: false, + Default: "5", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionConcurrentVolumeBackupRestorePerNodeLimit = SettingDefinition{ @@ -804,6 +905,9 @@ var ( Required: true, ReadOnly: false, Default: "5", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionSystemManagedPodsImagePullPolicy = SettingDefinition{ @@ -862,6 +966,9 @@ var ( Required: true, ReadOnly: false, Default: "0", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionBackingImageCleanupWaitInterval = SettingDefinition{ @@ -872,6 +979,9 @@ var ( Required: true, ReadOnly: false, Default: "60", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionBackingImageRecoveryWaitInterval = SettingDefinition{ @@ -885,6 +995,9 @@ var ( Required: true, ReadOnly: false, Default: "300", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionGuaranteedInstanceManagerCPU = SettingDefinition{ @@ -905,6 +1018,10 @@ var ( Required: true, ReadOnly: false, Default: "12", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + ValueIntRangeMaximum: 40, + }, } SettingDefinitionKubernetesClusterAutoscalerEnabled = SettingDefinition{ @@ -937,6 +1054,7 @@ var ( DisplayName: "Storage Network", Description: "Longhorn uses the storage network for in-cluster data traffic. Leave this blank to use the Kubernetes cluster network. \n\n" + "To segregate the storage network, input the pre-existing NetworkAttachmentDefinition in **/** format. \n\n" + + "By default, this setting applies only to RWO (Read-Write-Once) volumes. For RWX (Read-Write-Many) volumes, enable 'Storage Network for RWX Volume' setting.\n\n" + "WARNING: \n\n" + " - The cluster must have pre-existing Multus installed, and NetworkAttachmentDefinition IPs are reachable between nodes. \n\n" + " - When applying the setting, Longhorn will try to restart all instance-manager, and backing-image-manager pods if all volumes are detached and eventually restart the instance manager pod without instances running on the instance manager. \n\n", @@ -947,6 +1065,19 @@ var ( Default: CniNetworkNone, } + SettingDefinitionStorageNetworkForRWXVolumeEnabled = SettingDefinition{ + DisplayName: "Storage Network for RWX Volume Enabled", + Description: "This setting allows Longhorn to use the storage network for RWX (Read-Write-Many) volume.\n\n" + + "WARNING: \n\n" + + " - This setting should change after all Longhorn RWX volumes are detached because some Longhorn component pods will be recreated to apply the setting. \n\n" + + " - When this setting is enabled, the RWX volumes are mounted with the storage network within the CSI plugin pod container network namespace. As a result, restarting the CSI plugin pod when there are attached RWX volumes may lead to its data path become unresponsive. When this occurs, you must restart the workload pod to re-establish the mount connection. Alternatively, you can enable the 'Automatically Delete Workload Pod when The Volume Is Detached Unexpectedly' setting to allow Longhorn to automatically delete the workload pod.\n\n", + Category: SettingCategoryDangerZone, + Type: SettingTypeBool, + Required: false, + ReadOnly: false, + Default: "false", + } + SettingDefinitionRecurringSuccessfulJobsHistoryLimit = SettingDefinition{ DisplayName: "Cronjob Successful Jobs History Limit", Description: "This setting specifies how many successful backup or snapshot job histories should be retained. \n\n" + @@ -956,6 +1087,9 @@ var ( Required: false, ReadOnly: false, Default: "1", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionRecurringFailedJobsHistoryLimit = SettingDefinition{ @@ -967,6 +1101,9 @@ var ( Required: false, ReadOnly: false, Default: "1", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionRecurringJobMaxRetention = SettingDefinition{ @@ -977,6 +1114,10 @@ var ( Required: true, ReadOnly: false, Default: "100", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + ValueIntRangeMaximum: MaxSnapshotNum, + }, } SettingDefinitionSupportBundleFailedHistoryLimit = SettingDefinition{ @@ -989,6 +1130,23 @@ var ( Required: false, ReadOnly: false, Default: "1", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, + } + + SettingDefinitionSupportBundleNodeCollectionTimeout = SettingDefinition{ + DisplayName: "Timeout for Support Bundle Node Collection", + Description: "In minutes. The timeout for collecting node bundles for support bundle generation. The default value is 30.\n\n" + + "When the timeout is reached, the support bundle generation will proceed without requiring the collection of node bundles. \n\n", + Category: SettingCategoryGeneral, + Type: SettingTypeInt, + Required: true, + ReadOnly: false, + Default: "30", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionDeletingConfirmationFlag = SettingDefinition{ @@ -1011,6 +1169,10 @@ var ( Required: true, ReadOnly: false, Default: "8", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 8, + ValueIntRangeMaximum: 30, + }, } SettingDefinitionSnapshotDataIntegrity = SettingDefinition{ @@ -1093,6 +1255,24 @@ var ( Required: true, ReadOnly: false, Default: "30", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 5, + ValueIntRangeMaximum: 120, + }, + } + + SettingDefinitionLongGPRCTimeOut = SettingDefinition{ + DisplayName: "Long gRPC Timeout", + Description: "Number of seconds that Longhorn allows for the completion of replica rebuilding and snapshot cloning operations.", + Category: SettingCategoryGeneral, + Type: SettingTypeInt, + Required: true, + ReadOnly: false, + Default: "86400", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + ValueIntRangeMaximum: 604800, + }, } SettingDefinitionBackupCompressionMethod = SettingDefinition{ @@ -1122,6 +1302,9 @@ var ( Required: true, ReadOnly: false, Default: "2", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + }, } SettingDefinitionRestoreConcurrentLimit = SettingDefinition{ @@ -1132,6 +1315,9 @@ var ( Required: true, ReadOnly: false, Default: "2", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + }, } SettingDefinitionLogLevel = SettingDefinition{ @@ -1142,20 +1328,7 @@ var ( Required: true, ReadOnly: false, Default: "Info", - } - - SettingDefinitionOfflineReplicaRebuilding = SettingDefinition{ - DisplayName: "Offline Replica Rebuilding", - Description: "This setting allows users to enable the offline replica rebuilding for volumes using v2 data engine.", - Category: SettingCategoryV2DataEngine, - Type: SettingTypeString, - Required: true, - ReadOnly: false, - Default: string(longhorn.OfflineReplicaRebuildingEnabled), - Choices: []string{ - string(longhorn.OfflineReplicaRebuildingEnabled), - string(longhorn.OfflineReplicaRebuildingDisabled), - }, + Choices: []string{"Panic", "Fatal", "Error", "Warn", "Info", "Debug", "Trace"}, } SettingDefinitionV1DataEngine = SettingDefinition{ @@ -1189,6 +1362,9 @@ var ( Required: true, ReadOnly: true, Default: "2048", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 0, + }, } SettingDefinitionV2DataEngineGuaranteedInstanceManagerCPU = SettingDefinition{ @@ -1203,6 +1379,10 @@ var ( Required: true, ReadOnly: false, Default: "1250", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1000, + ValueIntRangeMaximum: 8000, + }, } SettingDefinitionReplicaDiskSoftAntiAffinity = SettingDefinition{ @@ -1244,6 +1424,60 @@ var ( ReadOnly: false, Default: "false", } + + SettingDefinitionV2DataEngineLogLevel = SettingDefinition{ + DisplayName: "V2 Data Engine Log Level", + Description: "The log level used in SPDK target daemon (spdk_tgt) of V2 Data Engine. Supported values are: Error, Warning, Notice, Info and Debug. By default Notice.", + Category: SettingCategoryV2DataEngine, + Type: SettingTypeString, + Required: true, + ReadOnly: false, + Default: "Notice", + Choices: []string{"Error", "Warning", "Notice", "Info", "Debug"}, + } + + SettingDefinitionV2DataEngineLogFlags = SettingDefinition{ + DisplayName: "V2 Data Engine Log Flags", + Description: "The log flags used in SPDK target daemon (spdk_tgt) of V2 Data Engine.", + Category: SettingCategoryV2DataEngine, + Type: SettingTypeString, + Required: false, + ReadOnly: false, + Default: "", + } + + SettingDefinitionAutoCleanupSnapshotWhenDeleteBackup = SettingDefinition{ + DisplayName: "Automatically Cleanup Snapshot When Deleting Backup", + Description: "This setting enables Longhorn to automatically cleanup snapshots when removing backup.", + Category: SettingCategorySnapshot, + Type: SettingTypeBool, + Required: true, + ReadOnly: false, + Default: "false", + } + + SettingDefinitionDefaultMinNumberOfBackingImageCopies = SettingDefinition{ + DisplayName: "Default Minimum Number of BackingImage Copies", + Description: "The default minimum number of backing image copies Longhorn maintains", + Category: SettingCategoryGeneral, + Type: SettingTypeInt, + Required: true, + ReadOnly: false, + Default: "3", + ValueIntRange: map[string]int{ + ValueIntRangeMinimum: 1, + }, + } + + SettingDefinitionRWXVolumeFastFailover = SettingDefinition{ + DisplayName: "RWX Volume Fast Failover", + Description: "Turn on logic to detect and move stale RWX volumes quickly (Experimental)", + Category: SettingCategoryGeneral, + Type: SettingTypeBool, + Required: true, + ReadOnly: false, + Default: "false", + } ) type NodeDownPodDeletionPolicy string @@ -1299,252 +1533,18 @@ func ValidateSetting(name, value string) (err error) { return fmt.Errorf("required setting %v shouldn't be empty", sName) } - switch sName { - case SettingNameBackupTarget: - u, err := url.Parse(value) - if err != nil { - return errors.Wrapf(err, "failed to parse %v as url", value) - } - - // Check whether have $ or , have been set in BackupTarget path - regStr := `[\$\,]` - if u.Scheme == "cifs" { - // The $ in SMB/CIFS URIs means that the share is hidden. - regStr = `[\,]` - } - - reg := regexp.MustCompile(regStr) - findStr := reg.FindAllString(u.Path, -1) - if len(findStr) != 0 { - return fmt.Errorf("value %s, contains %v", value, strings.Join(findStr, " or ")) - } - - // boolean - case SettingNameCreateDefaultDiskLabeledNodes: - fallthrough - case SettingNameAllowRecurringJobWhileVolumeDetached: - fallthrough - case SettingNameReplicaSoftAntiAffinity: - fallthrough - case SettingNameDisableSchedulingOnCordonedNode: - fallthrough - case SettingNameReplicaZoneSoftAntiAffinity: - fallthrough - case SettingNameAllowVolumeCreationWithDegradedAvailability: - fallthrough - case SettingNameAutoCleanupSystemGeneratedSnapshot: - fallthrough - case SettingNameAutoCleanupRecurringJobBackupSnapshot: - fallthrough - case SettingNameAutoDeletePodWhenVolumeDetachedUnexpectedly: - fallthrough - case SettingNameKubernetesClusterAutoscalerEnabled: - fallthrough - case SettingNameOrphanAutoDeletion: - fallthrough - case SettingNameDeletingConfirmationFlag: - fallthrough - case SettingNameRestoreVolumeRecurringJobs: - fallthrough - case SettingNameRemoveSnapshotsDuringFilesystemTrim: - fallthrough - case SettingNameFastReplicaRebuildEnabled: - fallthrough - case SettingNameUpgradeChecker: - fallthrough - case SettingNameV1DataEngine: - fallthrough - case SettingNameV2DataEngine: - fallthrough - case SettingNameAllowEmptyNodeSelectorVolume: - fallthrough - case SettingNameAllowEmptyDiskSelectorVolume: - fallthrough - case SettingNameAllowCollectingLonghornUsage: - fallthrough - case SettingNameDetachManuallyAttachedVolumesWhenCordoned: - fallthrough - case SettingNameReplicaDiskSoftAntiAffinity: - fallthrough - case SettingNameDisableSnapshotPurge: - if value != "true" && value != "false" { - return fmt.Errorf("value %v of setting %v should be true or false", value, sName) - } - - case SettingNameStorageOverProvisioningPercentage: - if _, err := strconv.Atoi(value); err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - // additional check whether over provisioning percentage is positive - value, err := util.ConvertSize(value) - if err != nil { - return errors.Wrapf(err, "failed to parse %v as size", value) - } - if value < 0 { - return fmt.Errorf("value %v should be positive", value) - } - case SettingNameStorageReservedPercentageForDefaultDisk: - fallthrough - case SettingNameStorageMinimalAvailablePercentage: - if _, err := strconv.Atoi(value); err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - // additional check whether minimal available percentage is between 0 to 100 - value, err := util.ConvertSize(value) - if err != nil { - return errors.Wrapf(err, "failed to parse %v as size", value) - } - if value < 0 || value > 100 { - return fmt.Errorf("value %v should between 0 to 100", value) - } - case SettingNameDefaultReplicaCount: - c, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "value %v is not number", value) - } - if err := ValidateReplicaCount(c); err != nil { - return errors.Wrapf(err, "failed to validate replica count %v", c) - } - case SettingNameReplicaAutoBalance: - if err := ValidateReplicaAutoBalance(longhorn.ReplicaAutoBalance(value)); err != nil { - return errors.Wrapf(err, "failed to validate replica auto balance: %v", value) - } - case SettingNameBackingImageCleanupWaitInterval: - fallthrough - case SettingNameBackingImageRecoveryWaitInterval: - fallthrough - case SettingNameReplicaReplenishmentWaitInterval: - fallthrough - case SettingNameConcurrentReplicaRebuildPerNodeLimit: - fallthrough - case SettingNameConcurrentBackupRestorePerNodeLimit: - fallthrough - case SettingNameConcurrentAutomaticEngineUpgradePerNodeLimit: - fallthrough - case SettingNameSupportBundleFailedHistoryLimit: - fallthrough - case SettingNameBackupstorePollInterval: - fallthrough - case SettingNameRecurringSuccessfulJobsHistoryLimit: - fallthrough - case SettingNameRecurringFailedJobsHistoryLimit: - fallthrough - case SettingNameFailedBackupTTL: - fallthrough - case SettingNameV2DataEngineHugepageLimit: - value, err := strconv.Atoi(value) - if err != nil { - errors.Wrapf(err, "value %v is not a number", value) - } - if value < 0 { - return fmt.Errorf("the value %v shouldn't be less than 0", value) - } - case SettingNameTaintToleration: - if _, err = UnmarshalTolerations(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameSystemManagedComponentsNodeSelector: - if _, err = UnmarshalNodeSelector(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameStorageNetwork: - if err = ValidateStorageNetwork(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameReplicaFileSyncHTTPClientTimeout: - timeout, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - - if timeout < 5 || timeout > 120 { - return fmt.Errorf("the value %v should be between 5 and 120", value) - } - case SettingNameRecurringJobMaxRetention: - maxNumber, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - if maxNumber < 1 || maxNumber > MaxSnapshotNum { - return fmt.Errorf("the value %v should be between 1 and %v", maxNumber, MaxSnapshotNum) - } - case SettingNameEngineReplicaTimeout: - timeout, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - - if timeout < 8 || timeout > 30 { - return fmt.Errorf("the value %v should be between 8 and 30", value) - } - case SettingNameBackupConcurrentLimit: - fallthrough - case SettingNameRestoreConcurrentLimit: - val, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "value %v is not a number", value) - } - - if val < 1 { - return fmt.Errorf("the value %v shouldn't be less than 1", value) - } - case SettingNameOfflineReplicaRebuilding: - if err = ValidateOfflineReplicaRebuilding(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameSnapshotDataIntegrity: - if err = ValidateSnapshotDataIntegrity(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameBackupCompressionMethod: - if err = ValidateBackupCompressionMethod(value); err != nil { - return errors.Wrapf(err, "the value of %v is invalid", sName) - } - case SettingNameSnapshotDataIntegrityCronJob: - schedule, err := cron.ParseStandard(value) - if err != nil { - return errors.Wrapf(err, "invalid cron job format: %v", value) - } - - runAt := schedule.Next(time.Unix(0, 0)) - nextRunAt := schedule.Next(runAt) + if err := validateBool(definition, value); err != nil { + return errors.Wrapf(err, "failed to validate the setting %v", sName) + } - logrus.Infof("The interval between two data integrity checks is %v seconds", nextRunAt.Sub(runAt).Seconds()) + if err := validateInt(definition, value); err != nil { + return errors.Wrapf(err, "failed to validate the setting %v", sName) + } - // multi-choices - case SettingNameNodeDownPodDeletionPolicy: - fallthrough - case SettingNameDefaultDataLocality: - fallthrough - case SettingNameNodeDrainPolicy: - fallthrough - case SettingNameSystemManagedPodsImagePullPolicy: - definition, _ := GetSettingDefinition(sName) - choices := definition.Choices - if !isValidChoice(choices, value) { - return fmt.Errorf("value %v is not a valid choice, available choices %v", value, choices) - } - case SettingNameGuaranteedInstanceManagerCPU: - i, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "guaranteed v1 data engine instance manager cpu value %v is not a valid integer", value) - } - if i < 0 || i > 40 { - return fmt.Errorf("guaranteed v1 data engine instance manager cpu value %v should be between 0 to 40", value) - } - case SettingNameV2DataEngineGuaranteedInstanceManagerCPU: - i, err := strconv.Atoi(value) - if err != nil { - return errors.Wrapf(err, "guaranteed v2 data engine instance manager cpu value %v is not a valid integer", value) - } - if i < 1000 || i > 8000 { - return fmt.Errorf("guaranteed v2 data engine instance manager cpu value %v should be between 1000 to 8000", value) - } - case SettingNameLogLevel: - if err := ValidateLogLevel(value); err != nil { - return errors.Wrapf(err, "failed to validate log level %v", value) - } + if err := validateString(sName, definition, value); err != nil { + return errors.Wrapf(err, "failed to validate the setting %v", sName) } + return nil } @@ -1734,3 +1734,106 @@ func GetDangerZoneSettings() sets.Set[SettingName] { return settingList } + +func validateBool(definition SettingDefinition, value string) error { + if definition.Type != SettingTypeBool { + return nil + } + + if value != "true" && value != "false" { + return fmt.Errorf("value %v should be true or false", value) + } + return nil +} + +func validateInt(definition SettingDefinition, value string) error { + if definition.Type != SettingTypeInt { + return nil + } + + intValue, err := strconv.Atoi(value) + if err != nil { + return errors.Wrapf(err, "value %v is not a number", value) + } + + valueIntRange := definition.ValueIntRange + if minValue, exists := valueIntRange[ValueIntRangeMinimum]; exists { + if intValue < minValue { + return fmt.Errorf("value %v should be larger than %v", intValue, minValue) + } + } + + if maxValue, exists := valueIntRange[ValueIntRangeMaximum]; exists { + if intValue > maxValue { + return fmt.Errorf("value %v should be less than %v", intValue, maxValue) + } + } + return nil +} + +func validateString(sName SettingName, definition SettingDefinition, value string) error { + if definition.Type != SettingTypeString { + return nil + } + + // multi-choices + if definition.Choices != nil && len(definition.Choices) > 0 { + if !isValidChoice(definition.Choices, value) { + return fmt.Errorf("value %v is not a valid choice, available choices %v", value, definition.Choices) + } + return nil + } + + switch sName { + case SettingNameSnapshotDataIntegrityCronJob: + schedule, err := cron.ParseStandard(value) + if err != nil { + return errors.Wrapf(err, "invalid cron job format: %v", value) + } + + runAt := schedule.Next(time.Unix(0, 0)) + nextRunAt := schedule.Next(runAt) + + logrus.Infof("The interval between two data integrity checks is %v seconds", nextRunAt.Sub(runAt).Seconds()) + + case SettingNameTaintToleration: + if _, err := UnmarshalTolerations(value); err != nil { + return errors.Wrapf(err, "the value of %v is invalid", sName) + } + case SettingNameSystemManagedComponentsNodeSelector: + if _, err := UnmarshalNodeSelector(value); err != nil { + return errors.Wrapf(err, "the value of %v is invalid", sName) + } + + case SettingNameBackupTarget: + u, err := url.Parse(value) + if err != nil { + return errors.Wrapf(err, "failed to parse %v as url", value) + } + + // Check whether have $ or , have been set in BackupTarget path + regStr := `[\$\,]` + if u.Scheme == "cifs" { + // The $ in SMB/CIFS URIs means that the share is hidden. + regStr = `[\,]` + } + + reg := regexp.MustCompile(regStr) + findStr := reg.FindAllString(u.Path, -1) + if len(findStr) != 0 { + return fmt.Errorf("value %s, contains %v", value, strings.Join(findStr, " or ")) + } + + case SettingNameStorageNetwork: + if err := ValidateStorageNetwork(value); err != nil { + return errors.Wrapf(err, "the value of %v is invalid", sName) + } + + case SettingNameV2DataEngineLogFlags: + if err := ValidateV2DataEngineLogFlags(value); err != nil { + return errors.Wrapf(err, "failed to validate v2 data engine log flags %v", value) + } + } + + return nil +} diff --git a/vendor/github.com/longhorn/longhorn-manager/types/types.go b/vendor/github.com/longhorn/longhorn-manager/types/types.go index e703404d..132c1a2f 100644 --- a/vendor/github.com/longhorn/longhorn-manager/types/types.go +++ b/vendor/github.com/longhorn/longhorn-manager/types/types.go @@ -47,6 +47,7 @@ const ( LonghornKindRecurringJobList = "RecurringJobList" LonghornKindSettingList = "SettingList" LonghornKindVolumeList = "VolumeList" + LonghornKindBackingImageList = "BackingImageList" KubernetesKindClusterRole = "ClusterRole" KubernetesKindClusterRoleBinding = "ClusterRoleBinding" @@ -56,7 +57,6 @@ const ( KubernetesKindJob = "Job" KubernetesKindPersistentVolume = "PersistentVolume" KubernetesKindPersistentVolumeClaim = "PersistentVolumeClaim" - KubernetesKindPodSecurityPolicy = "PodSecurityPolicy" KubernetesKindRole = "Role" KubernetesKindRoleBinding = "RoleBinding" KubernetesKindService = "Service" @@ -68,9 +68,9 @@ const ( KubernetesKindConfigMapList = "ConfigMapList" KubernetesKindDaemonSetList = "DaemonSetList" KubernetesKindDeploymentList = "DeploymentList" + KubernetesKindPod = "Pod" KubernetesKindPersistentVolumeList = "PersistentVolumeList" KubernetesKindPersistentVolumeClaimList = "PersistentVolumeClaimList" - KubernetesKindPodSecurityPolicyList = "PodSecurityPolicyList" KubernetesKindRoleList = "RoleList" KubernetesKindRoleBindingList = "RoleBindingList" KubernetesKindServiceList = "ServiceList" @@ -174,6 +174,10 @@ const ( LonghornLabelLastSystemRestoreBackup = "last-system-restored-backup" LonghornLabelDataEngine = "data-engine" LonghornLabelVersion = "version" + LonghornLabelAdmissionWebhook = "admission-webhook" + LonghornLabelConversionWebhook = "conversion-webhook" + + LonghornRecoveryBackendServiceName = "longhorn-recovery-backend" LonghornLabelValueEnabled = "enabled" LonghornLabelValueIgnored = "ignored" @@ -205,6 +209,13 @@ const ( CniNetworkNone = "" StorageNetworkInterface = "lhnet1" + + KubeAPIQPS = 50 + KubeAPIBurst = 100 +) + +const ( + RecurringJobBackupParameterFullBackupInterval = "full-backup-interval" ) const ( @@ -213,6 +224,7 @@ const ( const ( EnvNodeName = "NODE_NAME" + EnvPodName = "POD_NAME" EnvPodNamespace = "POD_NAMESPACE" EnvPodIP = "POD_IP" EnvServiceAccount = "SERVICE_ACCOUNT" @@ -257,6 +269,17 @@ const ( InstanceManagerSuffixChecksumLength = 32 ) +const ( + // CryptoKeyProvider specifies how the CryptoKeyValue is retrieved + // We currently only support passphrase retrieval via direct secret values + CryptoKeyProvider = "CRYPTO_KEY_PROVIDER" + CryptoKeyValue = "CRYPTO_KEY_VALUE" + CryptoKeyCipher = "CRYPTO_KEY_CIPHER" + CryptoKeyHash = "CRYPTO_KEY_HASH" + CryptoKeySize = "CRYPTO_KEY_SIZE" + CryptoPBKDF = "CRYPTO_PBKDF" +) + // SettingsRelatedToVolume should match the items in datastore.GetLabelsForVolumesFollowsGlobalSettings // // TODO: May need to add the data locality check @@ -402,6 +425,25 @@ func GetManagerLabels() map[string]string { "app": LonghornManagerDaemonSetName, } } + +func GetAdmissionWebhookLabel() map[string]string { + return map[string]string{ + GetLonghornLabelKey(LonghornLabelAdmissionWebhook): AdmissionWebhookServiceName, + } +} + +func GetRecoveryBackendLabel() map[string]string { + return map[string]string{ + GetLonghornLabelKey(LonghornLabelRecoveryBackend): LonghornRecoveryBackendServiceName, + } +} + +func GetConversionWebhookLabel() map[string]string { + return map[string]string{ + GetLonghornLabelKey(LonghornLabelConversionWebhook): ConversionWebhookServiceName, + } +} + func GetEngineImageLabels(engineImageName string) map[string]string { labels := GetBaseLabelsForSystemManagedComponent() labels[GetLonghornLabelComponentKey()] = LonghornLabelEngineImage @@ -638,8 +680,8 @@ func GetShareManagerImageChecksumName(image string) string { return shareManagerImagePrefix + util.GetStringChecksum(strings.TrimSpace(image))[:ImageChecksumNameLength] } -func GetOrphanChecksumNameForOrphanedDirectory(nodeID, diskName, diskPath, diskUUID, dirName string) string { - return orphanPrefix + util.GetStringChecksumSHA256(strings.TrimSpace(fmt.Sprintf("%s-%s-%s-%s-%s", nodeID, diskName, diskPath, diskUUID, dirName))) +func GetOrphanChecksumNameForOrphanedDataStore(nodeID, diskName, diskPath, diskUUID, dataStore string) string { + return orphanPrefix + util.GetStringChecksumSHA256(strings.TrimSpace(fmt.Sprintf("%s-%s-%s-%s-%s", nodeID, diskName, diskPath, diskUUID, dataStore))) } func GetShareManagerPodNameFromShareManagerName(smName string) string { @@ -725,16 +767,41 @@ func ErrorIsInvalidState(err error) bool { } func ValidateReplicaCount(count int) error { - if count < 1 || count > 20 { - return fmt.Errorf("replica count value must between 1 to 20") + + definition, _ := GetSettingDefinition(SettingNameDefaultReplicaCount) + valueIntRange := definition.ValueIntRange + + if count < valueIntRange[ValueIntRangeMinimum] || count > valueIntRange[ValueIntRangeMaximum] { + return fmt.Errorf("replica count value %v must between %v to %v", count, valueIntRange[ValueIntRangeMinimum], valueIntRange[ValueIntRangeMaximum]) + } + return nil +} + +func ValidateMinNumberOfBackingIamgeCopies(number int) error { + definition, exists := GetSettingDefinition(SettingNameDefaultMinNumberOfBackingImageCopies) + if !exists { + return fmt.Errorf("setting %v definition does not exists", SettingNameDefaultMinNumberOfBackingImageCopies) + } + valueIntRange := definition.ValueIntRange + + if number < valueIntRange[ValueIntRangeMinimum] { + return fmt.Errorf("minimum number of backing image copies %v must larger than %v", number, valueIntRange[ValueIntRangeMaximum]) } return nil } -func ValidateLogLevel(level string) error { - if _, err := logrus.ParseLevel(level); err != nil { - return fmt.Errorf("log level is invalid") +func ValidateV2DataEngineLogFlags(flags string) error { + if flags == "" { + return nil + } + + pattern := "^[a-zA-Z,]+$" + reg := regexp.MustCompile(pattern) + + if !reg.MatchString(flags) { + return fmt.Errorf("log flags %s is invalid", flags) } + return nil } @@ -783,15 +850,6 @@ func ValidateStorageNetwork(value string) (err error) { return nil } -func ValidateOfflineReplicaRebuilding(mode string) error { - if mode != string(longhorn.OfflineReplicaRebuildingIgnored) && - mode != string(longhorn.OfflineReplicaRebuildingEnabled) && - mode != string(longhorn.OfflineReplicaRebuildingDisabled) { - return fmt.Errorf("invalid offline replica rebuilding mode: %v", mode) - } - return nil -} - func ValidateSnapshotDataIntegrity(mode string) error { if mode != string(longhorn.SnapshotDataIntegrityDisabled) && mode != string(longhorn.SnapshotDataIntegrityEnabled) && @@ -810,8 +868,16 @@ func ValidateBackupCompressionMethod(method string) error { return nil } -func ValidateUnmapMarkSnapChainRemoved(unmapValue longhorn.UnmapMarkSnapChainRemoved) error { - if unmapValue != longhorn.UnmapMarkSnapChainRemovedIgnored && unmapValue != longhorn.UnmapMarkSnapChainRemovedEnabled && unmapValue != longhorn.UnmapMarkSnapChainRemovedDisabled { +func ValidateUnmapMarkSnapChainRemoved(dataEngine longhorn.DataEngineType, unmapValue longhorn.UnmapMarkSnapChainRemoved) error { + if IsDataEngineV2(dataEngine) { + if unmapValue != longhorn.UnmapMarkSnapChainRemovedDisabled { + return fmt.Errorf("invalid UnmapMarkSnapChainRemoved setting: %v", unmapValue) + } + } + + if unmapValue != longhorn.UnmapMarkSnapChainRemovedIgnored && + unmapValue != longhorn.UnmapMarkSnapChainRemovedEnabled && + unmapValue != longhorn.UnmapMarkSnapChainRemovedDisabled { return fmt.Errorf("invalid UnmapMarkSnapChainRemoved setting: %v", unmapValue) } return nil @@ -844,6 +910,15 @@ func ValidateReplicaDiskSoftAntiAffinity(value longhorn.ReplicaDiskSoftAntiAffin return nil } +func ValidateFreezeFilesystemForSnapshot(value longhorn.FreezeFilesystemForSnapshot) error { + if value != longhorn.FreezeFilesystemForSnapshotDefault && + value != longhorn.FreezeFilesystemForSnapshotEnabled && + value != longhorn.FreezeFilesystemForSnapshotDisabled { + return fmt.Errorf("invalid FreezeFilesystemForSnapshot setting: %v", value) + } + return nil +} + func GetDaemonSetNameFromEngineImageName(engineImageName string) string { return "engine-image-" + engineImageName } @@ -959,25 +1034,37 @@ func UnmarshalToNodeTags(s string) ([]string, error) { return res, nil } -func CreateDefaultDisk(dataPath string, storageReservedPercentage int64) (map[string]longhorn.DiskSpec, error) { - fileInfo, err := os.Stat(dataPath) - if err != nil { - if !os.IsNotExist(err) { - return nil, errors.Wrapf(err, "failed to stat %v for creating default disk", dataPath) - } +func IsBDF(addr string) bool { + bdfFormat := "[a-f0-9]{4}:[a-f0-9]{2}:[a-f0-9]{2}\\.[a-f0-9]{1}" + bdfPattern := regexp.MustCompile(bdfFormat) + return bdfPattern.MatchString(addr) +} - // Longhorn is unable to create block-type disk automatically - if strings.HasPrefix(dataPath, "/dev/") { - return nil, errors.Wrapf(err, "creating default block-type disk %v is not supported", dataPath) - } +func IsPotentialBlockDisk(path string) bool { + if IsBDF(path) { + return true + } + + fileInfo, err := os.Stat(path) + if err != nil { + logrus.WithError(err).Warnf("Failed to get file info for %v", path) + return strings.HasPrefix(path, "/dev/") } - // Block-type disk if fileInfo != nil && (fileInfo.Mode()&os.ModeDevice) == os.ModeDevice { + return true + } + + return false +} + +func CreateDefaultDisk(dataPath string, storageReservedPercentage int64) (map[string]longhorn.DiskSpec, error) { + if IsPotentialBlockDisk(dataPath) { return map[string]longhorn.DiskSpec{ DefaultDiskPrefix + util.RandomID(): { Type: longhorn.DiskTypeBlock, Path: dataPath, + DiskDriver: longhorn.DiskDriverAuto, AllowScheduling: true, EvictionRequested: false, StorageReserved: 0, @@ -1000,6 +1087,7 @@ func CreateDefaultDisk(dataPath string, storageReservedPercentage int64) (map[st DefaultDiskPrefix + diskStat.DiskID: { Type: longhorn.DiskTypeFilesystem, Path: diskStat.Path, + DiskDriver: longhorn.DiskDriverNone, AllowScheduling: true, EvictionRequested: false, StorageReserved: diskStat.StorageMaximum * storageReservedPercentage / 100, @@ -1014,18 +1102,15 @@ func ValidateCPUReservationValues(settingName SettingName, instanceManagerCPUStr return errors.Wrapf(err, "invalid guaranteed/requested instance manager CPU value (%v)", instanceManagerCPUStr) } + definition, _ := GetSettingDefinition(settingName) + valueIntRange := definition.ValueIntRange + switch settingName { - case SettingNameGuaranteedInstanceManagerCPU: - isUnderLimit := instanceManagerCPU < 0 - isOverLimit := instanceManagerCPU > 40 + case SettingNameGuaranteedInstanceManagerCPU, SettingNameV2DataEngineGuaranteedInstanceManagerCPU: + isUnderLimit := instanceManagerCPU < valueIntRange[ValueIntRangeMinimum] + isOverLimit := instanceManagerCPU > valueIntRange[ValueIntRangeMaximum] if isUnderLimit || isOverLimit { - return fmt.Errorf("invalid requested v1 data engine instance manager CPUs. Valid instance manager CPU range between 0%% - 40%%") - } - case SettingNameV2DataEngineGuaranteedInstanceManagerCPU: - isUnderLimit := instanceManagerCPU < 1000 - isOverLimit := instanceManagerCPU > 8000 - if isUnderLimit || isOverLimit { - return fmt.Errorf("invalid requested v2 data engine instance manager CPUs. Valid instance manager CPU range between 1000 - 8000 millicpu") + return fmt.Errorf("invalid requested instance manager CPUs. Valid instance manager CPU range between %v - %v millicpu", valueIntRange[ValueIntRangeMinimum], valueIntRange[ValueIntRangeMaximum]) } } return nil @@ -1135,3 +1220,33 @@ func GetPDBNameFromIMName(imName string) string { func GetIMNameFromPDBName(pdbName string) string { return pdbName } + +// IsDataEngineV1 returns true if the given dataEngine is v1 +func IsDataEngineV1(dataEngine longhorn.DataEngineType) bool { + return dataEngine != longhorn.DataEngineTypeV2 +} + +// IsDataEngineV2 returns true if the given dataEngine is v2 +func IsDataEngineV2(dataEngine longhorn.DataEngineType) bool { + return dataEngine == longhorn.DataEngineTypeV2 +} + +// IsStorageNetworkForRWXVolume returns true if the storage network setting value is not empty. +// And isStorageNetworkForRWXVolumeEnabled is true. +func IsStorageNetworkForRWXVolume(storageNetwork *longhorn.Setting, isStorageNetworkForRWXVolumeEnabled bool) bool { + if storageNetwork == nil { + return false + } + return storageNetwork.Value != CniNetworkNone && isStorageNetworkForRWXVolumeEnabled +} + +func MergeStringMaps(baseMap, overwriteMap map[string]string) map[string]string { + result := map[string]string{} + for k, v := range baseMap { + result[k] = v + } + for k, v := range overwriteMap { + result[k] = v + } + return result +} diff --git a/vendor/github.com/longhorn/longhorn-manager/util/multierror.go b/vendor/github.com/longhorn/longhorn-manager/util/multierror.go index c4f6de2b..883508ff 100644 --- a/vendor/github.com/longhorn/longhorn-manager/util/multierror.go +++ b/vendor/github.com/longhorn/longhorn-manager/util/multierror.go @@ -1,6 +1,7 @@ package util import ( + "sort" "strings" ) @@ -27,6 +28,8 @@ func (me MultiError) Join() string { keys = append(keys, err) } + sort.Strings(keys) + return strings.Join(keys, ";") } diff --git a/vendor/github.com/longhorn/longhorn-manager/util/util.go b/vendor/github.com/longhorn/longhorn-manager/util/util.go index f6d6d167..ebb78f6a 100644 --- a/vendor/github.com/longhorn/longhorn-manager/util/util.go +++ b/vendor/github.com/longhorn/longhorn-manager/util/util.go @@ -71,8 +71,9 @@ const ( DiskConfigFile = "longhorn-disk.cfg" - SizeAlignment = 2 * 1024 * 1024 - MinimalVolumeSize = 10 * 1024 * 1024 + SizeAlignment = 2 * MiB + MinimalVolumeSize = 10 * MiB + MinimalVolumeSizeXFS = 300 * MiB // See https://github.com/longhorn/longhorn/issues/8488 MaxExt4VolumeSize = 16 * TiB MaxXfsVolumeSize = 8*EiB - 1 @@ -235,6 +236,10 @@ func Now() string { return time.Now().UTC().Format(time.RFC3339) } +func TimestampAfterDuration(d time.Duration) string { + return time.Now().Add(d).UTC().Format(time.RFC3339) +} + func ParseTime(t string) (time.Time, error) { return time.Parse(time.RFC3339, t) @@ -502,6 +507,14 @@ func ValidateSnapshotLabels(labels map[string]string) (map[string]string, error) return validLabels, nil } +func ValidateBackupMode(backupMode string) error { + if longhorn.BackupMode(backupMode) != longhorn.BackupModeFull && + longhorn.BackupMode(backupMode) != longhorn.BackupModeIncremental { + return fmt.Errorf("backup mode: %v is not a valid option", backupMode) + } + return nil +} + func ValidateTags(inputTags []string) ([]string, error) { foundTags := make(map[string]struct{}) var tags []string @@ -622,7 +635,9 @@ func IsKubernetesVersionAtLeast(kubeClient clientset.Interface, vers string) (bo } type DiskConfig struct { - DiskUUID string `json:"diskUUID"` + DiskName string `json:"diskName"` + DiskUUID string `json:"diskUUID"` + DiskDriver longhorn.DiskDriver `json:"diskDriver"` } func MinInt(a, b int) int { @@ -734,7 +749,7 @@ func TrimFilesystem(volumeName string, encryptedDevice bool) error { return err } - _, err = nsexec.Execute([]string{}, lhtypes.BinaryFstrim, []string{validMountpoint}, lhtypes.ExecuteDefaultTimeout) + _, err = nsexec.Execute(nil, lhtypes.BinaryFstrim, []string{validMountpoint}, time.Hour) if err != nil { return errors.Wrapf(err, "cannot find volume %v mount info on host", volumeName) } @@ -862,4 +877,5 @@ func GetDataEngineForDiskType(diskType longhorn.DiskType) longhorn.DataEngineTyp return longhorn.DataEngineTypeV2 } return longhorn.DataEngineTypeV1 + } diff --git a/vendor/github.com/longhorn/longhorn-manager/util/volume.go b/vendor/github.com/longhorn/longhorn-manager/util/volume.go index 2987bc90..deaf54d7 100644 --- a/vendor/github.com/longhorn/longhorn-manager/util/volume.go +++ b/vendor/github.com/longhorn/longhorn-manager/util/volume.go @@ -10,3 +10,7 @@ import ( func IsVolumeMigrating(v *longhorn.Volume) bool { return v.Spec.MigrationNodeID != "" || v.Status.CurrentMigrationNodeID != "" } + +func IsMigratableVolume(v *longhorn.Volume) bool { + return v.Spec.Migratable && v.Spec.AccessMode == longhorn.AccessModeReadWriteMany +} diff --git a/vendor/github.com/power-devops/perfstat/cpustat.go b/vendor/github.com/power-devops/perfstat/cpustat.go index d456e68e..10f543fa 100644 --- a/vendor/github.com/power-devops/perfstat/cpustat.go +++ b/vendor/github.com/power-devops/perfstat/cpustat.go @@ -136,4 +136,3 @@ func CpuUtilTotalStat() (*CPUUtil, error) { u := perfstatcpuutil2cpuutil(cpuutil) return &u, nil } - diff --git a/vendor/github.com/power-devops/perfstat/doc.go b/vendor/github.com/power-devops/perfstat/doc.go index a0439c5a..9730a61c 100644 --- a/vendor/github.com/power-devops/perfstat/doc.go +++ b/vendor/github.com/power-devops/perfstat/doc.go @@ -37,24 +37,24 @@ func DisableLVMStat() {} // CpuStat() returns array of CPU structures with information about // logical CPUs on the system. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html func CpuStat() ([]CPU, error) { return nil, fmt.Errorf("not implemented") } // CpuTotalStat() returns general information about CPUs on the system. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html func CpuTotalStat() (*CPUTotal, error) { return nil, fmt.Errorf("not implemented") } // CpuUtilStat() calculates CPU utilization. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { return nil, fmt.Errorf("not implemented") } diff --git a/vendor/github.com/power-devops/perfstat/helpers.go b/vendor/github.com/power-devops/perfstat/helpers.go index 654cdcf3..d5268ab5 100644 --- a/vendor/github.com/power-devops/perfstat/helpers.go +++ b/vendor/github.com/power-devops/perfstat/helpers.go @@ -8,6 +8,7 @@ package perfstat #include #include +#include #include "c_helpers.h" */ @@ -763,3 +764,56 @@ func fsinfo2filesystem(n *C.struct_fsinfo) FileSystem { return i } + +func lparinfo2partinfo(n C.lpar_info_format2_t) PartitionInfo { + var i PartitionInfo + + i.Version = int(n.version) + i.OnlineMemory = uint64(n.online_memory) + i.TotalDispatchTime = uint64(n.tot_dispatch_time) + i.PoolIdleTime = uint64(n.pool_idle_time) + i.DispatchLatency = uint64(n.dispatch_latency) + i.LparFlags = uint(n.lpar_flags) + i.PCpusInSys = uint(n.pcpus_in_sys) + i.OnlineVCpus = uint(n.online_vcpus) + i.OnlineLCpus = uint(n.online_lcpus) + i.PCpusInPool = uint(n.pcpus_in_pool) + i.UnallocCapacity = uint(n.unalloc_capacity) + i.EntitledCapacity = uint(n.entitled_capacity) + i.VariableWeight = uint(n.variable_weight) + i.UnallocWeight = uint(n.unalloc_weight) + i.MinReqVCpuCapacity = uint(n.min_req_vcpu_capacity) + i.GroupId = uint8(n.group_id) + i.PoolId = uint8(n.pool_id) + i.ShCpusInSys = uint(n.shcpus_in_sys) + i.MaxPoolCapacity = uint(n.max_pool_capacity) + i.EntitledPoolCapacity = uint(n.entitled_pool_capacity) + i.PoolMaxTime = uint64(n.pool_max_time) + i.PoolBusyTime = uint64(n.pool_busy_time) + i.PoolScaledBusyTime = uint64(n.pool_scaled_busy_time) + i.ShCpuTotalTime = uint64(n.shcpu_tot_time) + i.ShCpuBusyTime = uint64(n.shcpu_busy_time) + i.ShCpuScaledBusyTime = uint64(n.shcpu_scaled_busy_time) + i.EntMemCapacity = uint64(n.ent_mem_capacity) + i.PhysMem = uint64(n.phys_mem) + i.VrmPoolPhysMem = uint64(n.vrm_pool_physmem) + i.HypPageSize = uint(n.hyp_pagesize) + i.VrmPoolId = int(n.vrm_pool_id) + i.VrmGroupId = int(n.vrm_group_id) + i.VarMemWeight = int(n.var_mem_weight) + i.UnallocVarMemWeight = int(n.unalloc_var_mem_weight) + i.UnallocEntMemCapacity = uint64(n.unalloc_ent_mem_capacity) + i.TrueOnlineMemory = uint64(n.true_online_memory) + i.AmeOnlineMemory = uint64(n.ame_online_memory) + i.AmeType = uint8(n.ame_type) + i.SpecExecMode = uint8(n.spec_exec_mode) + i.AmeFactor = uint(n.ame_factor) + i.EmPartMajorCode = uint(n.em_part_major_code) + i.EmPartMinorCode = uint(n.em_part_minor_code) + i.BytesCoalesced = uint64(n.bytes_coalesced) + i.BytesCoalescedMemPool = uint64(n.bytes_coalesced_mempool) + i.PurrCoalescing = uint64(n.purr_coalescing) + i.SpurrCoalescing = uint64(n.spurr_coalescing) + + return i +} diff --git a/vendor/github.com/power-devops/perfstat/lparstat.go b/vendor/github.com/power-devops/perfstat/lparstat.go index 06f79fd5..470a1af2 100644 --- a/vendor/github.com/power-devops/perfstat/lparstat.go +++ b/vendor/github.com/power-devops/perfstat/lparstat.go @@ -7,11 +7,13 @@ package perfstat #cgo LDFLAGS: -lperfstat #include +#include */ import "C" import ( "fmt" + "unsafe" ) func PartitionStat() (*PartitionConfig, error) { @@ -25,3 +27,14 @@ func PartitionStat() (*PartitionConfig, error) { return &p, nil } + +func LparInfo() (*PartitionInfo, error) { + var pinfo C.lpar_info_format2_t + + rc := C.lpar_get_info(C.LPAR_INFO_FORMAT2, unsafe.Pointer(&pinfo), C.sizeof_lpar_info_format2_t) + if rc != 0 { + return nil, fmt.Errorf("lpar_get_info() error") + } + p := lparinfo2partinfo(pinfo) + return &p, nil +} diff --git a/vendor/github.com/power-devops/perfstat/systemcfg.go b/vendor/github.com/power-devops/perfstat/systemcfg.go index 7f9277bc..b7c7b725 100644 --- a/vendor/github.com/power-devops/perfstat/systemcfg.go +++ b/vendor/github.com/power-devops/perfstat/systemcfg.go @@ -71,6 +71,7 @@ const ( SC_TM_VER = 59 /* Transaction Memory version, 0 - not capable */ SC_NX_CAP = 60 /* NX GZIP capable */ SC_PKS_STATE = 61 /* Platform KeyStore */ + SC_MMA_VER = 62 ) /* kernel attributes */ @@ -120,6 +121,7 @@ const ( IMPL_POWER7 = 0x8000 /* 7 class CPU */ IMPL_POWER8 = 0x10000 /* 8 class CPU */ IMPL_POWER9 = 0x20000 /* 9 class CPU */ + IMPL_POWER10 = 0x20000 /* 10 class CPU */ ) // Values for implementation field for IA64 Architectures @@ -152,11 +154,13 @@ const ( PV_7 = 0x200000 /* Power PC 7 */ PV_8 = 0x300000 /* Power PC 8 */ PV_9 = 0x400000 /* Power PC 9 */ + PV_10 = 0x500000 /* Power PC 10 */ PV_5_Compat = 0x0F8000 /* Power PC 5 */ PV_6_Compat = 0x108000 /* Power PC 6 */ PV_7_Compat = 0x208000 /* Power PC 7 */ PV_8_Compat = 0x308000 /* Power PC 8 */ PV_9_Compat = 0x408000 /* Power PC 9 */ + PV_10_Compat = 0x508000 /* Power PC 10 */ PV_RESERVED_2 = 0x0A0000 /* source compatability */ PV_RESERVED_3 = 0x0B0000 /* source compatability */ PV_RS2 = 0x040000 /* Power RS2 */ @@ -182,19 +186,21 @@ const ( // Macros for identifying physical processor const ( - PPI4_1 = 0x35 - PPI4_2 = 0x38 - PPI4_3 = 0x39 - PPI4_4 = 0x3C - PPI4_5 = 0x44 - PPI5_1 = 0x3A - PPI5_2 = 0x3B - PPI6_1 = 0x3E - PPI7_1 = 0x3F - PPI7_2 = 0x4A - PPI8_1 = 0x4B - PPI8_2 = 0x4D - PPI9 = 0x4E + PPI4_1 = 0x35 + PPI4_2 = 0x38 + PPI4_3 = 0x39 + PPI4_4 = 0x3C + PPI4_5 = 0x44 + PPI5_1 = 0x3A + PPI5_2 = 0x3B + PPI6_1 = 0x3E + PPI7_1 = 0x3F + PPI7_2 = 0x4A + PPI8_1 = 0x4B + PPI8_2 = 0x4D + PPI9 = 0x4E + PPI9_1 = 0x4E + PPI10_1 = 0x80 ) // Macros for kernel attributes @@ -292,14 +298,32 @@ func GetCPUImplementation() string { return "POWER8" case impl&IMPL_POWER9 != 0: return "POWER9" + case impl&IMPL_POWER10 != 0: + return "Power10" default: return "Unknown" } } +func POWER10OrNewer() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 { + return true + } + return false +} + +func POWER10() bool { + impl := unix.Getsystemcfg(SC_IMPL) + if impl&IMPL_POWER10 != 0 { + return true + } + return false +} + func POWER9OrNewer() bool { impl := unix.Getsystemcfg(SC_IMPL) - if impl&IMPL_POWER9 != 0 { + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 { return true } return false @@ -315,7 +339,7 @@ func POWER9() bool { func POWER8OrNewer() bool { impl := unix.Getsystemcfg(SC_IMPL) - if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 { + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 { return true } return false @@ -331,7 +355,7 @@ func POWER8() bool { func POWER7OrNewer() bool { impl := unix.Getsystemcfg(SC_IMPL) - if impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 { + if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 { return true } return false @@ -420,6 +444,8 @@ func PksEnabled() bool { func CPUMode() string { impl := unix.Getsystemcfg(SC_VERS) switch impl { + case PV_10, PV_10_Compat: + return "Power10" case PV_9, PV_9_Compat: return "POWER9" case PV_8, PV_8_Compat: diff --git a/vendor/github.com/power-devops/perfstat/types_disk.go b/vendor/github.com/power-devops/perfstat/types_disk.go index ca1493d8..50e323db 100644 --- a/vendor/github.com/power-devops/perfstat/types_disk.go +++ b/vendor/github.com/power-devops/perfstat/types_disk.go @@ -29,8 +29,8 @@ type DiskTotal struct { // Disk Adapter Types const ( DA_SCSI = 0 /* 0 ==> SCSI, SAS, other legacy adapter types */ - DA_VSCSI /* 1 ==> Virtual SCSI/SAS Adapter */ - DA_FCA /* 2 ==> Fiber Channel Adapter */ + DA_VSCSI = 1 /* 1 ==> Virtual SCSI/SAS Adapter */ + DA_FCA = 2 /* 2 ==> Fiber Channel Adapter */ ) type DiskAdapter struct { diff --git a/vendor/github.com/power-devops/perfstat/types_lpar.go b/vendor/github.com/power-devops/perfstat/types_lpar.go index 2d3c32fa..f95f8c30 100644 --- a/vendor/github.com/power-devops/perfstat/types_lpar.go +++ b/vendor/github.com/power-devops/perfstat/types_lpar.go @@ -66,3 +66,64 @@ type PartitionConfig struct { TargetMemExpSize int64 /* Expanded Memory Size in MB */ SubProcessorMode int32 /* Split core mode, its value can be 0,1,2 or 4. 0 for unsupported, 1 for capable but not enabled, 2 or 4 for enabled*/ } + +const ( + AME_TYPE_V1 = 0x1 + AME_TYPE_V2 = 0x2 + LPAR_INFO_CAPPED = 0x01 /* Parition Capped */ + LPAR_INFO_AUTH_PIC = 0x02 /* Authority granted for poolidle*/ + LPAR_INFO_SMT_ENABLED = 0x04 /* SMT Enabled */ + LPAR_INFO_WPAR_ACTIVE = 0x08 /* Process Running Within a WPAR */ + LPAR_INFO_EXTENDED = 0x10 /* Extended shared processor pool information */ + LPAR_INFO_AME_ENABLED = 0x20 /* Active Mem. Expansion (AME) enabled*/ + LPAR_INFO_SEM_ENABLED = 0x40 /* Speculative Execution Mode enabled */ +) + +type PartitionInfo struct { + Version int /* version for this structure */ + OnlineMemory uint64 /* MB of currently online memory */ + TotalDispatchTime uint64 /* Total lpar dispatch time in nsecs */ + PoolIdleTime uint64 /* Idle time of shared CPU pool nsecs*/ + DispatchLatency uint64 /* Max latency inbetween dispatches of this LPAR on physCPUS in nsecs */ + LparFlags uint /* LPAR flags */ + PCpusInSys uint /* # of active licensed physical CPUs in system */ + OnlineVCpus uint /* # of current online virtual CPUs */ + OnlineLCpus uint /* # of current online logical CPUs */ + PCpusInPool uint /* # physical CPUs in shared pool */ + UnallocCapacity uint /* Unallocated Capacity available in shared pool */ + EntitledCapacity uint /* Entitled Processor Capacity for this partition */ + VariableWeight uint /* Variable Processor Capacity Weight */ + UnallocWeight uint /* Unallocated Variable Weight available for this partition */ + MinReqVCpuCapacity uint /* OS minimum required virtual processor capacity. */ + GroupId uint8 /* ID of a LPAR group/aggregation */ + PoolId uint8 /* ID of a shared pool */ + ShCpusInSys uint /* # of physical processors allocated for shared processor use */ + MaxPoolCapacity uint /* Maximum processor capacity of partition's pool */ + EntitledPoolCapacity uint /* Entitled processor capacity of partition's pool */ + PoolMaxTime uint64 /* Summation of maximum time that could be consumed by the pool, in nanoseconds */ + PoolBusyTime uint64 /* Summation of busy time accumulated across all partitions in the pool, in nanoseconds */ + PoolScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all partitions in the pool, in nanoseconds */ + ShCpuTotalTime uint64 /* Summation of total time across all physical processors allocated for shared processor use, in nanoseconds */ + ShCpuBusyTime uint64 /* Summation of busy time accumulated across all shared processor partitions, in nanoseconds */ + ShCpuScaledBusyTime uint64 /* Scaled summation of busy time accumulated across all shared processor partitions, in nanoseconds */ + EntMemCapacity uint64 /* Partition's current entitlement memory capacity setting */ + PhysMem uint64 /* Amount of physical memory, in bytes, currently backing the partition's logical memory */ + VrmPoolPhysMem uint64 /* Total amount of physical memory in the VRM pool */ + HypPageSize uint /* Page size hypervisor is using to virtualize partition's memory */ + VrmPoolId int /* ID of VRM pool */ + VrmGroupId int /* eWLM VRM group to which partition belongs */ + VarMemWeight int /* Partition's current variable memory capacity weighting setting */ + UnallocVarMemWeight int /* Amount of unallocated variable memory capacity weight available to LPAR's group */ + UnallocEntMemCapacity uint64 /* Amount of unallocated I/O memory entitlement available to LPAR's group */ + TrueOnlineMemory uint64 /* true MB of currently online memory */ + AmeOnlineMemory uint64 /* AME MB of currently online memory */ + AmeType uint8 + SpecExecMode uint8 /* Speculative Execution Mode */ + AmeFactor uint /* memory expansion factor for LPAR */ + EmPartMajorCode uint /* Major and minor codes for our */ + EmPartMinorCode uint /* current energy management mode */ + BytesCoalesced uint64 /* The number of bytes of the calling partition.s logical real memory coalesced because they contained duplicated data */ + BytesCoalescedMemPool uint64 /* If the calling partition is authorized to see pool wide statistics then the number of bytes of logical real memory coalesced because they contained duplicated data in the calling partition.s memory pool else set to zero.*/ + PurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/ + SpurrCoalescing uint64 /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero.*/ +} diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/net/LICENSE +++ b/vendor/golang.org/x/net/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 98a49c6b..61f511f9 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -827,10 +827,6 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize()) cc.peerMaxHeaderTableSize = initialHeaderTableSize - if t.AllowHTTP { - cc.nextStreamID = 3 - } - if cs, ok := c.(connectionStater); ok { state := cs.ConnectionState() cc.tlsState = &state diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/sync/LICENSE +++ b/vendor/golang.org/x/sync/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/term/LICENSE b/vendor/golang.org/x/term/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/term/LICENSE +++ b/vendor/golang.org/x/term/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/text/LICENSE b/vendor/golang.org/x/text/LICENSE index 6a66aea5..2a7cf70d 100644 --- a/vendor/golang.org/x/text/LICENSE +++ b/vendor/golang.org/x/text/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go index f0e0cf3c..8f6c7f49 100644 --- a/vendor/golang.org/x/time/rate/rate.go +++ b/vendor/golang.org/x/time/rate/rate.go @@ -52,6 +52,8 @@ func Every(interval time.Duration) Limit { // or its associated context.Context is canceled. // // The methods AllowN, ReserveN, and WaitN consume n tokens. +// +// Limiter is safe for simultaneous use by multiple goroutines. type Limiter struct { mu sync.Mutex limit Limit diff --git a/vendor/modules.txt b/vendor/modules.txt index 5acd01a6..d770cfa5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -109,8 +109,8 @@ github.com/google/uuid # github.com/gorilla/handlers v1.5.2 ## explicit; go 1.20 github.com/gorilla/handlers -# github.com/gorilla/websocket v1.5.1 -## explicit; go 1.20 +# github.com/gorilla/websocket v1.5.3 +## explicit; go 1.12 github.com/gorilla/websocket # github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 ## explicit @@ -145,7 +145,7 @@ github.com/longhorn/go-common-libs/sync github.com/longhorn/go-common-libs/sys github.com/longhorn/go-common-libs/types github.com/longhorn/go-common-libs/utils -# github.com/longhorn/longhorn-manager v1.6.2 +# github.com/longhorn/longhorn-manager v1.7.0 ## explicit; go 1.22.2 github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1 @@ -219,7 +219,7 @@ github.com/peterbourgon/diskv # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors -# github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b +# github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 ## explicit; go 1.14 github.com/power-devops/perfstat # github.com/robfig/cron v1.2.0 @@ -260,7 +260,7 @@ go.starlark.net/resolve go.starlark.net/starlark go.starlark.net/starlarkstruct go.starlark.net/syntax -# golang.org/x/net v0.26.0 +# golang.org/x/net v0.28.0 ## explicit; go 1.18 golang.org/x/net/html golang.org/x/net/html/atom @@ -275,7 +275,7 @@ golang.org/x/net/websocket ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sync v0.7.0 +# golang.org/x/sync v0.8.0 ## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/semaphore @@ -285,10 +285,10 @@ golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.21.0 +# golang.org/x/term v0.23.0 ## explicit; go 1.18 golang.org/x/term -# golang.org/x/text v0.16.0 +# golang.org/x/text v0.17.0 ## explicit; go 1.18 golang.org/x/text/cases golang.org/x/text/encoding @@ -306,8 +306,8 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.3.0 -## explicit +# golang.org/x/time v0.5.0 +## explicit; go 1.18 golang.org/x/time/rate # google.golang.org/protobuf v1.34.2 ## explicit; go 1.20