From 3b2e4995507ff49b0785be360f2041b7f9dd9454 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Fri, 9 Aug 2024 13:05:23 -0700 Subject: [PATCH 01/17] feat: WIP - add maas plugin --- go.mod | 12 + go.sum | 131 ++++ hack/validator.tmpl | 37 + hack/versions.tmpl | 1 + pkg/cmd/validator/validator.go | 48 ++ pkg/components/validator.go | 50 +- pkg/config/constants.go | 2 + pkg/config/versions.go | 1 + pkg/services/validator/maas.go | 662 ++++++++++++++++++ pkg/services/validator/validator_service.go | 35 + .../validator-plugin-maas-values.tmpl | 55 ++ .../validator/validator-rules-maas.tmpl | 7 + .../_validator/testcases/data/validator.yaml | 37 + .../_validator/testcases/test_validator.go | 62 ++ 14 files changed, 1139 insertions(+), 1 deletion(-) create mode 100644 pkg/services/validator/maas.go create mode 100644 pkg/utils/embed/resources/validator/validator-plugin-maas-values.tmpl create mode 100644 pkg/utils/embed/resources/validator/validator-rules-maas.tmpl diff --git a/go.mod b/go.mod index de4c47cd..08ac3178 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/validator-labs/validator v0.1.2 github.com/validator-labs/validator-plugin-aws v0.1.3 github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec + github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 github.com/validator-labs/validator-plugin-network v0.0.22 github.com/validator-labs/validator-plugin-oci v0.1.0 github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240808221109-a93cb7014075 @@ -98,6 +99,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/blang/semver/v4 v4.0.0 // indirect + github.com/canonical/gomaasclient v0.6.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect @@ -108,6 +110,7 @@ require ( github.com/cyberphone/json-canonicalization v0.0.0-20231011164504-785e29786b46 // indirect github.com/cyphar/filepath-securejoin v0.2.5 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirect github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect @@ -163,6 +166,13 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/juju/collections v1.0.4 // indirect + github.com/juju/errors v1.0.0 // indirect + github.com/juju/gomaasapi/v2 v2.3.0 // indirect + github.com/juju/loggo v1.0.0 // indirect + github.com/juju/mgo/v2 v2.0.2 // indirect + github.com/juju/schema v1.0.1 // indirect + github.com/juju/version v0.0.0-20210303051006-2015802527a8 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/kr/text v0.2.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect @@ -242,6 +252,7 @@ require ( google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.30.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect @@ -254,3 +265,4 @@ require ( ) // replace github.com/spectrocloud-labs/prompts-tui => ../../spectrocloud-labs/prompts-tui +replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 diff --git a/go.sum b/go.sum index a5dd0720..8e57b131 100644 --- a/go.sum +++ b/go.sum @@ -76,11 +76,13 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1 h1:3zcU9Ds6BHD3KnwbspH16kMGzLomnI2SNsCkq0i5avI= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1/go.mod h1:1/KTKMeXQ5X7prRFDpUAiwctY8sfb9z3Zj5q/5i7fKk= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= @@ -159,6 +161,8 @@ github.com/aliyun/credentials-go v1.3.1 h1:uq/0v7kWrxmoLGpqjx7vtQ/s03f0zR//0br/x github.com/aliyun/credentials-go v1.3.1/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 h1:J4cbZQZFlLZNy5nGyDyPW0/VI4bivvR0EyZiR/H9Y7k= +github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409/go.mod h1:rRYH2hfLDZ7Z6LNmNBbLzwnu1wK894fznN5pbVtur/s= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= @@ -273,6 +277,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/digitorus/pkcs7 v0.0.0-20230713084857-e76b763bdc49/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 h1:ge14PCmCvPjpMQMIAH7uKg0lrtNSOdpYsRXlwk3QbaE= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= @@ -367,6 +373,7 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -379,6 +386,7 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -406,6 +414,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -443,6 +452,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -464,6 +475,7 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= @@ -484,6 +496,12 @@ github.com/in-toto/in-toto-golang v0.9.0 h1:tHny7ac4KgtsfrG6ybU8gVOZux2H8jN05AXJ github.com/in-toto/in-toto-golang v0.9.0/go.mod h1:xsBVrVsHNsB61++S6Dy2vWosKhuA3lUTQd+eF9HdeMo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jellydator/ttlcache/v3 v3.2.0 h1:6lqVJ8X3ZaUwvzENqPAobDsXNExfUJd61u++uW8a3LE= @@ -500,6 +518,76 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/juju/ansiterm v0.0.0-20160907234532-b99631de12cf/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA= +github.com/juju/clock v0.0.0-20220202072423-1b0f830854c4/go.mod h1:zDZCPSgCJQINeZtQwHx2/cFk4seaBC8Yiqe8V82xiP0= +github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= +github.com/juju/clock v1.0.0/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= +github.com/juju/clock v1.0.2 h1:dJFdUGjtR/76l6U5WLVVI/B3i6+u3Nb9F9s1m+xxrxo= +github.com/juju/clock v1.0.2/go.mod h1:HIBvJ8kiV/n7UHwKuCkdYL4l/MDECztHR2sAvWDxxf0= +github.com/juju/cmd v0.0.0-20171107070456-e74f39857ca0/go.mod h1:yWJQHl73rdSX4DHVKGqkAip+huBslxRwS8m9CrOLq18= +github.com/juju/cmd/v3 v3.0.0-20220202061353-b1cc80b193b0/go.mod h1:EoGJiEG+vbMwO9l+Es0SDTlaQPjH6nLcnnc4NfZB3cY= +github.com/juju/collections v0.0.0-20200605021417-0d0ec82b7271/go.mod h1:5XgO71dV1JClcOJE+4dzdn4HrI5LiyKd7PlVG6eZYhY= +github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= +github.com/juju/collections v1.0.0/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= +github.com/juju/collections v1.0.4 h1:GjL+aN512m2rVDqhPII7P6qB0e+iYFubz8sqBhZaZtk= +github.com/juju/collections v1.0.4/go.mod h1:hVrdB0Zwq9wIU1Fl6ItD2+UETeNeOEs+nGvJufVe+0c= +github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/errors v0.0.0-20200330140219-3fe23663418f/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff/go.mod h1:i1eL7XREII6aHpQ2gApI/v6FkVUDEBremNkcBCKYAcY= +github.com/juju/errors v0.0.0-20220203013757-bd733f3c86b9/go.mod h1:TRm7EVGA3mQOqSVcBySRY7a9Y1/gyVhh/WTCnc5sD4U= +github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM= +github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/juju/gomaasapi/v2 v2.3.0 h1:97yPBrp/U+JwX/UVrBpkWsZKVREmIlykl8n/a58PYlE= +github.com/juju/gomaasapi/v2 v2.3.0/go.mod h1:ZsohFbU4xShV1aSQYQ21hR1lKj7naNGY0SPuyelcUmk= +github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767/go.mod h1:+MaLYz4PumRkkyHYeXJ2G5g5cIW0sli2bOfpmbaMV/g= +github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/loggo v0.0.0-20200526014432-9ce3a2e09b5e/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/loggo v1.0.0 h1:Y6ZMQOGR9Aj3BGkiWx7HBbIx6zNwNkxhVNOHU2i1bl0= +github.com/juju/loggo v1.0.0/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/mgo/v2 v2.0.0-20210302023703-70d5d206e208/go.mod h1:0OChplkvPTZ174D2FYZXg4IB9hbEwyHkD+zT+/eK+Fg= +github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090/go.mod h1:N614SE0a4e+ih2rg96Vi2PeC3cTpUOWgCTv3Cgk974c= +github.com/juju/mgo/v2 v2.0.2 h1:ufYtW2OFNjniTuxOngecP3Mk5sSclo8Zl1mnmyGWUWA= +github.com/juju/mgo/v2 v2.0.2/go.mod h1:Z2QbXIrR9JuJcSyankQOw31tINNA5p3qevW73oDoHsM= +github.com/juju/mutex v0.0.0-20171110020013-1fe2a4bf0a3a/go.mod h1:Y3oOzHH8CQ0Ppt0oCKJ2JFO81/EsWenH5AEqigLH+yY= +github.com/juju/mutex/v2 v2.0.0-20220128011612-57176ebdcfa3/go.mod h1:TTCG9BJD9rCC4DZFz3jA0QvCqFDHw8Eqz0jstwY7RTQ= +github.com/juju/mutex/v2 v2.0.0-20220203023141-11eeddb42c6c/go.mod h1:jwCfBs/smYDaeZLqeaCi8CB8M+tOes4yf827HoOEoqk= +github.com/juju/retry v0.0.0-20151029024821-62c620325291/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= +github.com/juju/retry v0.0.0-20180821225755-9058e192b216/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= +github.com/juju/retry v1.0.0/go.mod h1:SssN1eYeK3A2qjnFGTiVMbdzGJ2BfluaJblJXvuvgqA= +github.com/juju/schema v1.0.1 h1:GBEiwxZQeoQuXI6gOTG58W/ZpdongMwl9pfZq1KcNgM= +github.com/juju/schema v1.0.1/go.mod h1:Y+ThzXpUJ0E7NYYocAbuvJ7vTivXfrof/IfRPq/0abI= +github.com/juju/testing v0.0.0-20180402130637-44801989f0f7/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20180517134105-72703b1e95eb/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20210302031854-2c7ee8570c07/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= +github.com/juju/testing v0.0.0-20210324180055-18c50b0c2098/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= +github.com/juju/testing v0.0.0-20220202055744-1ad0816210a6/go.mod h1:QgWc2UdIPJ8t3rnvv95tFNOsQDfpXYEZDbP281o3b2c= +github.com/juju/testing v0.0.0-20220203020004-a0ff61f03494/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= +github.com/juju/testing v1.0.0/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= +github.com/juju/testing v1.0.2 h1:OR90RqCd9CJONxXamZAjLknpZdtqDyxqW8IwCbgw3i4= +github.com/juju/testing v1.0.2/go.mod h1:h3Vd2rzB57KrdsBEy6R7bmSKPzP76BnNavt7i8PerwQ= +github.com/juju/utils v0.0.0-20180424094159-2000ea4ff043/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= +github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647 h1:wQpkHVbIIpz1PCcLYku9KFWsJ7aEMQXHBBmLy3tRBTk= +github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= +github.com/juju/utils/v2 v2.0.0-20200923005554-4646bfea2ef1/go.mod h1:fdlDtQlzundleLLz/ggoYinEt/LmnrpNKcNTABQATNI= +github.com/juju/utils/v3 v3.0.0-20220130232349-cd7ecef0e94a/go.mod h1:LzwbbEN7buYjySp4nqnti6c6olSqRXUk6RkbSUUP1n8= +github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89/go.mod h1:wf5w+8jyTh2IYnSX0sHnMJo4ZPwwuiBWn+xN3DkQg4k= +github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= +github.com/juju/utils/v3 v3.0.0 h1:Gg3n63mGPbBuoXCo+EPJuMi44hGZfloI8nlCIebHu2Q= +github.com/juju/utils/v3 v3.0.0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= +github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20180108022336-b64dbd566305/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20191219164919-81c1be00b9a6/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20210303051006-2015802527a8 h1:BTo6HzRR0zPBcXbs1Sy08aQNfvdm3ey8O+mBTiO3g00= +github.com/juju/version v0.0.0-20210303051006-2015802527a8/go.mod h1:YUOK6VK9+V4hpmsBYx8ymvOzEXRzoIGjRDKpIezTi60= +github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23/go.mod h1:Ljlbryh9sYaUSGXucslAEDf0A2XUSGvDbHJgW8ps6nc= +github.com/juju/version/v2 v2.0.0/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= +github.com/julienschmidt/httprouter v1.1.1-0.20151013225520-77a895ad01eb/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= @@ -510,6 +598,7 @@ github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -522,13 +611,26 @@ github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec h1:2tTW6cDth2T github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec/go.mod h1:TmwEoGCwIti7BCeJ9hescZgRtatxRE+A72pCoPfmcfk= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= +github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/masterzen/azure-sdk-for-go v3.2.0-beta.0.20161014135628-ee4f0065d00c+incompatible/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= +github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/winrm v0.0.0-20161014151040-7a535cd943fc/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= +github.com/masterzen/winrm v0.0.0-20211231115050-232efb40349e/go.mod h1:Iju3u6NzoTAvjuhsGCZc+7fReNnr/Bd6DsWj3WTokIU= +github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= +github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -567,6 +669,7 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 h1:Up6+btDp321ZG5/zdSLo48H9Iaq0UQGthrhWC6pCxzE= github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481/go.mod h1:yKZQO8QE2bHlgozqWDiRVqTFlLQSj30K/6SAK8EeYFw= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -758,6 +861,8 @@ github.com/validator-labs/validator-plugin-aws v0.1.3 h1:8C/cprrt0RW8j97LOPSyuqy github.com/validator-labs/validator-plugin-aws v0.1.3/go.mod h1:aY+4x9iA76XzjjS7fTXWJPytxCFospvzIOhJgnlpkq0= github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec h1:07OqIrf6LEdH/ghuTM3xgln2OZVsgZVTIpNKUoRDLlA= github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec/go.mod h1:5rNcu7SqOk9zXfbCyvxnKlYn/J0l7iOu1zvHEqSVkx0= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 h1:mw98qwizN2s2y9q/L4yLK8osmFc52bVHmLkDoymFKtY= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70/go.mod h1:JyQk0ehRB+zNnhyYRpzk5ZekZZReFOfeJ7L6z0kln64= github.com/validator-labs/validator-plugin-network v0.0.22 h1:tlyyA8wq2j9/tmNjxP5JuQEY0Xh6aLedFp9s2943CVg= github.com/validator-labs/validator-plugin-network v0.0.22/go.mod h1:0zlqCtTNHxPAp7jKN/1abzRBXRXvBNWSQzVEhkQCrXg= github.com/validator-labs/validator-plugin-oci v0.1.0 h1:odFaKQQJ3AYxXSdjlkfn26HlEEYyA/UMtouj3I/Sw5M= @@ -770,6 +875,8 @@ github.com/vmware/govmomi v0.39.0 h1:soLZ08Q2zvjRSinNup8xVlw0KDDCJPPA1rIDmBhi7As github.com/vmware/govmomi v0.39.0/go.mod h1:oHzAQ1r6152zYDGcUqeK+EO8LhKo5wjtvWZBGHws2Hc= github.com/xanzy/go-gitlab v0.107.0 h1:P2CT9Uy9yN9lJo3FLxpMZ4xj6uWcpnigXsjvqJ6nd2Y= github.com/xanzy/go-gitlab v0.107.0/go.mod h1:wKNKh3GkYDMOsGmnfuX+ITCmDuSDWFO0G+C4AygL9RY= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= @@ -813,12 +920,16 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -841,6 +952,7 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -848,14 +960,18 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -888,6 +1004,8 @@ golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -898,6 +1016,7 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -930,6 +1049,7 @@ golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= @@ -992,18 +1112,27 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/httprequest.v1 v1.1.1/go.mod h1:/CkavNL+g3qLOrpFHVrEx4NKepeqR4XTZWNj4sGGjz0= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= +gopkg.in/yaml.v2 v2.0.0-20170712054546-1be3d31502d6/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1040,6 +1169,8 @@ k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a h1:zD1uj3Jf+mD4zmA7W+goE5 k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a/go.mod h1:UxDHUPsUwTOOxSU+oXURfFBcAS6JwiRXTYqYwfuGowc= k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= +launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= sigs.k8s.io/cluster-api v1.7.4 h1:gT9WGbLXKE19pNR6s/cTLRqK2G0EbwxxQrUrw7/w5P4= sigs.k8s.io/cluster-api v1.7.4/go.mod h1:V9ZhKLvQtsDODwjXOKgbitjyCmC71yMBwDcMyNNIov0= sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= diff --git a/hack/validator.tmpl b/hack/validator.tmpl index 596cdf95..5f61ea61 100644 --- a/hack/validator.tmpl +++ b/hack/validator.tmpl @@ -825,3 +825,40 @@ azurePlugin: auth: implicit: false secretName: azure-creds +maasPlugin: + enabled: true + helmRelease: + chart: + name: validator-plugin-maas + repository: validator-plugin-maas + version: v${MAAS_VERSION} + values: "" + validator: + internalDNSRules: + - maasDomain: example.com + dnsResources: + - fqdn: foo.example.com + dnsRecords: + - type: A + ip: 0.0.0.0 + ttl: 10 + upstreamDNSRules: + - name: upstream dns + numDNSServers: 1 + imageRules: + - name: Image Rule + images: + - name: example + architecture: amd64/ga-20.04 + resourceAvailabilityRules: + - name: AZ1 + az: az1 + resources: + - numMachines: 1 + numCPU: 16 + ram: 16 + disk: 100 + host: "http://example.com/MAAS" + auth: + secretName: maas-creds + tokenKey: MAAS_API_KEY \ No newline at end of file diff --git a/hack/versions.tmpl b/hack/versions.tmpl index e803785c..987ca1c7 100644 --- a/hack/versions.tmpl +++ b/hack/versions.tmpl @@ -5,6 +5,7 @@ var ValidatorChartVersions = map[string]string{ Validator: "v${VALIDATOR_VERSION}", ValidatorPluginAws: "v${AWS_VERSION}", ValidatorPluginAzure: "v${AZURE_VERSION}", + ValidatorPluginMaas: "v${MAAS_VERSION}", ValidatorPluginNetwork: "v${NETWORK_VERSION}", ValidatorPluginOci: "v${OCI_VERSION}", ValidatorPluginVsphere: "v${VSPHERE_VERSION}", diff --git a/pkg/cmd/validator/validator.go b/pkg/cmd/validator/validator.go index 5c6f43f1..0bfc2711 100644 --- a/pkg/cmd/validator/validator.go +++ b/pkg/cmd/validator/validator.go @@ -28,6 +28,8 @@ import ( awsval "github.com/validator-labs/validator-plugin-aws/pkg/validate" azureapi "github.com/validator-labs/validator-plugin-azure/api/v1alpha1" azureval "github.com/validator-labs/validator-plugin-azure/pkg/validate" + maasapi "github.com/validator-labs/validator-plugin-maas/api/v1alpha1" + maasval "github.com/validator-labs/validator-plugin-maas/pkg/validate" netapi "github.com/validator-labs/validator-plugin-network/api/v1alpha1" netval "github.com/validator-labs/validator-plugin-network/pkg/validate" ociapi "github.com/validator-labs/validator-plugin-oci/api/v1alpha1" @@ -548,6 +550,26 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { results = append(results, vr) } + if vc.MaasPlugin.Enabled { + v := &maasapi.MaasValidator{ + ObjectMeta: metav1.ObjectMeta{ + Name: "azure-validator", + Namespace: "N/A", + }, + Spec: *vc.MaasPlugin.Validator, + } + vr := vres.Build(v) + // TODO: set TypeMeta in vres.Build + vr.TypeMeta = metav1.TypeMeta{ + APIVersion: "validation.spectrocloud.labs/v1alpha1", + Kind: "MaasValidator", + } + vrr := maasval.Validate(*vc.MaasPlugin.Validator, vc.MaasPlugin.Validator.Host, vc.MaasPlugin.MaasAPIToken, l) + if err := vres.Finalize(vr, vrr, l); err != nil { + return err + } + results = append(results, vr) + } if vc.NetworkPlugin.Enabled { v := &netapi.NetworkValidator{ ObjectMeta: metav1.ObjectMeta{ @@ -764,6 +786,22 @@ func applyValidator(c *cfg.Config, vc *components.ValidatorConfig) error { pluginCount++ } + if vc.MaasPlugin.Enabled { + args := map[string]interface{}{ + "Config": vc.MaasPlugin, + "ImageRegistry": vc.ImageRegistry, + } + values, err := embed.EFS.RenderTemplateBytes(args, cfg.Validator, "validator-plugin-maas-values.tmpl") + if err != nil { + return errors.Wrap(err, "failed to render validator plugin maas values.yaml") + } + validatorSpec.Plugins = append(validatorSpec.Plugins, vapi.HelmRelease{ + Chart: vc.MaasPlugin.Release.Chart, + Values: string(values), + }) + pluginCount++ + } + if vc.NetworkPlugin.Enabled { args := map[string]interface{}{ "Config": vc.NetworkPlugin, @@ -824,6 +862,7 @@ func applyValidator(c *cfg.Config, vc *components.ValidatorConfig) error { "SinkConfig": vc.SinkConfig, "AWSPlugin": vc.AWSPlugin, "AzurePlugin": vc.AzurePlugin, + "MAASPlugin": vc.MaasPlugin, "NetworkPlugin": vc.NetworkPlugin, "OCIPlugin": vc.OCIPlugin, "VspherePlugin": vc.VspherePlugin, @@ -1045,6 +1084,15 @@ func applyPlugins(c *cfg.Config, vc *components.ValidatorConfig) error { } } + if vc.MaasPlugin.Enabled { + log.InfoCLI("\n==== Applying MAAS plugin validator(s) ====") + if err := createValidator( + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginMaas, cfg.ValidatorPluginMaasTemplate, *vc.MaasPlugin.Validator, + ); err != nil { + return err + } + } + return nil } diff --git a/pkg/components/validator.go b/pkg/components/validator.go index 0610d4d4..fc8f993f 100644 --- a/pkg/components/validator.go +++ b/pkg/components/validator.go @@ -10,6 +10,7 @@ import ( aws "github.com/validator-labs/validator-plugin-aws/api/v1alpha1" azure "github.com/validator-labs/validator-plugin-azure/api/v1alpha1" + maas "github.com/validator-labs/validator-plugin-maas/api/v1alpha1" network "github.com/validator-labs/validator-plugin-network/api/v1alpha1" oci "github.com/validator-labs/validator-plugin-oci/api/v1alpha1" vsphereapi "github.com/validator-labs/validator-plugin-vsphere/api/v1alpha1" @@ -39,6 +40,7 @@ type ValidatorConfig struct { NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"` OCIPlugin *OCIPluginConfig `yaml:"ociPlugin,omitempty"` VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"` + MaasPlugin *MaasPluginConfig `yaml:"maasPlugin,omitempty"` } // NewValidatorConfig creates a new ValidatorConfig object. @@ -79,6 +81,10 @@ func NewValidatorConfig() *ValidatorConfig { StaticDeploymentTypes: make(map[int]string), StaticDeploymentValues: make(map[int]*AzureStaticDeploymentValues), }, + MaasPlugin: &MaasPluginConfig{ + Release: &validator.HelmRelease{}, + Validator: &maas.MaasValidatorSpec{}, + }, NetworkPlugin: &NetworkPluginConfig{ Release: &validator.HelmRelease{}, HTTPFileAuths: make([][]string, 0), @@ -101,7 +107,7 @@ func NewValidatorConfig() *ValidatorConfig { // AnyPluginEnabled returns true if any plugin is enabled. func (c *ValidatorConfig) AnyPluginEnabled() bool { - return c.AWSPlugin.Enabled || c.NetworkPlugin.Enabled || c.VspherePlugin.Enabled || c.OCIPlugin.Enabled || c.AzurePlugin.Enabled + return c.AWSPlugin.Enabled || c.NetworkPlugin.Enabled || c.VspherePlugin.Enabled || c.OCIPlugin.Enabled || c.AzurePlugin.Enabled || c.MaasPlugin.Enabled } // EnabledPluginsHaveRules returns true if all enabled plugins have at least one rule configured. @@ -115,6 +121,10 @@ func (c *ValidatorConfig) EnabledPluginsHaveRules() (bool, []string) { invalidPlugins = append(invalidPlugins, "Azure") // invalidPlugins = append(invalidPlugins, c.AzurePlugin.Validator.PluginCode()) } + if c.MaasPlugin.Enabled && c.MaasPlugin.Validator.ResultCount() == 0 { + // invalidPlugins = append(invalidPlugins, c.MaasPlugin.Validator.PluginCode()) + invalidPlugins = append(invalidPlugins, "MAAS") + } if c.NetworkPlugin.Enabled && c.NetworkPlugin.Validator.ResultCount() == 0 { invalidPlugins = append(invalidPlugins, c.NetworkPlugin.Validator.PluginCode()) } @@ -153,6 +163,11 @@ func (c *ValidatorConfig) decrypt() error { return errors.Wrap(err, "failed to decrypt Azure plugin configuration") } } + if c.MaasPlugin != nil { + if err := c.MaasPlugin.decrypt(); err != nil { + return errors.Wrap(err, "failed to decrypt MAAS plugin configuration") + } + } if c.NetworkPlugin != nil { if err := c.NetworkPlugin.decrypt(); err != nil { return errors.Wrap(err, "failed to decrypt Network plugin configuration") @@ -193,6 +208,11 @@ func (c *ValidatorConfig) encrypt() error { return errors.Wrap(err, "failed to encrypt Azure plugin configuration") } } + if c.MaasPlugin != nil { + if err := c.MaasPlugin.encrypt(); err != nil { + return errors.Wrap(err, "failed to encrypt MAAS plugin configuration") + } + } if c.NetworkPlugin != nil { if err := c.NetworkPlugin.encrypt(); err != nil { return errors.Wrap(err, "failed to encrypt Network plugin configuration") @@ -564,6 +584,34 @@ type VsphereTagRule struct { vsphereapi.TagValidationRule `yaml:",inline"` } +// MaasPluginConfig represents the MAAS plugin configuration. +type MaasPluginConfig struct { + Enabled bool `yaml:"enabled"` + Release *validator.HelmRelease `yaml:"helmRelease"` + Validator *maas.MaasValidatorSpec `yaml:"validator"` + MaasAPIToken string `yaml:"maasApiToken"` +} + +func (c *MaasPluginConfig) encrypt() error { + token, err := crypto.EncryptB64([]byte(c.MaasAPIToken)) + if err != nil { + return errors.Wrap(err, "failed to encrypt token") + } + c.MaasAPIToken = token + + return nil +} + +func (c *MaasPluginConfig) decrypt() error { + bytes, err := crypto.DecryptB64(c.MaasAPIToken) + if err != nil { + return errors.Wrap(err, "failed to decrypt token") + } + c.MaasAPIToken = string(*bytes) + + return nil +} + // PublicKeySecret represents a public key secret. type PublicKeySecret struct { Name string `yaml:"name"` diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 527d0df0..6239db2e 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -28,12 +28,14 @@ const ( ValidatorPluginAws = "validator-plugin-aws" ValidatorPluginAzure = "validator-plugin-azure" + ValidatorPluginMaas = "validator-plugin-maas" ValidatorPluginNetwork = "validator-plugin-network" ValidatorPluginOci = "validator-plugin-oci" ValidatorPluginVsphere = "validator-plugin-vsphere" ValidatorPluginAwsTemplate = "validator-rules-aws.tmpl" ValidatorPluginAzureTemplate = "validator-rules-azure.tmpl" + ValidatorPluginMaasTemplate = "validator-rules-maas.tmpl" ValidatorPluginNetworkTemplate = "validator-rules-network.tmpl" ValidatorPluginOciTemplate = "validator-rules-oci.tmpl" ValidatorPluginVsphereTemplate = "validator-rules-vsphere.tmpl" diff --git a/pkg/config/versions.go b/pkg/config/versions.go index d9fd8077..d45c8125 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -5,6 +5,7 @@ var ValidatorChartVersions = map[string]string{ Validator: "v0.1.2", ValidatorPluginAws: "v0.1.3", ValidatorPluginAzure: "v0.0.15", + ValidatorPluginMaas: "v0.0.7", ValidatorPluginNetwork: "v0.0.22", ValidatorPluginOci: "v0.1.0", ValidatorPluginVsphere: "v0.0.29", diff --git a/pkg/services/validator/maas.go b/pkg/services/validator/maas.go new file mode 100644 index 00000000..1eef95d9 --- /dev/null +++ b/pkg/services/validator/maas.go @@ -0,0 +1,662 @@ +package validator + +import ( + "fmt" + "reflect" + "strconv" + "time" + + "k8s.io/client-go/kubernetes" + + "github.com/spectrocloud-labs/prompts-tui/prompts" + "github.com/validator-labs/validatorctl/pkg/components" + cfg "github.com/validator-labs/validatorctl/pkg/config" + log "github.com/validator-labs/validatorctl/pkg/logging" + "github.com/validator-labs/validatorctl/pkg/services" + + vpmaasapi "github.com/validator-labs/validator-plugin-maas/api/v1alpha1" +) + +var ( + host = "https://maas.io/MAAS" + maasSecretName = "maas-creds" + maasTokenKey = "MAAS_API_KEY" +) + +type maasRule interface { + *vpmaasapi.ResourceAvailabilityRule | *vpmaasapi.ImageRule | *vpmaasapi.InternalDNSRule | *vpmaasapi.UpstreamDNSRule +} + +func initMaasRule[R maasRule](r R, ruleType string, ruleNames *[]string) error { + name := reflect.ValueOf(r).Elem().FieldByName("Name").String() + if name != "" { + // not all maasRules have a Name field, for now we can create a unique name for them + if name == "" { + name = ruleType + " - " + time.Now().Format("20060102T150405.000000000") + } + log.InfoCLI("\nReconfiguring %s validation rule: %s", ruleType, name) + *ruleNames = append(*ruleNames, name) + } else { + name, err := getRuleName(ruleNames) + if err != nil { + return err + } + reflect.ValueOf(r).Elem().FieldByName("Name").Set(reflect.ValueOf(name)) + } + return nil +} + +func readMaasPlugin(vc *components.ValidatorConfig, tc *cfg.TaskConfig, k8sClient kubernetes.Interface) error { + c := vc.MaasPlugin + + if !tc.Direct { + if err := readHelmRelease(cfg.ValidatorPluginMaas, vc, c.Release); err != nil { + return fmt.Errorf("failed to read Helm release: %w", err) + } + } + if err := readMaasCredentials(c, tc, k8sClient); err != nil { + return fmt.Errorf("failed to read MAAS credentials: %w", err) + } + + return nil +} + +// nolint:dupl +func readMaasPluginRules(vc *components.ValidatorConfig, _ *cfg.TaskConfig, _ kubernetes.Interface) error { + log.Header("MAAS Plugin Rule Configuration") + var err error + c := vc.MaasPlugin + + if c.Validator.Host != "" { + host = c.Validator.Host + } + c.Validator.Host, err = prompts.ReadText("MAAS Domain", host, false, -1) + if err != nil { + return err + } + + ruleNames := make([]string, 0) + + if err := configureMaasResourceRules(c, &ruleNames); err != nil { + return err + } + + if err := configureMaasImageRules(c, &ruleNames); err != nil { + return err + } + + if err := configureMaasInternalDNSRules(c, &ruleNames); err != nil { + return err + } + + if err := configureMaasUpstreamDNSRules(c, &ruleNames); err != nil { + return err + } + + if c.Validator.ResultCount() == 0 { + return errNoRulesEnabled + } + return nil +} + +// nolint:dupl +func readMaasCredentials(c *components.MaasPluginConfig, tc *cfg.TaskConfig, k8sClient kubernetes.Interface) error { + var err error + + // always create MAAS credential secret if creating a new kind cluster + createSecret := true + + if k8sClient != nil { + log.InfoCLI(` + Either specify MAAS credentials or provide the name of a secret in the target K8s cluster's %s namespace. + `, cfg.Validator, + ) + createSecret, err = prompts.ReadBool("Create MAAS credential secret", true) + if err != nil { + return fmt.Errorf("failed to create MAAS credential secret: %w", err) + } + } + + if createSecret { + if c.Validator.Auth.SecretName != "" { + maasSecretName = c.Validator.Auth.SecretName + } + + if !tc.Direct { + c.Validator.Auth.SecretName, err = prompts.ReadText("MAAS credentials secret name", maasSecretName, false, -1) + if err != nil { + return fmt.Errorf("failed to prompt for text for MAAS credentials secret name: %w", err) + } + c.Validator.Auth.TokenKey, err = prompts.ReadText("MAAS API token key", maasTokenKey, false, -1) + if err != nil { + return fmt.Errorf("failed to prompt for text for MAAS API token key: %w", err) + } + } + + c.MaasAPIToken, err = prompts.ReadPassword("MAAS API token", c.MaasAPIToken, false, -1) + if err != nil { + return fmt.Errorf("failed to prompt for password for MAAS API token: %w", err) + } + + } else { + c.Validator.Auth.TokenKey, err = prompts.ReadText("MAAS API token key", maasTokenKey, false, -1) + if err != nil { + return fmt.Errorf("failed to prompt for text for MAAS API token key: %w", err) + } + secret, err := services.ReadSecret(k8sClient, cfg.Validator, false, []string{c.Validator.Auth.TokenKey}) + if err != nil { + return fmt.Errorf("failed to read k8s Secret: %w", err) + } + c.Validator.Auth.SecretName = secret.Name + c.MaasAPIToken = string(secret.Data[c.Validator.Auth.TokenKey]) + } + + return nil +} + +// nolint:dupl +func configureMaasResourceRules(c *components.MaasPluginConfig, ruleNames *[]string) error { + log.InfoCLI(` + Resource Availability validation checks that the required number of machines + matching a certain criteria are "Ready" for use in an availability zone. + Each availability zone should have no more than 1 rule configured. + `) + + validateResources, err := prompts.ReadBool("Enable Resource Availability validation", true) + if err != nil { + return err + } + + if !validateResources { + c.Validator.ResourceAvailabilityRules = nil + return nil + } + + for i, r := range c.Validator.ResourceAvailabilityRules { + r := r + if err := readMaasResourceRule(c, &r, i, ruleNames); err != nil { + return err + } + } + + addRules := true + if c.Validator.ResourceAvailabilityRules == nil { + c.Validator.ResourceAvailabilityRules = make([]vpmaasapi.ResourceAvailabilityRule, 0) + } else { + addRules, err = prompts.ReadBool("Add another Resource Availability rule", false) + if err != nil { + return err + } + } + if !addRules { + return nil + } + for { + if err := readMaasResourceRule(c, &vpmaasapi.ResourceAvailabilityRule{}, -1, ruleNames); err != nil { + return err + } + add, err := prompts.ReadBool("Add another Resource Availability rule", false) + if err != nil { + return err + } + if !add { + break + } + } + return nil +} + +// nolint:dupl +func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceAvailabilityRule, idx int, ruleNames *[]string) error { + if r == nil { + r = &vpmaasapi.ResourceAvailabilityRule{ + Name: "", + AZ: "", + Resources: []vpmaasapi.Resource{}, + } + } + + err := initMaasRule(r, "Resource Availability", ruleNames) + if err != nil { + return err + } + + if r.Name == "" { + name, err := prompts.ReadText("Rule Name", "", false, -1) + if err != nil { + return err + } + r.Name = name + } + + if r.AZ == "" { + az, err := prompts.ReadText("Availability Zone", "az1", false, -1) + if err != nil { + return err + } + r.AZ = az + } + + addResources := true + + for addResources { + resource, err := readMaasResource() + if err != nil { + return err + } + + r.Resources = append(r.Resources, resource) + addResources, err = prompts.ReadBool("Add another resource", false) + if err != nil { + return err + } + } + if idx == -1 { + c.Validator.ResourceAvailabilityRules = append(c.Validator.ResourceAvailabilityRules, *r) + } else { + c.Validator.ResourceAvailabilityRules[idx] = *r + } + return nil +} + +// nolint:dupl +func readMaasResource() (vpmaasapi.Resource, error) { + res := vpmaasapi.Resource{} + + numMachines, err := prompts.ReadInt("Minimum number of machines", "1", 1, -1) + if err != nil { + return res, err + } + res.NumMachines = numMachines + + numCPU, err := prompts.ReadInt("Minimum CPU cores per machine", "4", 1, -1) + if err != nil { + return res, err + } + res.NumCPU = numCPU + + ram, err := prompts.ReadInt("Minimum RAM in GB", "16", 1, -1) + if err != nil { + return res, err + } + res.RAM = ram + + disk, err := prompts.ReadInt("Minimum Disk capacity in GB", "256", 1, -1) + if err != nil { + return res, err + } + res.Disk = disk + + pool, err := prompts.ReadText("Machine pool", "", true, -1) + if err != nil { + return res, err + } + if pool != "" { + res.Pool = pool + } + + tags, err := prompts.ReadTextSlice("Machine tags", "", "Invalid tag values", "", true) + if err != nil { + return res, err + } + if len(tags) > 0 { + res.Tags = tags + } + + return res, nil +} + +// nolint:dupl +func configureMaasImageRules(c *components.MaasPluginConfig, ruleNames *[]string) error { + log.InfoCLI(` + OS Image validation ensures that the specified images are available for use. + `) + + validateImages, err := prompts.ReadBool("Enable OS Image validation", true) + if err != nil { + return err + } + + if !validateImages { + c.Validator.ImageRules = nil + return nil + } + for i, r := range c.Validator.ImageRules { + r := r + if err := readMaasImageRule(c, &r, i, ruleNames); err != nil { + return err + } + } + + addRules := true + if c.Validator.ImageRules == nil { + c.Validator.ImageRules = make([]vpmaasapi.ImageRule, 0) + } else { + addRules, err = prompts.ReadBool("Add another OS Image rule", false) + if err != nil { + return err + } + } + if !addRules { + return nil + } + for { + if err := readMaasImageRule(c, &vpmaasapi.ImageRule{}, -1, ruleNames); err != nil { + return err + } + add, err := prompts.ReadBool("Add another OS Image rule", false) + if err != nil { + return err + } + if !add { + break + } + } + return nil +} + +// nolint:dupl +func readMaasImageRule(c *components.MaasPluginConfig, r *vpmaasapi.ImageRule, idx int, ruleNames *[]string) error { + if r == nil { + r = &vpmaasapi.ImageRule{ + Name: "", + Images: []vpmaasapi.Image{}, + } + } + + err := initMaasRule(r, "OS Image", ruleNames) + if err != nil { + return err + } + + if r.Name == "" { + name, err := prompts.ReadText("Rule Name", "", false, -1) + if err != nil { + return err + } + r.Name = name + } + + addImages := true + + for addImages { + image, err := readMaasImage() + if err != nil { + return err + } + + r.Images = append(r.Images, image) + addImages, err = prompts.ReadBool("Add another OS Image", false) + if err != nil { + return err + } + } + if idx == -1 { + c.Validator.ImageRules = append(c.Validator.ImageRules, *r) + } else { + c.Validator.ImageRules[idx] = *r + } + return nil +} + +// nolint:dupl +func readMaasImage() (vpmaasapi.Image, error) { + img := vpmaasapi.Image{} + + name, err := prompts.ReadText("Image name", "ubuntu/jammy", false, -1) + if err != nil { + return img, err + } + img.Name = name + + arch, err := prompts.ReadText("Architecture", "amd64/ga-22.04", false, -1) + if err != nil { + return img, err + } + img.Architecture = arch + + return img, nil +} + +// nolint:dupl +func configureMaasInternalDNSRules(c *components.MaasPluginConfig, ruleNames *[]string) error { + log.InfoCLI(` + Internal DNS validation ensures that the expected DNS setting are configured inside your MAAS cluster. + `) + + validateIDNS, err := prompts.ReadBool("Enable Internal DNS validation", true) + if err != nil { + return err + } + + if !validateIDNS { + c.Validator.InternalDNSRules = nil + return nil + } + for i, r := range c.Validator.InternalDNSRules { + r := r + if err := readMaasInternalDNSRule(c, &r, i, ruleNames); err != nil { + return err + } + } + + addRules := true + if c.Validator.InternalDNSRules == nil { + c.Validator.InternalDNSRules = make([]vpmaasapi.InternalDNSRule, 0) + } else { + addRules, err = prompts.ReadBool("Add another Internal DNS rule", false) + if err != nil { + return err + } + } + if !addRules { + return nil + } + for { + if err := readMaasInternalDNSRule(c, &vpmaasapi.InternalDNSRule{}, -1, ruleNames); err != nil { + return err + } + add, err := prompts.ReadBool("Add another Internal DNS rule", false) + if err != nil { + return err + } + if !add { + break + } + } + return nil +} + +// nolint:dupl +func readMaasInternalDNSRule(c *components.MaasPluginConfig, r *vpmaasapi.InternalDNSRule, idx int, ruleNames *[]string) error { + if r == nil { + r = &vpmaasapi.InternalDNSRule{ + MaasDomain: "", + DNSResources: []vpmaasapi.DNSResource{}, + } + } + + err := initMaasRule(r, "Internal DNS", ruleNames) + if err != nil { + return err + } + + if r.MaasDomain == "" { + domain, err := prompts.ReadText("MAAS Domain", "maas.io", false, -1) + if err != nil { + return err + } + r.MaasDomain = domain + } + + addResources := true + + for addResources { + resource, err := readMaasDNSResource() + if err != nil { + return err + } + + r.DNSResources = append(r.DNSResources, resource) + addResources, err = prompts.ReadBool("Add another DNS resource", false) + if err != nil { + return err + } + } + if idx == -1 { + c.Validator.InternalDNSRules = append(c.Validator.InternalDNSRules, *r) + } else { + c.Validator.InternalDNSRules[idx] = *r + } + return nil +} + +// nolint:dupl +func readMaasDNSResource() (vpmaasapi.DNSResource, error) { + res := vpmaasapi.DNSResource{} + + fqdn, err := prompts.ReadDomains("FQDN", "www.maas.io", "must be a valid FQDN", false, 1) + if err != nil { + return res, err + } + res.FQDN = fqdn + + addRecord := true + + for addRecord { + record, err := readMaasDNSRecord() + if err != nil { + return res, err + } + + res.DNSRecords = append(res.DNSRecords, record) + addRecord, err = prompts.ReadBool("Add another DNS record", false) + if err != nil { + return res, err + } + } + return res, nil +} + +// nolint:dupl +func readMaasDNSRecord() (vpmaasapi.DNSRecord, error) { + log.InfoCLI("Add a DNS Resource Record") + rec := vpmaasapi.DNSRecord{} + + ip, err := prompts.ReadIPs("IP", "10.10.10.10", "IP should be a valid IPv4", false, 1) + if err != nil { + return rec, err + } + rec.IP = ip + + recType, err := prompts.ReadText("Record type", "A", false, -1) + if err != nil { + return rec, err + } + rec.Type = recType + + ttl, err := prompts.ReadText("TTL", "", true, -1) + if err != nil { + return rec, err + } + if ttl != "" { + ttlInt, err := strconv.Atoi(ttl) + if err != nil { + return rec, err + } + if ttlInt >= 0 { + rec.TTL = ttlInt + } + } + + return rec, nil + +} + +// nolint:dupl +func configureMaasUpstreamDNSRules(c *components.MaasPluginConfig, ruleNames *[]string) error { + log.InfoCLI(` + Upstream DNS validation ensures that the expected number of upstream DNS server are configured. + `) + + validateUDNS, err := prompts.ReadBool("Enable Upstream DNS validation", true) + if err != nil { + return err + } + + if !validateUDNS { + c.Validator.UpstreamDNSRules = nil + return nil + } + for i, r := range c.Validator.UpstreamDNSRules { + r := r + if err := readMaasUpstreamDNSRule(c, &r, i, ruleNames); err != nil { + return err + } + } + + addRules := true + if c.Validator.UpstreamDNSRules == nil { + c.Validator.UpstreamDNSRules = make([]vpmaasapi.UpstreamDNSRule, 0) + } else { + addRules, err = prompts.ReadBool("Add another Upstream DNS rule", false) + if err != nil { + return err + } + } + if !addRules { + return nil + } + for { + if err := readMaasUpstreamDNSRule(c, &vpmaasapi.UpstreamDNSRule{}, -1, ruleNames); err != nil { + return err + } + add, err := prompts.ReadBool("Add another Upstream DNS rule", false) + if err != nil { + return err + } + if !add { + break + } + } + return nil +} + +// nolint:dupl +func readMaasUpstreamDNSRule(c *components.MaasPluginConfig, r *vpmaasapi.UpstreamDNSRule, idx int, ruleNames *[]string) error { + if r == nil { + r = &vpmaasapi.UpstreamDNSRule{ + Name: "", + NumDNSServers: 0, + } + } + + err := initMaasRule(r, "Upstream DNS", ruleNames) + if err != nil { + return err + } + + if r.Name == "" { + name, err := prompts.ReadText("Rule Name", "", false, -1) + if err != nil { + return err + } + r.Name = name + } + + if r.NumDNSServers <= 0 { + num, err := prompts.ReadInt("Expected number of DNS servers", "1", 1, -1) + if err != nil { + return err + } + r.NumDNSServers = num + } + + if idx == -1 { + c.Validator.UpstreamDNSRules = append(c.Validator.UpstreamDNSRules, *r) + } else { + c.Validator.UpstreamDNSRules[idx] = *r + } + + return nil +} diff --git a/pkg/services/validator/validator_service.go b/pkg/services/validator/validator_service.go index c56ff000..d22f4793 100644 --- a/pkg/services/validator/validator_service.go +++ b/pkg/services/validator/validator_service.go @@ -15,6 +15,7 @@ import ( awsconsts "github.com/validator-labs/validator-plugin-aws/pkg/constants" azureconsts "github.com/validator-labs/validator-plugin-azure/pkg/constants" + maasconsts "github.com/validator-labs/validator-plugin-maas/pkg/constants" netconsts "github.com/validator-labs/validator-plugin-network/pkg/constants" ociconsts "github.com/validator-labs/validator-plugin-oci/pkg/constants" vsphereconsts "github.com/validator-labs/validator-plugin-vsphere/pkg/constants" @@ -35,6 +36,7 @@ var ( pluginInstallFuncs = pluginFuncMap{ awsconsts.PluginCode: readAwsPlugin, azureconsts.PluginCode: readAzurePlugin, + maasconsts.PluginCode: readMaasPlugin, netconsts.PluginCode: readNetworkPlugin, ociconsts.PluginCode: readOciPlugin, vsphereconsts.PluginCode: readVspherePlugin, @@ -42,6 +44,7 @@ var ( pluginRuleFuncs = pluginFuncMap{ awsconsts.PluginCode: readAwsPluginRules, azureconsts.PluginCode: readAzurePluginRules, + maasconsts.PluginCode: readMaasPluginRules, netconsts.PluginCode: readNetworkPluginRules, ociconsts.PluginCode: readOciPluginRules, vsphereconsts.PluginCode: readVspherePluginRules, @@ -242,6 +245,33 @@ func handlePlugins(vc *components.ValidatorConfig, tc *cfg.TaskConfig, kClient k } } + if enablePlugins { + log.Header("MAAS Plugin") + log.InfoCLI(` + The MAAS validator plugin reconciles MaasValidator custom resources to perform + the following validation against your network: + + - Upstream DNS + - Internal DNS + - Resources + - OS Images + `) // TODO - elaborate + vc.MaasPlugin.Enabled, err = prompts.ReadBool(fmt.Sprintf("%s MAAS plugin", verb), true) + if err != nil { + return err + } + } + if vc.MaasPlugin.Enabled { + if tc.Direct { + if err = readMaasPlugin(vc, tc, kClient); err != nil { + return err + } + } + if err := funcMap[maasconsts.PluginCode](vc, tc, kClient); err != nil { + return err + } + } + if enablePlugins { log.Header("Network Plugin") log.InfoCLI(` @@ -453,6 +483,11 @@ func UpdateValidatorPluginCredentials(c *components.ValidatorConfig, tc *cfg.Tas return fmt.Errorf("failed to update Azure credentials: %w", err) } } + if c.MaasPlugin != nil && c.MaasPlugin.Enabled { + if err := readMaasCredentials(c.MaasPlugin, tc, k8sClient); err != nil { + return fmt.Errorf("failed to update MAAS credentials: %w", err) + } + } if c.OCIPlugin != nil && c.OCIPlugin.Enabled { for _, secret := range c.OCIPlugin.Secrets { if err := readOciSecret(secret); err != nil { diff --git a/pkg/utils/embed/resources/validator/validator-plugin-maas-values.tmpl b/pkg/utils/embed/resources/validator/validator-plugin-maas-values.tmpl new file mode 100644 index 00000000..e7ef9804 --- /dev/null +++ b/pkg/utils/embed/resources/validator/validator-plugin-maas-values.tmpl @@ -0,0 +1,55 @@ +controllerManager: + kubeRbacProxy: + args: + - --secure-listen-address=0.0.0.0:8443 + - --upstream=http://127.0.0.1:8080/ + - --logtostderr=true + - --v=0 + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + image: + repository: gcr.io/kubebuilder/kube-rbac-proxy + tag: v0.16.0 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 64Mi + manager: + args: + - --health-probe-bind-address=:8081 + - --leader-elect + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + image: + repository: {{ printf "%s/validator-plugin-maas" .ImageRegistry }} + tag: {{ .Config.Release.Chart.Version }} + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 10m + memory: 64Mi + replicas: 1 + serviceAccount: + annotations: {} +kubernetesClusterDomain: cluster.local +metricsService: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: https + type: ClusterIP +auth: + secretName: {{ .Config.Validator.Auth.SecretName }} + tokenKey: {{ .Config.Validator.Auth.TokenKey }} \ No newline at end of file diff --git a/pkg/utils/embed/resources/validator/validator-rules-maas.tmpl b/pkg/utils/embed/resources/validator/validator-rules-maas.tmpl new file mode 100644 index 00000000..46277b60 --- /dev/null +++ b/pkg/utils/embed/resources/validator/validator-rules-maas.tmpl @@ -0,0 +1,7 @@ +apiVersion: validation.spectrocloud.labs/v1alpha1 +kind: MaasValidator +metadata: + name: {{ .Name }} + namespace: {{ .Namespace }} +spec: +{{ .Spec }} \ No newline at end of file diff --git a/tests/integration/_validator/testcases/data/validator.yaml b/tests/integration/_validator/testcases/data/validator.yaml index e6dbe12b..b3158024 100644 --- a/tests/integration/_validator/testcases/data/validator.yaml +++ b/tests/integration/_validator/testcases/data/validator.yaml @@ -825,3 +825,40 @@ azurePlugin: auth: implicit: false secretName: azure-creds +maasPlugin: + enabled: true + helmRelease: + chart: + name: validator-plugin-maas + repository: validator-plugin-maas + version: v0.0.7 + values: "" + validator: + internalDNSRules: + - maasDomain: example.com + dnsResources: + - fqdn: foo.example.com + dnsRecords: + - type: A + ip: 0.0.0.0 + ttl: 10 + upstreamDNSRules: + - name: upstream dns + numDNSServers: 1 + imageRules: + - name: Image Rule + images: + - name: example + architecture: amd64/ga-20.04 + resourceAvailabilityRules: + - name: AZ1 + az: az1 + resources: + - numMachines: 1 + numCPU: 16 + ram: 16 + disk: 100 + host: "http://example.com/MAAS" + auth: + secretName: maas-creds + tokenKey: MAAS_API_KEY \ No newline at end of file diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index ce63f722..3fc7fe66 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -113,6 +113,7 @@ func (t *ValidatorTest) testInstallInteractive(ctx *test.TestContext) (tr *test. // Install values tuiVals = t.awsPluginInstallValues(ctx, tuiVals) tuiVals = t.azurePluginInstallValues(ctx, tuiVals) + tuiVals = t.maasPluginInstallValues(ctx, tuiVals) tuiVals = t.networkPluginInstallValues(ctx, tuiVals) tuiVals = t.ociPluginInstallValues(ctx, tuiVals) tuiVals = t.vspherePluginInstallValues(ctx, tuiVals) @@ -138,6 +139,7 @@ func (t *ValidatorTest) testInstallInteractiveCheck(ctx *test.TestContext) (tr * // Install values tuiVals = t.awsPluginInstallValues(ctx, tuiVals) tuiVals = t.azurePluginInstallValues(ctx, tuiVals) + tuiVals = t.maasPluginInstallValues(ctx, tuiVals) tuiVals = t.networkPluginInstallValues(ctx, tuiVals) tuiVals = t.ociPluginInstallValues(ctx, tuiVals) tuiVals = t.vspherePluginInstallValues(ctx, tuiVals) @@ -147,6 +149,7 @@ func (t *ValidatorTest) testInstallInteractiveCheck(ctx *test.TestContext) (tr * tuiSliceVals := make([][]string, 0) tuiVals, tuiSliceVals = t.awsPluginValues(ctx, tuiVals, tuiSliceVals) tuiVals = t.azurePluginValues(ctx, tuiVals) + tuiVals, tuiSliceVals = t.maasPluginValues(ctx, tuiVals, tuiSliceVals) tuiVals, tuiSliceVals = t.networkPluginValues(ctx, tuiVals, tuiSliceVals) tuiVals = t.ociPluginValues(ctx, tuiVals) tuiVals = t.vspherePluginValues(ctx, tuiVals) @@ -489,6 +492,60 @@ func (t *ValidatorTest) vspherePluginValues(ctx *test.TestContext, vals []string return vals } +func (t *ValidatorTest) maasPluginInstallValues(ctx *test.TestContext, vals []string) []string { + maasVals := []string{ + "y", // install MAAS plugin + "maas-creds", // MAAS credentials secret name + "MAAS_API_KEY", // MAAS API token key + "fake:maas:token", // MAAS API token + } + + if string_utils.IsDevVersion(ctx.Get("version")) { + maasVals = slices.Insert(maasVals, 1, cfg.ValidatorChartVersions[cfg.ValidatorPluginMaas]) + } + + vals = append(vals, maasVals...) + return vals + +} + +func (t *ValidatorTest) maasPluginValues(ctx *test.TestContext, vals []string, sliceVals [][]string) ([]string, [][]string) { + maasVals := []any{ + "http://maas.io/MAAS", // MAAS Domain + "y", // Enable Resource Availibility validation + "res-rule-1", // Rule name + "az1", // Availability Zone + "1", // Minimum number of machines + "4", // Minimum CPU cores per machine + "16", // Minimum RAM in GB + "256", // Minimum Disk capacity in GB + "pool1", // Machine pool + []string{"tag1"}, // Tags + "n", // Add another resource + "n", // Add another resource rule + "y", // Enable os image validation + "os-rule-1", // Rule name + "ubuntu/jammy", // image name + "amd64/ga-22.04", // image architecture + "n", // Add another image + "n", // Add another image rule + "y", // Enable internal DNS validation + "maas.io", //MAAS Domain + "subdomain.maas.io", // FQDN + "10.10.10.10", // IP + "A", // Record type + "10", // ttl + "n", // add another record + "n", // add another resource + "n", // add another internal DNS rule + "y", // Enable upstream DNS validation + "udns-rule-1", // Rule name + "1", // Expected number of servers + "n", // Add another upstream dns rule + } + return interleave(vals, sliceVals, maasVals) +} + func interleave(vals []string, sliceVals [][]string, inputVals []any) ([]string, [][]string) { for _, val := range inputVals { switch v := val.(type) { @@ -605,6 +662,11 @@ func (t *ValidatorTest) testInstallUpdatePasswords() (tr *test.TestResult) { "d551b7b1-78ae-43df-9d61-4935c843a454", // Azure Client ID "test_azure_client_secret", // Azure Client Secret + // MAAS validator + "maas-creds", // MAAS credentials secret name + "MAAS_API_KEY", // MAAS API token key + "fake:maas:token123", // MAAS API token + // OCI validator "y", // Add basic auth credentials "user2", // Registry username From 039e520f1bcbe52959877a694f8030cf5a418721 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Fri, 9 Aug 2024 18:53:58 -0600 Subject: [PATCH 02/17] feat: read vCenter privileges from local file or editor (#152) ## Issue Resolves #99 ## Description Rather than prompting users to select individual vCenter privileges, allow them to either specify a local file containing a single privilege per line or edit a file that's pre-populated with all valid privileges. --------- Signed-off-by: Tyler Gillson --- .gitignore | 1 + .vscode/launch.json | 33 + go.mod | 2 +- go.sum | 4 +- pkg/components/validator.go | 2 - pkg/config/constants.go | 15 +- pkg/services/validator/aws.go | 8 +- pkg/services/validator/azure.go | 10 +- pkg/services/validator/vmware.go | 112 ++- .../vsphere-root-level-privileges-all.yaml | 860 +++++++++--------- .../data/{policy.json => awsIAMPolicy.json} | 0 .../testcases/data/vCenterPrivileges.txt | 7 + .../_validator/testcases/test_validator.go | 206 +++-- 13 files changed, 669 insertions(+), 591 deletions(-) create mode 100644 .vscode/launch.json rename tests/integration/_validator/testcases/data/{policy.json => awsIAMPolicy.json} (100%) create mode 100644 tests/integration/_validator/testcases/data/vCenterPrivileges.txt diff --git a/.gitignore b/.gitignore index 2ed7f17d..54638006 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ _build/ .idea/modules.xml .idea/workspace.xml .vscode +!.vscode/launch.json *__debug_bin* # Binaries diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..4e773e10 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,33 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/validator.go", + "args": [ + "check", "-d", "-f", "/Users/tylergillson/.validator/validator-20240804075702/validator.yaml" + ], + "env": { + "CLI_VERSION": "0.0.4-dev", + } + }, + { + "name": "Integration Test", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${workspaceFolder}/tests/integration/suite_test.go", + "env": { + "DISABLE_KIND_CLUSTER_CHECK": "true", + "KUBECONFIG": "/Users/tylergillson/Downloads/vdev.kubeconfig", + "CLI_VERSION": "0.0.4-dev", + } + } + ] +} \ No newline at end of file diff --git a/go.mod b/go.mod index 08ac3178..1c4e71fc 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/pterm/pterm v0.12.79 github.com/sirupsen/logrus v1.9.3 github.com/spectrocloud-labs/embeddedfs v0.1.0 - github.com/spectrocloud-labs/prompts-tui v0.1.0 + github.com/spectrocloud-labs/prompts-tui v0.1.1 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/validator-labs/validator v0.1.2 diff --git a/go.sum b/go.sum index 8e57b131..3bcc8cb1 100644 --- a/go.sum +++ b/go.sum @@ -800,8 +800,8 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spectrocloud-labs/embeddedfs v0.1.0 h1:Izs9wPYLVp8Fp9mi9zYysu9AzvHK1kIelQz3IIfh4N0= github.com/spectrocloud-labs/embeddedfs v0.1.0/go.mod h1:JrCbGXImUCsim3jjYSahRJUKyVN57Fb5u3DkE3crqA4= -github.com/spectrocloud-labs/prompts-tui v0.1.0 h1:8UXUbNZNoEDNZYxAFViCnxznfPRhpS1zhgRWsRN3zOc= -github.com/spectrocloud-labs/prompts-tui v0.1.0/go.mod h1:XCvyEc3OLxKVXNLbOGZJOR6PiktfWqjYdrwU+ymCmLQ= +github.com/spectrocloud-labs/prompts-tui v0.1.1 h1:jNYFt6UzrSEc8K6GXyRenH1jzKbHwJbCCGMYtYYXKUo= +github.com/spectrocloud-labs/prompts-tui v0.1.1/go.mod h1:XCvyEc3OLxKVXNLbOGZJOR6PiktfWqjYdrwU+ymCmLQ= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= diff --git a/pkg/components/validator.go b/pkg/components/validator.go index fc8f993f..176c2d28 100644 --- a/pkg/components/validator.go +++ b/pkg/components/validator.go @@ -77,7 +77,6 @@ func NewValidatorConfig() *ValidatorConfig { Release: &validator.HelmRelease{}, Validator: &azure.AzureValidatorSpec{}, RuleTypes: make(map[int]string), - PlacementTypes: make(map[int]string), StaticDeploymentTypes: make(map[int]string), StaticDeploymentValues: make(map[int]*AzureStaticDeploymentValues), }, @@ -381,7 +380,6 @@ type AzurePluginConfig struct { ClientID string `yaml:"clientId"` ClientSecret string `yaml:"clientSecret"` RuleTypes map[int]string `yaml:"ruleTypes"` - PlacementTypes map[int]string `yaml:"placementTypes"` StaticDeploymentTypes map[int]string `yaml:"staticDeploymentTypes"` StaticDeploymentValues map[int]*AzureStaticDeploymentValues `yaml:"staticDeploymentValues"` Validator *azure.AzureValidatorSpec `yaml:"validator"` diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 6239db2e..44efaac4 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -18,6 +18,9 @@ const ( KindImageTag = "v1.30.2" NoProxyPrompt = "# Default NO_PROXY values are on the lines below.\n# Edit as you see fit (comments are ignored). The file should contain a list of NO_PROXY values, newline separated.\n# Type :wq to save and exit (if using vi).\n\n" + LocalFilepath = "Local Filepath" + FileEditor = "File Editor" + // Validator constants ValidatorConfigFile = "validator.yaml" ValidatorKindClusterName = "validator-kind-cluster" @@ -50,11 +53,9 @@ const ( ValidatorVsphereVersionConstraint = ">= 6.0, < 9.0" ValidatorVspherePrivilegeFile = "vsphere-root-level-privileges-all.yaml" - AWSPolicyDocumentPrompt = "# Provide the AWS policy document for IAM validation rule. The policy document should be in JSON format. Type :wq to save and exit (if using vi).\n" - + AWSPolicyDocumentPrompt = "# Provide the AWS policy document for IAM validation rule. The policy document should be in JSON format. Type :wq to save and exit (if using vi).\n" AzurePermissionSetPrompt = "# Provide the Azure permission set for IAM validation rule. The permission set should be in JSON format. Type :wq to save and exit (if using vi).\n" - - DefaultStorageClassAnnotation string = "storageclass.kubernetes.io/is-default-class" + VcenterPrivilegePrompt = "# All valid vCenter privileges are on the lines below.\n# Edit as you see fit (comments are ignored). The file should contain a list of privileges, newline separated.\n# Type :wq to save and exit (if using vi).\n\n" // Embed dirs Kind string = "kind" @@ -77,6 +78,7 @@ var ( HTTPSchemes = []string{"https://", "http://"} RegistryMirrors = []string{"docker.io", "gcr.io", "ghcr.io", "k8s.gcr.io", "registry.k8s.io", "quay.io", "*"} RegistryMirrorSeparator = "::" + FileInputs = []string{LocalFilepath, FileEditor} // Command dirs ValidatorSubdirs = []string{"logs", "manifests"} @@ -85,11 +87,6 @@ var ( ValidatorImagePath = func() string { return ValidatorImageRegistry + "/" + ValidatorImageRepository } - - PlacementTypeStatic = "Static" - PlacementTypeDynamic = "Dynamic" - PlacementTypes = []string{PlacementTypeStatic, PlacementTypeDynamic} - ValidatorWaitCmd = []string{"wait", "--for=condition=available", "--timeout=600s", "deployment/validator-controller-manager", "-n", "validator"} ValidatorBasicAuthKeys = []string{"username", "password"} ValidatorSinkKeys = map[vtypes.SinkType][]string{ diff --git a/pkg/services/validator/aws.go b/pkg/services/validator/aws.go index 6bc6f597..624988ff 100644 --- a/pkg/services/validator/aws.go +++ b/pkg/services/validator/aws.go @@ -443,19 +443,18 @@ func readIamPolicyRule(c *components.AWSPluginConfig, r *vpawsapi.IamPolicyRule, func readIamPolicy() (vpawsapi.PolicyDocument, error) { policyDoc := vpawsapi.PolicyDocument{} - inputType, err := prompts.Select("Add policy document via", []string{"Local Filepath", "File Editor"}) + inputType, err := prompts.Select("Add policy document via", cfg.FileInputs) if err != nil { return policyDoc, err } for { var policyBytes []byte - if inputType == "Local Filepath" { + if inputType == cfg.LocalFilepath { policyFile, err := prompts.ReadFilePath("Policy Document Filepath", "", "Invalid policy document path", false) if err != nil { return policyDoc, err } - policyBytes, err = os.ReadFile(policyFile) //#nosec if err != nil { return policyDoc, err @@ -463,7 +462,7 @@ func readIamPolicy() (vpawsapi.PolicyDocument, error) { } else { log.InfoCLI("Configure Policy Document") time.Sleep(2 * time.Second) - policyFile, err := prompts.EditFileValidatedByFullContent(cfg.AWSPolicyDocumentPrompt, "", prompts.ValidateJson, 1) + policyFile, err := prompts.EditFileValidatedByFullContent(cfg.AWSPolicyDocumentPrompt, "", prompts.ValidateJSON, 1) if err != nil { return policyDoc, err } @@ -478,7 +477,6 @@ func readIamPolicy() (vpawsapi.PolicyDocument, error) { if err != nil { return policyDoc, err } - if retry { continue } diff --git a/pkg/services/validator/azure.go b/pkg/services/validator/azure.go index 5b660504..61898c51 100644 --- a/pkg/services/validator/azure.go +++ b/pkg/services/validator/azure.go @@ -233,19 +233,18 @@ func configureAzureRBACRulePermissionSets(r *plug.RBACRule) error { log.InfoCLI("Note: You must configure at least one permission set for rule.") log.InfoCLI("If you're updating an existing RBAC rule, its permission sets will be replaced.") - inputType, err := prompts.Select("Add permission sets via", []string{"Local Filepath", "File Editor"}) + inputType, err := prompts.Select("Add permission sets via", cfg.FileInputs) if err != nil { return err } for { var permissionSetBytes []byte - if inputType == "Local Filepath" { + if inputType == cfg.LocalFilepath { permissionSetFile, err := prompts.ReadFilePath("Permission sets file path", "", "Invalid file path", false) if err != nil { return err } - permissionSetBytes, err = os.ReadFile(permissionSetFile) //#nosec if err != nil { return fmt.Errorf("failed to read permission sets file: %w", err) @@ -253,7 +252,7 @@ func configureAzureRBACRulePermissionSets(r *plug.RBACRule) error { } else { log.InfoCLI("Configure permission sets") time.Sleep(2 * time.Second) - permissionSetFile, err := prompts.EditFileValidatedByFullContent(cfg.AzurePermissionSetPrompt, "", prompts.ValidateJson, 1) + permissionSetFile, err := prompts.EditFileValidatedByFullContent(cfg.AzurePermissionSetPrompt, "", prompts.ValidateJSON, 1) if err != nil { return fmt.Errorf("failed to configure permission sets: %w", err) } @@ -266,9 +265,8 @@ func configureAzureRBACRulePermissionSets(r *plug.RBACRule) error { log.ErrorCLI("Failed to unmarshal the provided permission sets", "err", errUnmarshal) retry, err := prompts.ReadBool("Reconfigure permission sets", true) if err != nil { - return fmt.Errorf("failed to prompt for reconfiguration of permission sets: %w", err) + return err } - if retry { continue } diff --git a/pkg/services/validator/vmware.go b/pkg/services/validator/vmware.go index c275d51a..60db14cb 100644 --- a/pkg/services/validator/vmware.go +++ b/pkg/services/validator/vmware.go @@ -3,11 +3,13 @@ package validator import ( "context" "fmt" + "os" "reflect" "slices" "sort" "strconv" "strings" + "time" "emperror.dev/errors" "github.com/vmware/govmomi/object" @@ -369,15 +371,10 @@ func readRolePrivilegeRule(c *components.VspherePluginConfig, r *components.Vsph } if reconfigurePrivileges { - privileges, err := LoadPrivileges(cfg.ValidatorVspherePrivilegeFile) + r.Privileges, err = readPrivileges(r.Privileges) if err != nil { return err } - privileges, err = selectPrivileges(privileges) - if err != nil { - return err - } - r.Privileges = privileges } if idx == -1 { @@ -391,41 +388,96 @@ func readRolePrivilegeRule(c *components.VspherePluginConfig, r *components.Vsph return nil } -// LoadPrivileges returns a slice of privilege IDs from the provided privilege file -func LoadPrivileges(privilegeFile string) ([]string, error) { +// loadPrivileges returns a slice of privilege IDs from the provided privilege file +func loadPrivileges(privilegeFile string) (string, func(string) error, error) { privilegeBytes, err := embed.EFS.ReadFile(cfg.Validator, privilegeFile) if err != nil { - return nil, err + return "", nil, err } + var privilegeMap map[string][]string if err := yaml.Unmarshal(privilegeBytes, &privilegeMap); err != nil { - return nil, err + return "", nil, err } privileges := privilegeMap["privilegeIds"] - return privileges, nil + slices.Sort(privileges) + + validate := func(input string) error { + if !slices.Contains(privileges, strings.TrimSpace(input)) { + log.ErrorCLI("failed to read vCenter privileges", "invalidPrivilege", input) + return prompts.ErrValidationFailed + } + return nil + } + + return strings.Join(privileges, "\n"), validate, nil } -func selectPrivileges(allPrivileges []string) ([]string, error) { - var selectedPrivileges []string - slices.Sort(allPrivileges) +func readPrivileges(rulePrivileges []string) ([]string, error) { + defaultPrivileges, validate, err := loadPrivileges(cfg.ValidatorVspherePrivilegeFile) + if err != nil { + return nil, err + } + if len(rulePrivileges) > 0 { + defaultPrivileges = strings.Join(rulePrivileges, "\n") + } + + log.InfoCLI(` + Configure vCenter privileges. Either provide a local file path to a + file containing vCenter privileges or edit the privileges directly. - log.InfoCLI("Select custom privileges:\n") - for { - privilege, err := prompts.Select("", allPrivileges) - if err != nil { - return nil, err - } - selectedPrivileges = append(selectedPrivileges, privilege) + If providing a local file path, the file should contain a list of + vCenter privileges, newline separated. Lines starting with '#' are + considered comments and are ignored. - add, err := prompts.ReadBool("Add another privilege", true) - if err != nil { + If editing the privileges directly, your default editor will be opened + with all valid vCenter privileges prepopulated for you to edit. + `) + inputType, err := prompts.Select("Add privileges via", cfg.FileInputs) + if err != nil { + return nil, err + } + if inputType == cfg.LocalFilepath { + return readPrivilegesFromFile(validate) + } + + return readPrivilegesFromEditor(defaultPrivileges, validate) +} + +func readPrivilegesFromEditor(defaultPrivileges string, validate func(string) error) ([]string, error) { + log.InfoCLI("Configure vCenter privileges") + time.Sleep(2 * time.Second) + joinedPrivileges, err := prompts.EditFileValidatedByLine(cfg.VcenterPrivilegePrompt, defaultPrivileges, "\n", validate, 1) + if err != nil { + return nil, err + } + privileges := strings.Split(joinedPrivileges, "\n") + return privileges, nil +} + +func readPrivilegesFromFile(validate func(string) error) ([]string, error) { + privilegeFile, err := prompts.ReadFilePath("Privilege file path", "", "Invalid file path", false) + if err != nil { + return nil, err + } + privilegeBytes, err := os.ReadFile(privilegeFile) //#nosec + if err != nil { + return nil, fmt.Errorf("failed to read privilege file: %w", err) + } + privileges := strings.Split(string(privilegeBytes), "\n") + for _, p := range privileges { + if err := validate(p); err != nil { + retry, err := prompts.ReadBool("Reconfigure privileges", true) + if err != nil { + return nil, err + } + if retry { + return readPrivilegesFromFile(validate) + } return nil, err } - if !add { - break - } } - return selectedPrivileges, nil + return privileges, nil } func configureEntityPrivilegeRules(ctx context.Context, c *components.VspherePluginConfig, driver vsphere.Driver, ruleNames *[]string, vSphereCloudDriver vsphere.Driver) error { @@ -534,11 +586,7 @@ func readEntityPrivileges(ctx context.Context, c *components.VspherePluginConfig if err != nil { return err } - privileges, err := LoadPrivileges(cfg.ValidatorVspherePrivilegeFile) - if err != nil { - return err - } - r.Privileges, err = selectPrivileges(privileges) + r.Privileges, err = readPrivileges(r.Privileges) if err != nil { return err } diff --git a/pkg/utils/embed/resources/validator/vsphere-root-level-privileges-all.yaml b/pkg/utils/embed/resources/validator/vsphere-root-level-privileges-all.yaml index ad555c5f..c0e9b7d7 100644 --- a/pkg/utils/embed/resources/validator/vsphere-root-level-privileges-all.yaml +++ b/pkg/utils/embed/resources/validator/vsphere-root-level-privileges-all.yaml @@ -1,431 +1,431 @@ privilegeIds: - - System.Anonymous - - System.Read - - System.View - - Folder.Create - - Datastore.UpdateVirtualMachineMetadata - - Host.Config.PciPassthru - - VcIntegrity.HardwareCompatibility.Read - - ExternalStatsProvider.Unregister - - VirtualMachine.Config.RawDevice - - VirtualMachine.Namespace.ModifyContent - - VcIntegrity.ClusterConfiguration.Remediate - - ContentLibrary.ManageRegistry - - Global.SetCustomField - - TenantManager.Query - - VirtualMachine.Provisioning.MarkAsVM - - InventoryService.Tagging.AttachTag - - Extension.Update - - InventoryService.Tagging.ModifyUsedByForCategory - - Task.Update - - OvfManager.OvfConsumerAccess - - Cns.Searchable - - Host.Config.GuestStore - - VApp.ApplicationConfig - - VApp.Delete - - ContentLibrary.ManageClusterRegistryResource - - Infraprofile.Write - - DVSwitch.HostOp - - VirtualMachine.Config.ResetGuestInfo - - Cryptographer.ManageEncryptionPolicy - - TrustedAdmin.ReadTrustedHosts - - Host.Local.ManageUserGroups - - ContentLibrary.EvictLibraryItem - - VirtualMachine.Provisioning.Customize - - InventoryService.Tagging.DeleteCategory - - Nsx.Manage - - vStats.QueryAny - - Folder.Delete - - VirtualMachine.GuestOperations.Execute - - VirtualMachine.Interact.SetFloppyMedia - - Cryptographer.RegisterVM - - TrustedAdmin.ReadKMSTrust - - VirtualMachine.Provisioning.DiskRandomAccess - - VApp.Create - - VcIntegrity.lifecycleSoftwareSpecification.Read - - DVPortgroup.Modify - - Global.Health - - VirtualMachine.Interact.Pause - - VcIdentityProviders.Read - - TrustedAdmin.ConfigureHostMetadata - - ContentLibrary.TypeIntrospection - - Cryptographer.Encrypt - - Host.Config.DateTime - - Datastore.Delete - - VirtualMachine.Config.ManagedBy - - VcIntegrity.ClusterConfiguration.Modify - - Global.ScriptAction - - Global.DisableMethods - - Alarm.Create - - Profile.Edit - - VirtualMachine.Interact.EnableSecondary - - ContentLibrary.GetConfiguration - - Host.Config.AdvancedConfig - - vStats.CollectAny - - Host.Config.Resources - - ScheduledTask.Create - - CertificateManagement.Manage - - Datastore.AllocateSpace - - ContentLibrary.DeleteCertFromTrustStore - - Namespaces.Backup - - Performance.ModifyIntervals - - VApp.PowerOn - - Alarm.Edit - - EAM.Modify - - VirtualMachine.Config.Memory - - Namespaces.ManageDisks - - Host.Inventory.DeleteCluster - - Alarm.Delete - - VirtualMachine.Provisioning.PromoteDisks - - vStats.Settings - - VirtualMachine.Config.QueryUnownedFiles - - VirtualMachine.Interact.TerminateFaultTolerantVM - - VirtualMachine.Namespace.ReadContent - - VApp.Clone - - VirtualMachine.Interact.SuspendToMemory - - Certificate.Manage - - Host.Config.SystemManagement - - VirtualMachine.Hbr.ReplicaManagement - - VcIntegrity.ClusterConfiguration.Export - - InventoryService.Tagging.EditTag - - VirtualMachine.Interact.DeviceConnection - - VirtualMachine.Config.AddExistingDisk - - ContentLibrary.UpdateSession - - AutoDeploy.Host.AssociateMachine - - Profile.Create - - VirtualMachine.Inventory.CreateFromExisting - - VcIntegrity.Updates.com.vmware.vcIntegrity.ViewStatus - - VApp.Export - - Host.Inventory.AddHostToCluster - - VirtualMachine.Namespace.Query - - ScheduledTask.Delete - - Datacenter.Rename - - DVSwitch.PortSetting - - VirtualMachine.Interact.ConsoleInteract - - VirtualMachine.Provisioning.DiskRandomRead - - Authorization.ModifyRoles - - DVPortgroup.Delete - - VirtualMachine.Inventory.Delete - - VcIntegrity.lifecycleHealth.Write - - ContentLibrary.AddSubscription - - ContentLibrary.DeleteSubscription - - Resource.QueryVMotion - - VirtualMachine.Provisioning.Clone - - Host.Hbr.HbrManagement - - VirtualMachine.State.CreateSnapshot - - VirtualMachine.Config.Annotation - - VirtualMachine.Interact.SetCDMedia - - ContentLibrary.UpdateLibrary - - DVSwitch.Vspan - - TransferService.Monitor - - InventoryService.Tagging.ModifyUsedByForTag - - VirtualMachine.Config.EditDevice - - VcIntegrity.General.com.vmware.vcIntegrity.Configure - - ScheduledTask.Run - - IntercomNamespace.Read - - Host.Config.Patch - - Cryptographer.ReadKeyServersInfo - - Cryptographer.Recrypt - - VirtualMachine.Interact.Suspend - - ContentLibrary.SyncLibraryItem - - Host.Config.Maintenance - - VirtualMachine.Interact.Replay - - Global.Proxy - - VirtualMachine.GuestOperations.ModifyAliases - - VApp.Import - - AutoDeploy.Rule.Create - - Trust.Manage - - Global.LogEvent - - Extension.Unregister - - VirtualMachine.Provisioning.DeployTemplate - - Datacenter.IpPoolReleaseIp - - Host.Cim.CimInteraction - - Host.Config.NetService - - VirtualMachine.State.RenameSnapshot - - VirtualMachine.Interact.Record - - Host.Inventory.CreateCluster - - VcIntegrity.HardwareCompatibility.Write - - HLM.Manage - - VApp.PowerOff - - VirtualMachine.Config.DiskLease - - VirtualMachine.Config.HostUSBDevice - - ContentLibrary.UpdateSubscribedLibrary - - VApp.ResourceConfig - - Vsan.Cluster.ShallowRekey - - EAM.Config - - VcIntegrity.ClusterConfiguration.View - - VirtualMachine.Provisioning.GetVmFiles - - DVSwitch.Delete - - VirtualMachine.Interact.SESparseMaintenance - - VirtualMachine.Provisioning.PutVmFiles - - DVPortgroup.Ipfix - - VirtualMachine.Namespace.EventNotify - - VirtualMachine.Namespace.Management - - Host.Config.Quarantine - - Resource.MovePool - - VApp.PullFromUrls - - AutoDeploy.RuleSet.Activate - - VirtualMachine.Interact.PowerOn - - Sessions.GlobalMessage - - Namespaces.Upgrade - - SupervisorServices.Manage - - Datastore.Rename - - Global.ServiceManagers - - VirtualMachine.Interact.PutUsbScanCodes - - ContentLibrary.UpdateLibraryItem - - Host.Config.Power - - Host.Config.Snmp - - DVPortgroup.PolicyOp - - Namespaces.Manage - - ContentLibrary.DeleteLibraryItem - - vService.DestroyDependency - - ServiceAccount.ManageAccount - - VirtualMachine.Interact.PowerOff - - Host.Config.AutoStart - - VirtualMachine.Interact.MakePrimary - - InventoryService.Tagging.CreateTag - - Global.EnableMethods - - vService.UpdateDependency - - Infraprofile.Read - - InventoryService.Tagging.DeleteTag - - VirtualMachine.Provisioning.ReadCustSpecs - - CertificateAuthority.Manage - - ContentLibrary.AddCertToTrustStore - - ContentLibrary.ManageRegistryProject - - VcIntegrity.lifecycleSoftwareRemediation.Write - - AutoDeploy.Rule.Edit - - ServiceAccount.Administer - - Datastore.Move - - Cryptographer.Access - - Datacenter.Reconfigure - - TenantManager.Update - - DVPortgroup.ScopeOp - - VirtualMachine.Hbr.MonitorReplication - - Host.Config.Image - - TrustedAdmin.RetrieveTPMHostCertificates - - ContentLibrary.SyncLibrary - - ContentLibrary.UpdateConfiguration - - Host.Config.Network - - vSphereDataProtection.Protection - - Host.Inventory.RenameCluster - - Resource.ApplyRecommendation - - Host.Local.DeleteVM - - Cryptographer.ManageKeys - - VcIntegrity.lifecycleHealth.Read - - VApp.Unregister - - AutoDeploy.RuleSet.Edit - - ContentLibrary.CheckOutTemplate - - Global.Diagnostics - - VcIntegrity.Updates.com.vmware.vcIntegrity.Stage - - GuestDataPublisher.GetData - - Datacenter.Move - - VApp.Suspend - - ContentLibrary.PublishLibraryItem - - Sessions.TerminateSession - - VirtualMachine.Provisioning.FileRandomAccess - - Network.Move - - Folder.Move - - Host.Config.Nvdimm - - Namespaces.SelfServiceManage - - Datastore.UpdateVirtualMachineFiles - - Global.Licenses - - Alarm.Acknowledge - - HealthUpdateProvider.Register - - VirtualMachine.Config.RemoveDisk - - ContentLibrary.UpdateSubscription - - Nsx.ModifyAll - - Alarm.DisableActions - - VirtualMachine.Config.Resource - - Host.Config.Connection - - VirtualMachine.Config.Rename - - VcIntegrity.lifecycleGeneral.Write - - VirtualMachine.Config.ReloadFromPath - - VApp.Rename - - ContentLibrary.DownloadSession - - Resource.HotMigrate - - VirtualMachine.Interact.Backup - - vService.ReconfigureDependency - - VApp.AssignVApp - - vSphereDataProtection.Recovery - - ContentLibrary.CheckInTemplate - - Namespaces.Configure - - VirtualMachine.GuestOperations.Query - - Host.Local.InstallAgent - - Profile.Export - - Observability.Admin - - VcIntegrity.lifecycleSoftwareRemediation.Read - - ExternalStatsProvider.Update - - TrustedAdmin.ReadAttestingSSO - - DVSwitch.ResourceManagement - - Datacenter.Delete - - VirtualMachine.Interact.ToolsInstall - - Authorization.ModifyPermissions - - Global.SystemTag - - DVSwitch.Move - - TrustedAdmin.ConfigureHostCertificates - - TrustedAdmin.ConfigureTokenConversionPolicy - - Datastore.Config - - VirtualMachine.Config.AdvancedConfig - - Datastore.DeleteFile - - Host.Local.ReconfigVM - - VcLifecycle.View - - Global.CancelTask - - VirtualMachine.Config.DiskExtend - - VcIntegrity.lifecycleSoftwareSpecification.Write - - ContentLibrary.DeleteLocalLibrary - - Cryptographer.RegisterHost - - VirtualMachine.Inventory.Unregister - - AutoDeploy.Profile.Edit - - VirtualMachine.Config.UpgradeVirtualHardware - - Trust.Administer - - Resource.EditPool - - Cryptographer.Clone - - DVSwitch.PortConfig - - CertificateAuthority.Administer - - DVSwitch.Ipfix - - HealthUpdateProvider.Update - - VcIntegrity.lifecycleSettings.Write - - SettingsStore.Manage - - InventoryService.Tagging.ObjectAttachable - - Host.Inventory.MoveHost - - Network.Assign - - VirtualMachine.Inventory.Move - - Authorization.ModifyPrivileges - - VirtualMachine.GuestOperations.Modify - - VApp.AssignVM - - StorageProfile.Update - - DVSwitch.PolicyOp - - Network.Config - - Cryptographer.ManageKeyServers - - VirtualMachine.Config.QueryFTCompatibility - - ContentLibrary.EvictSubscribedLibrary - - Host.Inventory.AddStandaloneHost - - DVPortgroup.Create - - Datastore.FileManagement - - VcIntegrity.Baseline.com.vmware.vcIntegrity.AssignBaselines - - VcIdentityProviders.Create - - VirtualMachine.Config.MksControl - - Resource.AssignVMToPool - - VcIntegrity.Updates.com.vmware.vcIntegrity.Scan - - ContentLibrary.DeleteSubscribedLibrary - - Host.Inventory.MoveCluster - - VirtualMachine.Interact.CreateSecondary - - Host.Inventory.EditCluster - - StoragePod.Config - - StorageProfile.View - - VcLifecycle.Upgrade - - TrustedAdmin.ManageAttestingSSO - - VirtualMachine.Interact.Reset - - ComputePolicy.Manage - - Nsx.Read - - Host.Config.Firmware - - Sessions.ValidateSession - - Host.Config.HyperThreading - - ContentLibrary.ImportStorage - - ExternalStatsProvider.Register - - VirtualMachine.Config.AddRemoveDevice - - Host.Config.Memory - - Network.Delete - - Plugin.Management - - VirtualMachineClasses.Manage - - TransferService.Manage - - Global.ManageCustomFields - - StorageViews.ConfigureService - - CertificateManagement.Administer - - VirtualMachine.Config.ToggleForkParent - - Resource.CreatePool - - Cryptographer.EncryptNew - - Profile.Delete - - TrustedAdmin.ManageKMSTrust - - VirtualMachine.Interact.AnswerQuestion - - Host.Config.ProductLocker - - VirtualMachine.Interact.TurnOffFaultTolerance - - VirtualMachine.Hbr.ConfigureReplication - - Cryptographer.Migrate - - VApp.InstanceConfig - - VirtualMachine.Config.CPUCount - - VirtualMachine.Config.AddNewDisk - - TrustedAdmin.RetrieveHostMetadata - - VirtualMachine.State.RevertToSnapshot - - Datastore.Browse - - VApp.ExtractOvfEnvironment - - HLM.Create - - ScheduledTask.Edit - - VirtualMachine.Config.ChangeTracking - - VirtualMachine.Interact.DefragmentAllDisks - - Profile.Clear - - VirtualMachine.Provisioning.ModifyCustSpecs - - VirtualMachine.Provisioning.CreateTemplateFromVM - - ContentLibrary.CreateSubscribedLibrary - - Namespaces.ListAccess - - Global.CapacityPlanning - - Alarm.ToggleEnableOnEntity - - Host.Local.CreateVM - - Authorization.ReassignRolePermissions - - EAM.View - - Global.VCServer - - Task.Create - - VirtualMachine.Inventory.Create - - AutoDeploy.Rule.Delete - - VcIntegrity.lifecycleSettings.Read - - VcIntegrity.Baseline.com.vmware.vcIntegrity.ManageBaselines - - Sessions.ImpersonateUser - - Alarm.SetStatus - - VirtualMachine.Interact.DnD - - VcIntegrity.lifecycleGeneral.Read - - VcIntegrity.Updates.com.vmware.vcIntegrity.Remediate - - Namespaces.ManageCapabilities - - Global.Settings - - vService.CreateDependency - - Datacenter.IpPoolConfig - - Global.GlobalTag - - VcIntegrity.FileUpload.com.vmware.vcIntegrity.ImportFile - - DVSwitch.Modify - - HealthUpdateProvider.Unregister - - VcIdentityProviders.Manage - - Resource.ColdMigrate - - TrustedAdmin.ManageTrustedHosts - - VcIntegrity.lifecycleDepots.Delete - - Resource.RenamePool - - Host.Inventory.ManageClusterLifecyle - - DVSwitch.Create - - VirtualMachine.Interact.CreateScreenshot - - VirtualMachine.State.RemoveSnapshot - - AutoDeploy.Profile.Create - - IntercomNamespace.Write - - ContentLibrary.UpdateLocalLibrary - - InventoryService.Tagging.EditCategory - - VirtualMachine.Provisioning.CloneTemplate - - VirtualMachine.Inventory.Register - - VApp.Move - - ServiceAccount.ManagePassword - - VirtualMachine.Interact.GuestControl - - InventoryService.Tagging.CreateCategory - - VApp.ManagedByConfig - - VirtualMachine.Provisioning.MarkAsTemplate - - Datacenter.IpPoolQueryAllocations - - VirtualMachine.Config.SwapPlacement - - VirtualMachine.Namespace.Event - - Resource.DeletePool - - ContentLibrary.PublishLibrary - - Datacenter.Create - - VApp.AssignResourcePool - - vSphereClient.UtilizeVerificationCode - - Host.Config.Settings - - Folder.Rename - - Cryptographer.Decrypt - - Extension.Register - - Cryptographer.AddDisk - - TrustedAdmin.ReadStsInfo - - VirtualMachine.Config.Settings - - VirtualMachine.Interact.DisableSecondary - - ContentLibrary.ProbeSubscription - - ContentLibrary.ReadStorage - - Host.Config.AuthenticationStore - - StorageViews.View - - Profile.View - - ContentLibrary.AddLibraryItem - - ContentLibrary.CreateLocalLibrary - - Resource.AssignVAppToPool - - VirtualMachine.GuestOperations.QueryAliases - - Host.Inventory.RemoveHostFromCluster +- Alarm.Acknowledge +- Alarm.Create +- Alarm.Delete +- Alarm.DisableActions +- Alarm.Edit +- Alarm.SetStatus +- Alarm.ToggleEnableOnEntity +- Authorization.ModifyPermissions +- Authorization.ModifyPrivileges +- Authorization.ModifyRoles +- Authorization.ReassignRolePermissions +- AutoDeploy.Host.AssociateMachine +- AutoDeploy.Profile.Create +- AutoDeploy.Profile.Edit +- AutoDeploy.Rule.Create +- AutoDeploy.Rule.Delete +- AutoDeploy.Rule.Edit +- AutoDeploy.RuleSet.Activate +- AutoDeploy.RuleSet.Edit +- Certificate.Manage +- CertificateAuthority.Administer +- CertificateAuthority.Manage +- CertificateManagement.Administer +- CertificateManagement.Manage +- Cns.Searchable +- ComputePolicy.Manage +- ContentLibrary.AddCertToTrustStore +- ContentLibrary.AddLibraryItem +- ContentLibrary.AddSubscription +- ContentLibrary.CheckInTemplate +- ContentLibrary.CheckOutTemplate +- ContentLibrary.CreateLocalLibrary +- ContentLibrary.CreateSubscribedLibrary +- ContentLibrary.DeleteCertFromTrustStore +- ContentLibrary.DeleteLibraryItem +- ContentLibrary.DeleteLocalLibrary +- ContentLibrary.DeleteSubscribedLibrary +- ContentLibrary.DeleteSubscription +- ContentLibrary.DownloadSession +- ContentLibrary.EvictLibraryItem +- ContentLibrary.EvictSubscribedLibrary +- ContentLibrary.GetConfiguration +- ContentLibrary.ImportStorage +- ContentLibrary.ManageClusterRegistryResource +- ContentLibrary.ManageRegistry +- ContentLibrary.ManageRegistryProject +- ContentLibrary.ProbeSubscription +- ContentLibrary.PublishLibrary +- ContentLibrary.PublishLibraryItem +- ContentLibrary.ReadStorage +- ContentLibrary.SyncLibrary +- ContentLibrary.SyncLibraryItem +- ContentLibrary.TypeIntrospection +- ContentLibrary.UpdateConfiguration +- ContentLibrary.UpdateLibrary +- ContentLibrary.UpdateLibraryItem +- ContentLibrary.UpdateLocalLibrary +- ContentLibrary.UpdateSession +- ContentLibrary.UpdateSubscribedLibrary +- ContentLibrary.UpdateSubscription +- Cryptographer.Access +- Cryptographer.AddDisk +- Cryptographer.Clone +- Cryptographer.Decrypt +- Cryptographer.Encrypt +- Cryptographer.EncryptNew +- Cryptographer.ManageEncryptionPolicy +- Cryptographer.ManageKeyServers +- Cryptographer.ManageKeys +- Cryptographer.Migrate +- Cryptographer.ReadKeyServersInfo +- Cryptographer.Recrypt +- Cryptographer.RegisterHost +- Cryptographer.RegisterVM +- DVPortgroup.Create +- DVPortgroup.Delete +- DVPortgroup.Ipfix +- DVPortgroup.Modify +- DVPortgroup.PolicyOp +- DVPortgroup.ScopeOp +- DVSwitch.Create +- DVSwitch.Delete +- DVSwitch.HostOp +- DVSwitch.Ipfix +- DVSwitch.Modify +- DVSwitch.Move +- DVSwitch.PolicyOp +- DVSwitch.PortConfig +- DVSwitch.PortSetting +- DVSwitch.ResourceManagement +- DVSwitch.Vspan +- Datacenter.Create +- Datacenter.Delete +- Datacenter.IpPoolConfig +- Datacenter.IpPoolQueryAllocations +- Datacenter.IpPoolReleaseIp +- Datacenter.Move +- Datacenter.Reconfigure +- Datacenter.Rename +- Datastore.AllocateSpace +- Datastore.Browse +- Datastore.Config +- Datastore.Delete +- Datastore.DeleteFile +- Datastore.FileManagement +- Datastore.Move +- Datastore.Rename +- Datastore.UpdateVirtualMachineFiles +- Datastore.UpdateVirtualMachineMetadata +- EAM.Config +- EAM.Modify +- EAM.View +- Extension.Register +- Extension.Unregister +- Extension.Update +- ExternalStatsProvider.Register +- ExternalStatsProvider.Unregister +- ExternalStatsProvider.Update +- Folder.Create +- Folder.Delete +- Folder.Move +- Folder.Rename +- Global.CancelTask +- Global.CapacityPlanning +- Global.Diagnostics +- Global.DisableMethods +- Global.EnableMethods +- Global.GlobalTag +- Global.Health +- Global.Licenses +- Global.LogEvent +- Global.ManageCustomFields +- Global.Proxy +- Global.ScriptAction +- Global.ServiceManagers +- Global.SetCustomField +- Global.Settings +- Global.SystemTag +- Global.VCServer +- GuestDataPublisher.GetData +- HLM.Create +- HLM.Manage +- HealthUpdateProvider.Register +- HealthUpdateProvider.Unregister +- HealthUpdateProvider.Update +- Host.Cim.CimInteraction +- Host.Config.AdvancedConfig +- Host.Config.AuthenticationStore +- Host.Config.AutoStart +- Host.Config.Connection +- Host.Config.DateTime +- Host.Config.Firmware +- Host.Config.GuestStore +- Host.Config.HyperThreading +- Host.Config.Image +- Host.Config.Maintenance +- Host.Config.Memory +- Host.Config.NetService +- Host.Config.Network +- Host.Config.Nvdimm +- Host.Config.Patch +- Host.Config.PciPassthru +- Host.Config.Power +- Host.Config.ProductLocker +- Host.Config.Quarantine +- Host.Config.Resources +- Host.Config.Settings +- Host.Config.Snmp +- Host.Config.SystemManagement +- Host.Hbr.HbrManagement +- Host.Inventory.AddHostToCluster +- Host.Inventory.AddStandaloneHost +- Host.Inventory.CreateCluster +- Host.Inventory.DeleteCluster +- Host.Inventory.EditCluster +- Host.Inventory.ManageClusterLifecyle +- Host.Inventory.MoveCluster +- Host.Inventory.MoveHost +- Host.Inventory.RemoveHostFromCluster +- Host.Inventory.RenameCluster +- Host.Local.CreateVM +- Host.Local.DeleteVM +- Host.Local.InstallAgent +- Host.Local.ManageUserGroups +- Host.Local.ReconfigVM +- Infraprofile.Read +- Infraprofile.Write +- IntercomNamespace.Read +- IntercomNamespace.Write +- InventoryService.Tagging.AttachTag +- InventoryService.Tagging.CreateCategory +- InventoryService.Tagging.CreateTag +- InventoryService.Tagging.DeleteCategory +- InventoryService.Tagging.DeleteTag +- InventoryService.Tagging.EditCategory +- InventoryService.Tagging.EditTag +- InventoryService.Tagging.ModifyUsedByForCategory +- InventoryService.Tagging.ModifyUsedByForTag +- InventoryService.Tagging.ObjectAttachable +- Namespaces.Backup +- Namespaces.Configure +- Namespaces.ListAccess +- Namespaces.Manage +- Namespaces.ManageCapabilities +- Namespaces.ManageDisks +- Namespaces.SelfServiceManage +- Namespaces.Upgrade +- Network.Assign +- Network.Config +- Network.Delete +- Network.Move +- Nsx.Manage +- Nsx.ModifyAll +- Nsx.Read +- Observability.Admin +- OvfManager.OvfConsumerAccess +- Performance.ModifyIntervals +- Plugin.Management +- Profile.Clear +- Profile.Create +- Profile.Delete +- Profile.Edit +- Profile.Export +- Profile.View +- Resource.ApplyRecommendation +- Resource.AssignVAppToPool +- Resource.AssignVMToPool +- Resource.ColdMigrate +- Resource.CreatePool +- Resource.DeletePool +- Resource.EditPool +- Resource.HotMigrate +- Resource.MovePool +- Resource.QueryVMotion +- Resource.RenamePool +- ScheduledTask.Create +- ScheduledTask.Delete +- ScheduledTask.Edit +- ScheduledTask.Run +- ServiceAccount.Administer +- ServiceAccount.ManageAccount +- ServiceAccount.ManagePassword +- Sessions.GlobalMessage +- Sessions.ImpersonateUser +- Sessions.TerminateSession +- Sessions.ValidateSession +- SettingsStore.Manage +- StoragePod.Config +- StorageProfile.Update +- StorageProfile.View +- StorageViews.ConfigureService +- StorageViews.View +- SupervisorServices.Manage +- System.Anonymous +- System.Read +- System.View +- Task.Create +- Task.Update +- TenantManager.Query +- TenantManager.Update +- TransferService.Manage +- TransferService.Monitor +- Trust.Administer +- Trust.Manage +- TrustedAdmin.ConfigureHostCertificates +- TrustedAdmin.ConfigureHostMetadata +- TrustedAdmin.ConfigureTokenConversionPolicy +- TrustedAdmin.ManageAttestingSSO +- TrustedAdmin.ManageKMSTrust +- TrustedAdmin.ManageTrustedHosts +- TrustedAdmin.ReadAttestingSSO +- TrustedAdmin.ReadKMSTrust +- TrustedAdmin.ReadStsInfo +- TrustedAdmin.ReadTrustedHosts +- TrustedAdmin.RetrieveHostMetadata +- TrustedAdmin.RetrieveTPMHostCertificates +- VApp.ApplicationConfig +- VApp.AssignResourcePool +- VApp.AssignVApp +- VApp.AssignVM +- VApp.Clone +- VApp.Create +- VApp.Delete +- VApp.Export +- VApp.ExtractOvfEnvironment +- VApp.Import +- VApp.InstanceConfig +- VApp.ManagedByConfig +- VApp.Move +- VApp.PowerOff +- VApp.PowerOn +- VApp.PullFromUrls +- VApp.Rename +- VApp.ResourceConfig +- VApp.Suspend +- VApp.Unregister +- VcIdentityProviders.Create +- VcIdentityProviders.Manage +- VcIdentityProviders.Read +- VcIntegrity.Baseline.com.vmware.vcIntegrity.AssignBaselines +- VcIntegrity.Baseline.com.vmware.vcIntegrity.ManageBaselines +- VcIntegrity.ClusterConfiguration.Export +- VcIntegrity.ClusterConfiguration.Modify +- VcIntegrity.ClusterConfiguration.Remediate +- VcIntegrity.ClusterConfiguration.View +- VcIntegrity.FileUpload.com.vmware.vcIntegrity.ImportFile +- VcIntegrity.General.com.vmware.vcIntegrity.Configure +- VcIntegrity.HardwareCompatibility.Read +- VcIntegrity.HardwareCompatibility.Write +- VcIntegrity.Updates.com.vmware.vcIntegrity.Remediate +- VcIntegrity.Updates.com.vmware.vcIntegrity.Scan +- VcIntegrity.Updates.com.vmware.vcIntegrity.Stage +- VcIntegrity.Updates.com.vmware.vcIntegrity.ViewStatus +- VcIntegrity.lifecycleDepots.Delete +- VcIntegrity.lifecycleGeneral.Read +- VcIntegrity.lifecycleGeneral.Write +- VcIntegrity.lifecycleHealth.Read +- VcIntegrity.lifecycleHealth.Write +- VcIntegrity.lifecycleSettings.Read +- VcIntegrity.lifecycleSettings.Write +- VcIntegrity.lifecycleSoftwareRemediation.Read +- VcIntegrity.lifecycleSoftwareRemediation.Write +- VcIntegrity.lifecycleSoftwareSpecification.Read +- VcIntegrity.lifecycleSoftwareSpecification.Write +- VcLifecycle.Upgrade +- VcLifecycle.View +- VirtualMachine.Config.AddExistingDisk +- VirtualMachine.Config.AddNewDisk +- VirtualMachine.Config.AddRemoveDevice +- VirtualMachine.Config.AdvancedConfig +- VirtualMachine.Config.Annotation +- VirtualMachine.Config.CPUCount +- VirtualMachine.Config.ChangeTracking +- VirtualMachine.Config.DiskExtend +- VirtualMachine.Config.DiskLease +- VirtualMachine.Config.EditDevice +- VirtualMachine.Config.HostUSBDevice +- VirtualMachine.Config.ManagedBy +- VirtualMachine.Config.Memory +- VirtualMachine.Config.MksControl +- VirtualMachine.Config.QueryFTCompatibility +- VirtualMachine.Config.QueryUnownedFiles +- VirtualMachine.Config.RawDevice +- VirtualMachine.Config.ReloadFromPath +- VirtualMachine.Config.RemoveDisk +- VirtualMachine.Config.Rename +- VirtualMachine.Config.ResetGuestInfo +- VirtualMachine.Config.Resource +- VirtualMachine.Config.Settings +- VirtualMachine.Config.SwapPlacement +- VirtualMachine.Config.ToggleForkParent +- VirtualMachine.Config.UpgradeVirtualHardware +- VirtualMachine.GuestOperations.Execute +- VirtualMachine.GuestOperations.Modify +- VirtualMachine.GuestOperations.ModifyAliases +- VirtualMachine.GuestOperations.Query +- VirtualMachine.GuestOperations.QueryAliases +- VirtualMachine.Hbr.ConfigureReplication +- VirtualMachine.Hbr.MonitorReplication +- VirtualMachine.Hbr.ReplicaManagement +- VirtualMachine.Interact.AnswerQuestion +- VirtualMachine.Interact.Backup +- VirtualMachine.Interact.ConsoleInteract +- VirtualMachine.Interact.CreateScreenshot +- VirtualMachine.Interact.CreateSecondary +- VirtualMachine.Interact.DefragmentAllDisks +- VirtualMachine.Interact.DeviceConnection +- VirtualMachine.Interact.DisableSecondary +- VirtualMachine.Interact.DnD +- VirtualMachine.Interact.EnableSecondary +- VirtualMachine.Interact.GuestControl +- VirtualMachine.Interact.MakePrimary +- VirtualMachine.Interact.Pause +- VirtualMachine.Interact.PowerOff +- VirtualMachine.Interact.PowerOn +- VirtualMachine.Interact.PutUsbScanCodes +- VirtualMachine.Interact.Record +- VirtualMachine.Interact.Replay +- VirtualMachine.Interact.Reset +- VirtualMachine.Interact.SESparseMaintenance +- VirtualMachine.Interact.SetCDMedia +- VirtualMachine.Interact.SetFloppyMedia +- VirtualMachine.Interact.Suspend +- VirtualMachine.Interact.SuspendToMemory +- VirtualMachine.Interact.TerminateFaultTolerantVM +- VirtualMachine.Interact.ToolsInstall +- VirtualMachine.Interact.TurnOffFaultTolerance +- VirtualMachine.Inventory.Create +- VirtualMachine.Inventory.CreateFromExisting +- VirtualMachine.Inventory.Delete +- VirtualMachine.Inventory.Move +- VirtualMachine.Inventory.Register +- VirtualMachine.Inventory.Unregister +- VirtualMachine.Namespace.Event +- VirtualMachine.Namespace.EventNotify +- VirtualMachine.Namespace.Management +- VirtualMachine.Namespace.ModifyContent +- VirtualMachine.Namespace.Query +- VirtualMachine.Namespace.ReadContent +- VirtualMachine.Provisioning.Clone +- VirtualMachine.Provisioning.CloneTemplate +- VirtualMachine.Provisioning.CreateTemplateFromVM +- VirtualMachine.Provisioning.Customize +- VirtualMachine.Provisioning.DeployTemplate +- VirtualMachine.Provisioning.DiskRandomAccess +- VirtualMachine.Provisioning.DiskRandomRead +- VirtualMachine.Provisioning.FileRandomAccess +- VirtualMachine.Provisioning.GetVmFiles +- VirtualMachine.Provisioning.MarkAsTemplate +- VirtualMachine.Provisioning.MarkAsVM +- VirtualMachine.Provisioning.ModifyCustSpecs +- VirtualMachine.Provisioning.PromoteDisks +- VirtualMachine.Provisioning.PutVmFiles +- VirtualMachine.Provisioning.ReadCustSpecs +- VirtualMachine.State.CreateSnapshot +- VirtualMachine.State.RemoveSnapshot +- VirtualMachine.State.RenameSnapshot +- VirtualMachine.State.RevertToSnapshot +- VirtualMachineClasses.Manage +- Vsan.Cluster.ShallowRekey +- vService.CreateDependency +- vService.DestroyDependency +- vService.ReconfigureDependency +- vService.UpdateDependency +- vSphereClient.UtilizeVerificationCode +- vSphereDataProtection.Protection +- vSphereDataProtection.Recovery +- vStats.CollectAny +- vStats.QueryAny +- vStats.Settings \ No newline at end of file diff --git a/tests/integration/_validator/testcases/data/policy.json b/tests/integration/_validator/testcases/data/awsIAMPolicy.json similarity index 100% rename from tests/integration/_validator/testcases/data/policy.json rename to tests/integration/_validator/testcases/data/awsIAMPolicy.json diff --git a/tests/integration/_validator/testcases/data/vCenterPrivileges.txt b/tests/integration/_validator/testcases/data/vCenterPrivileges.txt new file mode 100644 index 00000000..66d1c4fa --- /dev/null +++ b/tests/integration/_validator/testcases/data/vCenterPrivileges.txt @@ -0,0 +1,7 @@ +# Test vCenter privileges +Alarm.Acknowledge +Alarm.Create +Alarm.Delete +Alarm.DisableActions +Alarm.Edit +Alarm.SetStatus \ No newline at end of file diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index 3fc7fe66..fc9f51ee 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -232,57 +232,57 @@ func (t *ValidatorTest) awsPluginInstallValues(ctx *test.TestContext, vals []str func (t *ValidatorTest) awsPluginValues(ctx *test.TestContext, vals []string, sliceVals [][]string) ([]string, [][]string) { awsVals := []any{ - "us-west-2", // default region - "y", // enable IAM role validation - "SpectroCloudRole", // IAM role name - "Local Filepath", // Policy Document Source - t.filePath("policy.json"), // Policy Document File - "n", // add another policy document - "n", // add another IAM role rule - "y", // enable IAM user validation - "SpectroCloudUser", // IAM user name - "Local Filepath", // Policy Document Source - t.filePath("policy.json"), // Policy Document File - "n", // add another policy document - "n", // add another IAM user rule - "y", // enable IAM group validation - "SpectroCloudGroup", // IAM group name - "Local Filepath", // Policy Document Source - t.filePath("policy.json"), // Policy Document File - "n", // add another policy document - "n", // add another IAM group rule - "y", // enable IAM policy validation + "us-west-2", // default region + "y", // enable IAM role validation + "SpectroCloudRole", // IAM role name + "Local Filepath", // Policy Document Source + t.filePath("awsIAMPolicy.json"), // Policy Document File + "n", // add another policy document + "n", // add another IAM role rule + "y", // enable IAM user validation + "SpectroCloudUser", // IAM user name + "Local Filepath", // Policy Document Source + t.filePath("awsIAMPolicy.json"), // Policy Document File + "n", // add another policy document + "n", // add another IAM user rule + "y", // enable IAM group validation + "SpectroCloudGroup", // IAM group name + "Local Filepath", // Policy Document Source + t.filePath("awsIAMPolicy.json"), // Policy Document File + "n", // add another policy document + "n", // add another IAM group rule + "y", // enable IAM policy validation "arn:aws:iam::account-num:policy/some-policy", // IAM policy ARN - "Local Filepath", // Policy Document Source - t.filePath("policy.json"), // Policy Document File - "n", // add another policy document - "n", // add another IAM policy rule - "y", // enable service quota validation - "EC2", // rule name - "EC2-VPC Elastic IPs", // service quota type - "us-west-2", // service quota region #1 - "5", // service quota buffer #1 - "n", // add another service quota rule - "y", // enable subnet tag validation - "subnet", // tag resource type - "elb tag rule", // rule name - "us-west-2", // subnet tag region #1 - "foo", // subnet tag key #1 - "bar", // subnet tag value #1 - []string{"arn-1"}, // subnet arns - "n", // add another subnet tag rule - "n", // add another tag rule - "y", // enable AMI validation - "ami rule", // rule name - "us-west-2", // ami region - []string{"ami-1", "ami-2"}, // AMI ids - "y", // add an AMI filter - "foo", // filter tag - []string{"bar", "baz"}, // filter values - "n", // is this a tag filter - "n", // add another filter - []string{""}, // owners - "n", // add another AMI rule + "Local Filepath", // Policy Document Source + t.filePath("awsIAMPolicy.json"), // Policy Document File + "n", // add another policy document + "n", // add another IAM policy rule + "y", // enable service quota validation + "EC2", // rule name + "EC2-VPC Elastic IPs", // service quota type + "us-west-2", // service quota region #1 + "5", // service quota buffer #1 + "n", // add another service quota rule + "y", // enable subnet tag validation + "subnet", // tag resource type + "elb tag rule", // rule name + "us-west-2", // subnet tag region #1 + "foo", // subnet tag key #1 + "bar", // subnet tag value #1 + []string{"arn-1"}, // subnet arns + "n", // add another subnet tag rule + "n", // add another tag rule + "y", // enable AMI validation + "ami rule", // rule name + "us-west-2", // ami region + []string{"ami-1", "ami-2"}, // AMI ids + "y", // add an AMI filter + "foo", // filter tag + []string{"bar", "baz"}, // filter values + "n", // is this a tag filter + "n", // add another filter + []string{""}, // owners + "n", // add another AMI rule } return interleave(vals, sliceVals, awsVals) } @@ -433,60 +433,58 @@ func (t *ValidatorTest) vspherePluginInstallValues(ctx *test.TestContext, vals [ func (t *ValidatorTest) vspherePluginValues(ctx *test.TestContext, vals []string) []string { vsphereVals := []string{ - "DC0", // datacenter - "y", // Enable NTP check - "ntpd", // NTP rule name - "y", // are hosts cluster scoped - "C0", // cluster name - "DC0_C0_H0", // host1 - "y", // add more hosts - "DC0_C0_H1", // host2 - "n", // add more hosts - "n", // add more validation rules - "y", // Check role privileges - "role rule 1", // Role privilege rule name - "user1@vsphere.local", // user to check role privileges against - "System.Read", // role privilege - "y", // add another role privilege to this rule - "Alarm.Acknowledge", // role privilege - "n", // add another role privilege to this rule - "n", // add another role privilege rule - "y", // check entity privileges - "entity rule 1", // entity privilege rule name - "user2@vsphere.local", // user to check entity privileges against - "Folder", // entity type - "spectro-templates", // folder name - "Folder.Create", // entity privilege - "n", // add another entity privilege to this rule - "n", // add more entity privilege rules - "y", // check compute resource requirements - "resource requirement rule 1", // resource requirement rule name - "Cluster", // select cluster for resource check - "C0", // cluster name for resource check - "master-pool", // node pool name - "1", // number of nodes - "2GHz", // per node cpu - "4Gi", // per node memory - "10Gi", // per node storage - "y", // add another node pool - "worker-pool", // node pool name - "3", // number of nodes - "3GHz", // per node cpu - "8Gi", // per node memory - "20Gi", // per node storage - "n", // add more node pools - "n", // add more resource requirement checks - "y", // check tags on entities - "tag rule 1", // tag rule name - "Datacenter", // entity type - "DC0", // datacenter name - "k8s-region", // tag - "y", // add another tag rule - "tag rule 2", // tag rule name - "Cluster", // entity type - "C0", // cluster name - "k8s-zone", // tag - "n", // add another tag rule + "DC0", // datacenter + "y", // Enable NTP check + "ntpd", // NTP rule name + "y", // are hosts cluster scoped + "C0", // cluster name + "DC0_C0_H0", // host1 + "y", // add more hosts + "DC0_C0_H1", // host2 + "n", // add more hosts + "n", // add more validation rules + "y", // Check role privileges + "role rule 1", // Role privilege rule name + "user1@vsphere.local", // user to check role privileges against + "Local Filepath", // vCenter privileges Source + t.filePath("vCenterPrivileges.txt"), // privileges File + "n", // add another role privilege rule + "y", // check entity privileges + "entity rule 1", // entity privilege rule name + "user2@vsphere.local", // user to check entity privileges against + "Folder", // entity type + "spectro-templates", // folder name + "Local Filepath", // vCenter privileges Source + t.filePath("vCenterPrivileges.txt"), // privileges File + "n", // add more entity privilege rules + "y", // check compute resource requirements + "resource requirement rule 1", // resource requirement rule name + "Cluster", // select cluster for resource check + "C0", // cluster name for resource check + "master-pool", // node pool name + "1", // number of nodes + "2GHz", // per node cpu + "4Gi", // per node memory + "10Gi", // per node storage + "y", // add another node pool + "worker-pool", // node pool name + "3", // number of nodes + "3GHz", // per node cpu + "8Gi", // per node memory + "20Gi", // per node storage + "n", // add more node pools + "n", // add more resource requirement checks + "y", // check tags on entities + "tag rule 1", // tag rule name + "Datacenter", // entity type + "DC0", // datacenter name + "k8s-region", // tag + "y", // add another tag rule + "tag rule 2", // tag rule name + "Cluster", // entity type + "C0", // cluster name + "k8s-zone", // tag + "n", // add another tag rule } vals = append(vals, vsphereVals...) return vals From 065cbc24b9eb71496abc36ded52b1f92b5fc75ed Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Fri, 9 Aug 2024 19:29:54 -0600 Subject: [PATCH 03/17] refactor: remove explicit TypeMetas; use vapi constants (#154) N/A Remove explicit TypeMeta initialization for direct rule evaluation. This is no longer needed now that the `ValidationRule` interface in validator has been updated to include `GetKind`, all plugins are updated to satisfy the updated interface, and validator's `Build` validation result method is now setting `APIVersion` and `Kind`. --------- Signed-off-by: Tyler Gillson --- go.mod | 18 ++++++++++-------- go.sum | 32 ++++++++++++++++---------------- pkg/cmd/validator/validator.go | 33 ++++----------------------------- pkg/services/validator/oci.go | 2 +- pkg/utils/kube/kube.go | 7 ++----- 5 files changed, 33 insertions(+), 59 deletions(-) diff --git a/go.mod b/go.mod index 1c4e71fc..4b94ff37 100644 --- a/go.mod +++ b/go.mod @@ -16,13 +16,13 @@ require ( github.com/spectrocloud-labs/prompts-tui v0.1.1 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 - github.com/validator-labs/validator v0.1.2 - github.com/validator-labs/validator-plugin-aws v0.1.3 - github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec + github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c + github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df + github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 - github.com/validator-labs/validator-plugin-network v0.0.22 - github.com/validator-labs/validator-plugin-oci v0.1.0 - github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240808221109-a93cb7014075 + github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 + github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 + github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38 github.com/vmware/govmomi v0.39.0 golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa gopkg.in/yaml.v2 v2.4.0 @@ -81,7 +81,7 @@ require ( github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0 // indirect + github.com/aws/aws-sdk-go-v2/service/ec2 v1.174.0 // indirect github.com/aws/aws-sdk-go-v2/service/ecr v1.32.0 // indirect github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.25.3 // indirect github.com/aws/aws-sdk-go-v2/service/efs v1.31.3 // indirect @@ -95,7 +95,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect github.com/aws/smithy-go v1.20.3 // indirect - github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240807144652-27a1eeba0782 // indirect + github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240809155957-ac94a3401898 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/blang/semver/v4 v4.0.0 // indirect @@ -265,4 +265,6 @@ require ( ) // replace github.com/spectrocloud-labs/prompts-tui => ../../spectrocloud-labs/prompts-tui + +// replace github.com/validator-labs/validator => ../validator replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 diff --git a/go.sum b/go.sum index 3bcc8cb1..08f131c0 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,8 @@ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 h1:C6WHdGnTDIYETAm5iE github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0 h1:ta62lid9JkIpKZtZZXSj6rP2AqY5x1qYGq53ffxqD9Q= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0/go.mod h1:o6QDjdVKpP5EF0dp/VlvqckzuSDATr1rLdHt3A5m0YY= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.174.0 h1:xY25etxTt0mYfWVWv8DjIUcJQyX2cwBeInpIvg6Sbsw= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.174.0/go.mod h1:o6QDjdVKpP5EF0dp/VlvqckzuSDATr1rLdHt3A5m0YY= github.com/aws/aws-sdk-go-v2/service/ecr v1.32.0 h1:lZoKOTEQUf5Oi9qVaZM/Hb0Z6SHIwwpDjbLFOVgB2t8= github.com/aws/aws-sdk-go-v2/service/ecr v1.32.0/go.mod h1:RhaP7Wil0+uuuhiE4FzOOEFZwkmFAk1ZflXzK+O3ptU= github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.25.3 h1:n2eqzO9VabUkd77b88Hos6OEtbGohB/TRrtXLTZi38Y= @@ -212,8 +212,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 h1:ZsDKRLXGWHk8WdtyYMoGNO7bTudr github.com/aws/aws-sdk-go-v2/service/sts v1.30.3/go.mod h1:zwySh8fpFyXp9yOr/KVzxOl8SRqgf/IDw5aUt9UKFcQ= github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE= github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240807144652-27a1eeba0782 h1:eBIQewfIMpNPGZRXNjjJOW6ccbIokR5NDOtDOMZkBjg= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240807144652-27a1eeba0782/go.mod h1:/1+gxjBqwEu/k2A01NbATEo0+X82cbaZA9+SzYeG634= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240809155957-ac94a3401898 h1:AvFUc3gOvaw2avFhMTgbyWoa8lTAiwUqiHQzRyfJgOE= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240809155957-ac94a3401898/go.mod h1:g/jwspvaX2Kvy+cuE6NRlboLhoS2kHeYDmfc880tS1Y= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= @@ -855,20 +855,20 @@ github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG81+twTK4= github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A= -github.com/validator-labs/validator v0.1.2 h1:2KqwetsZFeK5ol7Hd/VGO1Ccz8WQFVs5QwfLf8blp10= -github.com/validator-labs/validator v0.1.2/go.mod h1:AdpMOk2xYjlpUjmPJ2CN6MNDFN4NLH/q4lqUziseHpU= -github.com/validator-labs/validator-plugin-aws v0.1.3 h1:8C/cprrt0RW8j97LOPSyuqyy1EDuHZfJthpS+tZY5PE= -github.com/validator-labs/validator-plugin-aws v0.1.3/go.mod h1:aY+4x9iA76XzjjS7fTXWJPytxCFospvzIOhJgnlpkq0= -github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec h1:07OqIrf6LEdH/ghuTM3xgln2OZVsgZVTIpNKUoRDLlA= -github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809035651-b4687e5f1cec/go.mod h1:5rNcu7SqOk9zXfbCyvxnKlYn/J0l7iOu1zvHEqSVkx0= +github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c h1:9Dy8DW7qdSQflkwiNPcBPkf/wgAOT+ddmSDvOabjnVQ= +github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c/go.mod h1:TU04WjenuJxvJI/uhRsBJRym3ysA+dvSwUs2qvnak1Q= +github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df h1:ryzjKVisPy4yRIBOBUyKO4k7/CAL8wDHHN+9T6+bPUE= +github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df/go.mod h1:NAPw04DYgOQUKN7GmGy65gETac19lDAjCAPtE4nLe5Q= +github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 h1:BFlJUBviwxKnrgYnemEqW643Ohj32XvDr6VNbQYzmOI= +github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10/go.mod h1:Lg4K6Uc7BkNi3KIr0gEPYDcwfjmFNI0uYHm4tbVyswo= github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 h1:mw98qwizN2s2y9q/L4yLK8osmFc52bVHmLkDoymFKtY= github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70/go.mod h1:JyQk0ehRB+zNnhyYRpzk5ZekZZReFOfeJ7L6z0kln64= -github.com/validator-labs/validator-plugin-network v0.0.22 h1:tlyyA8wq2j9/tmNjxP5JuQEY0Xh6aLedFp9s2943CVg= -github.com/validator-labs/validator-plugin-network v0.0.22/go.mod h1:0zlqCtTNHxPAp7jKN/1abzRBXRXvBNWSQzVEhkQCrXg= -github.com/validator-labs/validator-plugin-oci v0.1.0 h1:odFaKQQJ3AYxXSdjlkfn26HlEEYyA/UMtouj3I/Sw5M= -github.com/validator-labs/validator-plugin-oci v0.1.0/go.mod h1:R39V5VgdKiN8ugjYDfbOZ+7s2keGlRq3SvGcrV6ub8M= -github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240808221109-a93cb7014075 h1:dKHPwBBEdkljZCZsKDBLHivFYBKlVrrJNkTe/NRqlK8= -github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240808221109-a93cb7014075/go.mod h1:jANTSAkr2NQmSa2rOMe2qspWoOLsU0X2+8kztpurdSw= +github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 h1:iHmrJU1FBgfBzMuQ1tcYZiy2nZ5Qwmvu6GZ787b5odo= +github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4/go.mod h1:zA+EcB7wV2qj67SiFpzpTq1Bv08BIqJWU/+XrbeBRZM= +github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 h1:5A/j5XFU720xFvmuqunGM4Rz1NB1KIWVodQqhleP4Jk= +github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104/go.mod h1:lC/pR8XKRKLKlDYObm8v6eDaj7NkmBjAskheuQXE7V0= +github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38 h1:hYw3ZTbHBdhCJoFeXkhYipWHkVpdLufwWsSxuoWN1aE= +github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38/go.mod h1:hBGQsKzO2TCG0QArBnZHNUpofxT02J9WYBV/rtDVcok= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/vmware/govmomi v0.39.0 h1:soLZ08Q2zvjRSinNup8xVlw0KDDCJPPA1rIDmBhi7As= diff --git a/pkg/cmd/validator/validator.go b/pkg/cmd/validator/validator.go index 0bfc2711..fdff6b08 100644 --- a/pkg/cmd/validator/validator.go +++ b/pkg/cmd/validator/validator.go @@ -382,8 +382,8 @@ func getValidationResultsCRDClient(tc *cfg.TaskConfig) (dynamic.NamespaceableRes log.Debug("Using kubeconfig from validator configuration file: %s", vc.Kubeconfig) } - gv := kube.GetGroupVersion("validation.spectrocloud.labs", "v1alpha1") - kClient, err := kube.GetCRDClient(gv, "validationresults") + gv := kube.GetGroupVersion(vapi.GroupVersion.Group, vapi.GroupVersion.Version) + kClient, err := kube.GetCRDClient(gv, vapi.ValidationResultGroupResource) if err != nil { return nil, errors.Wrap(err, "failed to get validation result client") } @@ -511,11 +511,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.AWSPlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "AwsValidator", - } vrr := awsval.Validate(*vc.AWSPlugin.Validator, l) if err := vres.Finalize(vr, vrr, l); err != nil { return err @@ -535,11 +530,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.AzurePlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "AzureValidator", - } vrr := azureval.Validate(context.Background(), *vc.AzurePlugin.Validator, l) if err := vres.Finalize(vr, vrr, l); err != nil { return err @@ -579,11 +569,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.NetworkPlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "NetworkValidator", - } vrr := netval.Validate(*vc.NetworkPlugin.Validator, vc.NetworkPlugin.Validator.CACerts.RawCerts(), vc.NetworkPlugin.HTTPFileAuthBytes(), l, @@ -606,11 +591,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.OCIPlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "OciValidator", - } vrr := ocival.Validate(*vc.OCIPlugin.Validator, vc.OCIPlugin.BasicAuths(), vc.OCIPlugin.AllPubKeys(), l, @@ -633,11 +613,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.VspherePlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "VsphereValidator", - } vrr := vsphereval.Validate(context.Background(), *vc.VspherePlugin.Validator, vc.VspherePlugin.Account, l) if err := vres.Finalize(vr, vrr, l); err != nil { return err @@ -982,8 +957,8 @@ func applyValidator(c *cfg.Config, vc *components.ValidatorConfig) error { func watchValidatorConfig(numPlugins int) (bool, error) { log.InfoCLI("\nWatching validator config, waiting for plugins to be installed or failed") - gv := kube.GetGroupVersion("validation.spectrocloud.labs", "v1alpha1") - kClient, err := kube.GetCRDClient(gv, "validatorconfigs") + gv := kube.GetGroupVersion(vapi.GroupVersion.Group, vapi.GroupVersion.Version) + kClient, err := kube.GetCRDClient(gv, vapi.ValidatorConfigGroupResource) if err != nil { return false, errors.Wrap(err, "failed to get validator config client") } diff --git a/pkg/services/validator/oci.go b/pkg/services/validator/oci.go index e6902a55..7f76e20c 100644 --- a/pkg/services/validator/oci.go +++ b/pkg/services/validator/oci.go @@ -287,7 +287,7 @@ func readOciRegistryRule(c *components.OCIPluginConfig, r *plug.OciRegistryRule, return err } if authSecretName != notApplicable { - r.Auth = plug.Auth{SecretName: authSecretName} + r.Auth = plug.Auth{SecretName: &authSecretName} } if err := readArtifactRefs(r); err != nil { diff --git a/pkg/utils/kube/kube.go b/pkg/utils/kube/kube.go index decfbc7f..601b8c3c 100644 --- a/pkg/utils/kube/kube.go +++ b/pkg/utils/kube/kube.go @@ -30,9 +30,6 @@ type KubectlCmd struct { DelayMsg string } -// Crd represents a custom resource definition -type Crd string - // KubectlCommand executes a kubectl command with the given parameters func KubectlCommand(params []string, kConfig string) (out, stderr string, err error) { params = append(params, fmt.Sprintf("--kubeconfig=%s", kConfig)) @@ -70,7 +67,7 @@ func GetGroupVersion(group, version string) schema.GroupVersion { } // GetCRDClient returns a dynamic client for the given CRD -func GetCRDClient(groupVersion schema.GroupVersion, crd Crd) (dynamic.NamespaceableResourceInterface, error) { +func GetCRDClient(groupVersion schema.GroupVersion, groupResource schema.GroupResource) (dynamic.NamespaceableResourceInterface, error) { dynClient, err := getDynamicClient() if err != nil { return nil, err @@ -79,7 +76,7 @@ func GetCRDClient(groupVersion schema.GroupVersion, crd Crd) (dynamic.Namespacea version := schema.GroupVersionResource{ Group: groupVersion.Group, Version: groupVersion.Version, - Resource: string(crd), + Resource: groupResource.Resource, } return dynClient.Resource(version), nil From 042f0c65f534a2dfe9403b2f9317d9ddb488cbcf Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 11:32:05 -0700 Subject: [PATCH 04/17] feat: WIP: add maas plugin --- go.mod | 2 +- go.sum | 4 +- hack/validator.tmpl | 7 +-- pkg/config/versions.go | 6 +-- pkg/services/validator/aws.go | 3 ++ pkg/services/validator/maas.go | 1 - .../validator/validator-base-values.tmpl | 10 ++++ .../_validator/testcases/test_validator.go | 46 ++++++++++--------- 8 files changed, 47 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index 4b94ff37..c18e37a3 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 - github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 + github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612 github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38 diff --git a/go.sum b/go.sum index 08f131c0..b68d0571 100644 --- a/go.sum +++ b/go.sum @@ -861,8 +861,8 @@ github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f7 github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df/go.mod h1:NAPw04DYgOQUKN7GmGy65gETac19lDAjCAPtE4nLe5Q= github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 h1:BFlJUBviwxKnrgYnemEqW643Ohj32XvDr6VNbQYzmOI= github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10/go.mod h1:Lg4K6Uc7BkNi3KIr0gEPYDcwfjmFNI0uYHm4tbVyswo= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 h1:mw98qwizN2s2y9q/L4yLK8osmFc52bVHmLkDoymFKtY= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70/go.mod h1:JyQk0ehRB+zNnhyYRpzk5ZekZZReFOfeJ7L6z0kln64= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612 h1:dM8Ot/EX0/tNvGfOtK8OMPwpYfXltxWJeN7yO49SzwY= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612/go.mod h1:sla9fLOH2YRzKYfzqCf4ljA7LtiPT+DxuI8R/X0GZh8= github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 h1:iHmrJU1FBgfBzMuQ1tcYZiy2nZ5Qwmvu6GZ787b5odo= github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4/go.mod h1:zA+EcB7wV2qj67SiFpzpTq1Bv08BIqJWU/+XrbeBRZM= github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 h1:5A/j5XFU720xFvmuqunGM4Rz1NB1KIWVodQqhleP4Jk= diff --git a/hack/validator.tmpl b/hack/validator.tmpl index 5f61ea61..47d444c3 100644 --- a/hack/validator.tmpl +++ b/hack/validator.tmpl @@ -849,8 +849,8 @@ maasPlugin: - name: Image Rule images: - name: example - architecture: amd64/ga-20.04 - resourceAvailabilityRules: + architecture: amd64/ga-20.04 + resourceAvailabilityRules: - name: AZ1 az: az1 resources: @@ -861,4 +861,5 @@ maasPlugin: host: "http://example.com/MAAS" auth: secretName: maas-creds - tokenKey: MAAS_API_KEY \ No newline at end of file + tokenKey: MAAS_API_KEY + maasApiToken: "ZmFrZTptYWFzYXBpOnRva2Vu" \ No newline at end of file diff --git a/pkg/config/versions.go b/pkg/config/versions.go index d45c8125..012ec891 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -2,11 +2,11 @@ package config // ValidatorChartVersions is a map of validator component names to their respective versions var ValidatorChartVersions = map[string]string{ - Validator: "v0.1.2", + Validator: "v0.1.3", ValidatorPluginAws: "v0.1.3", ValidatorPluginAzure: "v0.0.15", - ValidatorPluginMaas: "v0.0.7", + ValidatorPluginMaas: "v0.0.7", ValidatorPluginNetwork: "v0.0.22", - ValidatorPluginOci: "v0.1.0", + ValidatorPluginOci: "v0.2.0", ValidatorPluginVsphere: "v0.0.29", } diff --git a/pkg/services/validator/aws.go b/pkg/services/validator/aws.go index 624988ff..5a8b3d35 100644 --- a/pkg/services/validator/aws.go +++ b/pkg/services/validator/aws.go @@ -137,6 +137,7 @@ func configureIamRoleRules(c *components.AWSPluginConfig, ruleNames *[]string) e return nil } +// nolint:dupl func readIamRoleRule(c *components.AWSPluginConfig, r *vpawsapi.IamRoleRule, idx int, ruleNames *[]string) error { if r == nil { r = &vpawsapi.IamRoleRule{ @@ -225,6 +226,7 @@ func configureIamUserRules(c *components.AWSPluginConfig, ruleNames *[]string) e return nil } +// nolint:dupl func readIamUserRule(c *components.AWSPluginConfig, r *vpawsapi.IamUserRule, idx int, ruleNames *[]string) error { if r == nil { r = &vpawsapi.IamUserRule{ @@ -313,6 +315,7 @@ func configureIamGroupRules(c *components.AWSPluginConfig, ruleNames *[]string) return nil } +// nolint:dupl func readIamGroupRule(c *components.AWSPluginConfig, r *vpawsapi.IamGroupRule, idx int, ruleNames *[]string) error { if r == nil { r = &vpawsapi.IamGroupRule{ diff --git a/pkg/services/validator/maas.go b/pkg/services/validator/maas.go index 1eef95d9..041168ef 100644 --- a/pkg/services/validator/maas.go +++ b/pkg/services/validator/maas.go @@ -57,7 +57,6 @@ func readMaasPlugin(vc *components.ValidatorConfig, tc *cfg.TaskConfig, k8sClien if err := readMaasCredentials(c, tc, k8sClient); err != nil { return fmt.Errorf("failed to read MAAS credentials: %w", err) } - return nil } diff --git a/pkg/utils/embed/resources/validator/validator-base-values.tmpl b/pkg/utils/embed/resources/validator/validator-base-values.tmpl index 9a8dd1ce..00ec2e4d 100644 --- a/pkg/utils/embed/resources/validator/validator-base-values.tmpl +++ b/pkg/utils/embed/resources/validator/validator-base-values.tmpl @@ -194,3 +194,13 @@ pluginSecrets: {{- else }} vSphere: {} {{- end }} + + {{- if .MAASPlugin.Validator.Auth.SecretName }} + maas: + secretName: {{ .MAASPlugin.Validator.Auth.SecretName }} + tokenKey: {{ .MAASPlugin.Validator.Auth.TokenKey }} + maasApiToken: {{ .MAASPlugin.MaasAPIToken }} + {{- else }} + maas: {} + {{- end }} + \ No newline at end of file diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index fc9f51ee..5422c73f 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -55,21 +55,21 @@ func (t *ValidatorTest) Execute(ctx *test.TestContext) (tr *test.TestResult) { if result := t.testInstallSilent(); result.IsFailed() { return result } - if result := t.testInstallSilentWait(); result.IsFailed() { - return result - } - if result := t.testCheckDirect(); result.IsFailed() { - return result - } - if result := t.testDescribe(); result.IsFailed() { - return result - } - if result := t.testUndeploy(); result.IsFailed() { - return result - } - if result := t.testInstallUpdatePasswords(); result.IsFailed() { - return result - } + // if result := t.testInstallSilentWait(); result.IsFailed() { + // return result + // } + // if result := t.testCheckDirect(); result.IsFailed() { + // return result + // } + // if result := t.testDescribe(); result.IsFailed() { + // return result + // } + // if result := t.testUndeploy(); result.IsFailed() { + // return result + // } + // if result := t.testInstallUpdatePasswords(); result.IsFailed() { + // return result + // } return test.Success() } @@ -492,14 +492,16 @@ func (t *ValidatorTest) vspherePluginValues(ctx *test.TestContext, vals []string func (t *ValidatorTest) maasPluginInstallValues(ctx *test.TestContext, vals []string) []string { maasVals := []string{ - "y", // install MAAS plugin - "maas-creds", // MAAS credentials secret name - "MAAS_API_KEY", // MAAS API token key - "fake:maas:token", // MAAS API token + "y", // install MAAS plugin + "maas-creds", // MAAS credentials secret name + "MAAS_API_KEY", // MAAS API token key + "fake:maasapi:token", // MAAS API token } if string_utils.IsDevVersion(ctx.Get("version")) { - maasVals = slices.Insert(maasVals, 1, cfg.ValidatorChartVersions[cfg.ValidatorPluginMaas]) + maasVals = slices.Insert(maasVals, 1, + cfg.ValidatorChartVersions[cfg.ValidatorPluginMaas], + ) } vals = append(vals, maasVals...) @@ -528,7 +530,7 @@ func (t *ValidatorTest) maasPluginValues(ctx *test.TestContext, vals []string, s "n", // Add another image "n", // Add another image rule "y", // Enable internal DNS validation - "maas.io", //MAAS Domain + "maas.io", // MAAS Domain "subdomain.maas.io", // FQDN "10.10.10.10", // IP "A", // Record type @@ -663,7 +665,7 @@ func (t *ValidatorTest) testInstallUpdatePasswords() (tr *test.TestResult) { // MAAS validator "maas-creds", // MAAS credentials secret name "MAAS_API_KEY", // MAAS API token key - "fake:maas:token123", // MAAS API token + "fake:maasapi:token", // MAAS API token // OCI validator "y", // Add basic auth credentials From 2abe222286d392004b639e2184ab72ab499a3349 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 11:33:21 -0700 Subject: [PATCH 05/17] feat: app fake api key --- hack/validator.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/validator.tmpl b/hack/validator.tmpl index 47d444c3..4c70f1d9 100644 --- a/hack/validator.tmpl +++ b/hack/validator.tmpl @@ -862,4 +862,4 @@ maasPlugin: auth: secretName: maas-creds tokenKey: MAAS_API_KEY - maasApiToken: "ZmFrZTptYWFzYXBpOnRva2Vu" \ No newline at end of file + maasApiToken: "jG81nj7n8feUpHaIU/gFH2tLaqcnSshrpCiziFt+0JZ7OA==" \ No newline at end of file From 2927af949b0e4c5eb74e78a409ea5bbad855c8a3 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Mon, 12 Aug 2024 12:45:02 -0600 Subject: [PATCH 06/17] chore: fix int. test Signed-off-by: Tyler Gillson --- .vscode/launch.json | 1 + pkg/cmd/validator/validator.go | 1 + pkg/utils/embed/resources/validator/validator-base-values.tmpl | 2 +- tests/integration/_validator/testcases/data/validator.yaml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 4e773e10..fb2c5f22 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -27,6 +27,7 @@ "DISABLE_KIND_CLUSTER_CHECK": "true", "KUBECONFIG": "/Users/tylergillson/Downloads/vdev.kubeconfig", "CLI_VERSION": "0.0.4-dev", + "HELM_PRESERVE_FILES": "true" } } ] diff --git a/pkg/cmd/validator/validator.go b/pkg/cmd/validator/validator.go index fdff6b08..08560d13 100644 --- a/pkg/cmd/validator/validator.go +++ b/pkg/cmd/validator/validator.go @@ -560,6 +560,7 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { } results = append(results, vr) } + if vc.NetworkPlugin.Enabled { v := &netapi.NetworkValidator{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/utils/embed/resources/validator/validator-base-values.tmpl b/pkg/utils/embed/resources/validator/validator-base-values.tmpl index 00ec2e4d..3e940b68 100644 --- a/pkg/utils/embed/resources/validator/validator-base-values.tmpl +++ b/pkg/utils/embed/resources/validator/validator-base-values.tmpl @@ -195,7 +195,7 @@ pluginSecrets: vSphere: {} {{- end }} - {{- if .MAASPlugin.Validator.Auth.SecretName }} + {{- if .MAASPlugin.Enabled }} maas: secretName: {{ .MAASPlugin.Validator.Auth.SecretName }} tokenKey: {{ .MAASPlugin.Validator.Auth.TokenKey }} diff --git a/tests/integration/_validator/testcases/data/validator.yaml b/tests/integration/_validator/testcases/data/validator.yaml index b3158024..f0ad2bb2 100644 --- a/tests/integration/_validator/testcases/data/validator.yaml +++ b/tests/integration/_validator/testcases/data/validator.yaml @@ -827,6 +827,7 @@ azurePlugin: secretName: azure-creds maasPlugin: enabled: true + maasApiToken: "jG81nj7n8feUpHaIU/gFH2tLaqcnSshrpCiziFt+0JZ7OA==" helmRelease: chart: name: validator-plugin-maas From cb8e95def177989a966adf3e03c65340e320ea57 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Mon, 12 Aug 2024 12:46:04 -0600 Subject: [PATCH 07/17] test: enable all suites Signed-off-by: Tyler Gillson --- .../_validator/testcases/test_validator.go | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index 5422c73f..a0872f06 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -55,21 +55,21 @@ func (t *ValidatorTest) Execute(ctx *test.TestContext) (tr *test.TestResult) { if result := t.testInstallSilent(); result.IsFailed() { return result } - // if result := t.testInstallSilentWait(); result.IsFailed() { - // return result - // } - // if result := t.testCheckDirect(); result.IsFailed() { - // return result - // } - // if result := t.testDescribe(); result.IsFailed() { - // return result - // } - // if result := t.testUndeploy(); result.IsFailed() { - // return result - // } - // if result := t.testInstallUpdatePasswords(); result.IsFailed() { - // return result - // } + if result := t.testInstallSilentWait(); result.IsFailed() { + return result + } + if result := t.testCheckDirect(); result.IsFailed() { + return result + } + if result := t.testDescribe(); result.IsFailed() { + return result + } + if result := t.testUndeploy(); result.IsFailed() { + return result + } + if result := t.testInstallUpdatePasswords(); result.IsFailed() { + return result + } return test.Success() } From 0d7626841176f26e1f239080dc2a7da61d3aaab6 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 12:54:37 -0700 Subject: [PATCH 08/17] chore: add fake maas key to gitleaksignore --- .gitleaksignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitleaksignore b/.gitleaksignore index b81d9ca0..d6405ce8 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -4,4 +4,5 @@ e7156f3be822e9da88949cd9405e8eedde836e5f:tests/integration/_validator/testcases/ e7156f3be822e9da88949cd9405e8eedde836e5f:tests/integration/_validator/testcases/data/validator.yaml:generic-api-key:51 481cdf910c0bc555363ae4278b2f57a66a72ed6b:tests/integration/_validator/testcases/data/validator.yaml:generic-api-key:27 481cdf910c0bc555363ae4278b2f57a66a72ed6b:tests/integration/_validator/testcases/data/validator.yaml:generic-api-key:51 -hack/validator.tmpl:generic-api-key:538 \ No newline at end of file +hack/validator.tmpl:generic-api-key:538 +hack/validator.tmpl:generic-api-key:865 \ No newline at end of file From 14bd56c27eacf559fbd9367e80ac1d9d1fd74e06 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 12:55:40 -0700 Subject: [PATCH 09/17] chore: make reviewable --- go.mod | 2 +- pkg/config/versions.go | 4 ++-- .../_validator/testcases/data/validator.yaml | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 5ebead53..285035f0 100644 --- a/go.mod +++ b/go.mod @@ -268,4 +268,4 @@ require ( // replace github.com/validator-labs/validator => ../validator -replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 \ No newline at end of file +replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 diff --git a/pkg/config/versions.go b/pkg/config/versions.go index 012ec891..e7de6945 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -5,8 +5,8 @@ var ValidatorChartVersions = map[string]string{ Validator: "v0.1.3", ValidatorPluginAws: "v0.1.3", ValidatorPluginAzure: "v0.0.15", - ValidatorPluginMaas: "v0.0.7", + ValidatorPluginMaas: "v0.0.7", ValidatorPluginNetwork: "v0.0.22", ValidatorPluginOci: "v0.2.0", - ValidatorPluginVsphere: "v0.0.29", + ValidatorPluginVsphere: "v0.0.30", } diff --git a/tests/integration/_validator/testcases/data/validator.yaml b/tests/integration/_validator/testcases/data/validator.yaml index f0ad2bb2..1073e580 100644 --- a/tests/integration/_validator/testcases/data/validator.yaml +++ b/tests/integration/_validator/testcases/data/validator.yaml @@ -5,7 +5,7 @@ helmRelease: chart: name: validator repository: validator - version: v0.1.2 + version: v0.1.3 values: "" helmReleaseSecret: name: validator-helm-release-validator @@ -201,7 +201,7 @@ ociPlugin: chart: name: validator-plugin-oci repository: validator-plugin-oci - version: v0.1.0 + version: v0.2.0 values: "" secrets: - name: oci-creds @@ -231,7 +231,7 @@ vspherePlugin: chart: name: validator-plugin-vsphere repository: validator-plugin-vsphere - version: v0.0.29 + version: v0.0.30 values: "" account: insecure: true @@ -827,7 +827,6 @@ azurePlugin: secretName: azure-creds maasPlugin: enabled: true - maasApiToken: "jG81nj7n8feUpHaIU/gFH2tLaqcnSshrpCiziFt+0JZ7OA==" helmRelease: chart: name: validator-plugin-maas @@ -850,8 +849,8 @@ maasPlugin: - name: Image Rule images: - name: example - architecture: amd64/ga-20.04 - resourceAvailabilityRules: + architecture: amd64/ga-20.04 + resourceAvailabilityRules: - name: AZ1 az: az1 resources: @@ -862,4 +861,5 @@ maasPlugin: host: "http://example.com/MAAS" auth: secretName: maas-creds - tokenKey: MAAS_API_KEY \ No newline at end of file + tokenKey: MAAS_API_KEY + maasApiToken: "jG81nj7n8feUpHaIU/gFH2tLaqcnSshrpCiziFt+0JZ7OA==" \ No newline at end of file From 25a3a8fec70ba2796474cad2b3ebd243d098f696 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 12:56:03 -0700 Subject: [PATCH 10/17] style: add better descriptions of maas plugin --- pkg/services/validator/validator_service.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/services/validator/validator_service.go b/pkg/services/validator/validator_service.go index d22f4793..cc274866 100644 --- a/pkg/services/validator/validator_service.go +++ b/pkg/services/validator/validator_service.go @@ -249,13 +249,13 @@ func handlePlugins(vc *components.ValidatorConfig, tc *cfg.TaskConfig, kClient k log.Header("MAAS Plugin") log.InfoCLI(` The MAAS validator plugin reconciles MaasValidator custom resources to perform - the following validation against your network: + the following validation against your MAAS cluster: - - Upstream DNS - - Internal DNS - - Resources - - OS Images - `) // TODO - elaborate + - Check that a certain number of Upstream DNS servers are configured. + - Check that the expected Internal DNS settings are present. + - Check that the expected number of Machines matching a certain spec are "Ready" for use in each Availability Zone. + - Check that all required OS Images are "Synced" to the cluster. + `) vc.MaasPlugin.Enabled, err = prompts.ReadBool(fmt.Sprintf("%s MAAS plugin", verb), true) if err != nil { return err From 7112e4c92a1000296c2cd2b6e787b626e93413bf Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 21:33:45 -0700 Subject: [PATCH 11/17] style: alphabetise plugins --- pkg/cmd/validator/validator.go | 35 ++++------ pkg/components/validator.go | 70 +++++++++---------- .../validator/validator-base-values.tmpl | 19 +++-- 3 files changed, 57 insertions(+), 67 deletions(-) diff --git a/pkg/cmd/validator/validator.go b/pkg/cmd/validator/validator.go index 08560d13..ef912c9d 100644 --- a/pkg/cmd/validator/validator.go +++ b/pkg/cmd/validator/validator.go @@ -549,11 +549,6 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { Spec: *vc.MaasPlugin.Validator, } vr := vres.Build(v) - // TODO: set TypeMeta in vres.Build - vr.TypeMeta = metav1.TypeMeta{ - APIVersion: "validation.spectrocloud.labs/v1alpha1", - Kind: "MaasValidator", - } vrr := maasval.Validate(*vc.MaasPlugin.Validator, vc.MaasPlugin.Validator.Host, vc.MaasPlugin.MaasAPIToken, l) if err := vres.Finalize(vr, vrr, l); err != nil { return err @@ -1024,46 +1019,46 @@ func applyPlugins(c *cfg.Config, vc *components.ValidatorConfig) error { } } - if vc.VspherePlugin.Enabled { - log.InfoCLI("\n==== Applying vSphere plugin validator(s) ====") + if vc.AzurePlugin.Enabled { + log.InfoCLI("\n==== Applying Azure plugin validator(s) ====") if err := createValidator( - vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginVsphere, cfg.ValidatorPluginVsphereTemplate, *vc.VspherePlugin.Validator, + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginAzure, cfg.ValidatorPluginAzureTemplate, *vc.AzurePlugin.Validator, ); err != nil { return err } } - if vc.NetworkPlugin.Enabled { - log.InfoCLI("\n==== Applying Network plugin validator(s) ====") + if vc.MaasPlugin.Enabled { + log.InfoCLI("\n==== Applying MAAS plugin validator(s) ====") if err := createValidator( - vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginNetwork, cfg.ValidatorPluginNetworkTemplate, *vc.NetworkPlugin.Validator, + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginMaas, cfg.ValidatorPluginMaasTemplate, *vc.MaasPlugin.Validator, ); err != nil { return err } } - if vc.OCIPlugin.Enabled { - log.InfoCLI("\n==== Applying OCI plugin validator(s) ====") + if vc.NetworkPlugin.Enabled { + log.InfoCLI("\n==== Applying Network plugin validator(s) ====") if err := createValidator( - vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginOci, cfg.ValidatorPluginOciTemplate, *vc.OCIPlugin.Validator, + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginNetwork, cfg.ValidatorPluginNetworkTemplate, *vc.NetworkPlugin.Validator, ); err != nil { return err } } - if vc.AzurePlugin.Enabled { - log.InfoCLI("\n==== Applying Azure plugin validator(s) ====") + if vc.OCIPlugin.Enabled { + log.InfoCLI("\n==== Applying OCI plugin validator(s) ====") if err := createValidator( - vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginAzure, cfg.ValidatorPluginAzureTemplate, *vc.AzurePlugin.Validator, + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginOci, cfg.ValidatorPluginOciTemplate, *vc.OCIPlugin.Validator, ); err != nil { return err } } - if vc.MaasPlugin.Enabled { - log.InfoCLI("\n==== Applying MAAS plugin validator(s) ====") + if vc.VspherePlugin.Enabled { + log.InfoCLI("\n==== Applying vSphere plugin validator(s) ====") if err := createValidator( - vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginMaas, cfg.ValidatorPluginMaasTemplate, *vc.MaasPlugin.Validator, + vc.Kubeconfig, c.RunLoc, cfg.ValidatorPluginVsphere, cfg.ValidatorPluginVsphereTemplate, *vc.VspherePlugin.Validator, ); err != nil { return err } diff --git a/pkg/components/validator.go b/pkg/components/validator.go index 176c2d28..3980c2c4 100644 --- a/pkg/components/validator.go +++ b/pkg/components/validator.go @@ -37,10 +37,10 @@ type ValidatorConfig struct { AWSPlugin *AWSPluginConfig `yaml:"awsPlugin,omitempty"` AzurePlugin *AzurePluginConfig `yaml:"azurePlugin,omitempty"` + MaasPlugin *MaasPluginConfig `yaml:"maasPlugin,omitempty"` NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"` OCIPlugin *OCIPluginConfig `yaml:"ociPlugin,omitempty"` VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"` - MaasPlugin *MaasPluginConfig `yaml:"maasPlugin,omitempty"` } // NewValidatorConfig creates a new ValidatorConfig object. @@ -117,23 +117,19 @@ func (c *ValidatorConfig) EnabledPluginsHaveRules() (bool, []string) { invalidPlugins = append(invalidPlugins, c.AWSPlugin.Validator.PluginCode()) } if c.AzurePlugin.Enabled && c.AzurePlugin.Validator.ResultCount() == 0 { - invalidPlugins = append(invalidPlugins, "Azure") - // invalidPlugins = append(invalidPlugins, c.AzurePlugin.Validator.PluginCode()) + invalidPlugins = append(invalidPlugins, c.AzurePlugin.Validator.PluginCode()) } if c.MaasPlugin.Enabled && c.MaasPlugin.Validator.ResultCount() == 0 { - // invalidPlugins = append(invalidPlugins, c.MaasPlugin.Validator.PluginCode()) - invalidPlugins = append(invalidPlugins, "MAAS") + invalidPlugins = append(invalidPlugins, c.MaasPlugin.Validator.PluginCode()) } if c.NetworkPlugin.Enabled && c.NetworkPlugin.Validator.ResultCount() == 0 { invalidPlugins = append(invalidPlugins, c.NetworkPlugin.Validator.PluginCode()) } if c.OCIPlugin.Enabled && c.OCIPlugin.Validator.ResultCount() == 0 { - invalidPlugins = append(invalidPlugins, "OCI") - // invalidPlugins = append(invalidPlugins, c.OCIPlugin.Validator.PluginCode()) + invalidPlugins = append(invalidPlugins, c.OCIPlugin.Validator.PluginCode()) } if c.VspherePlugin.Enabled && c.VspherePlugin.Validator.ResultCount() == 0 { - invalidPlugins = append(invalidPlugins, "vSphere") - // invalidPlugins = append(invalidPlugins, c.VspherePlugin.Validator.PluginCode()) + invalidPlugins = append(invalidPlugins, c.VspherePlugin.Validator.PluginCode()) } if len(invalidPlugins) == 0 { ok = true @@ -414,6 +410,34 @@ type AzureStaticDeploymentValues struct { ComputeGallery string `yaml:"computeGalleryUuid"` } +// MaasPluginConfig represents the MAAS plugin configuration. +type MaasPluginConfig struct { + Enabled bool `yaml:"enabled"` + Release *validator.HelmRelease `yaml:"helmRelease"` + Validator *maas.MaasValidatorSpec `yaml:"validator"` + MaasAPIToken string `yaml:"maasApiToken"` +} + +func (c *MaasPluginConfig) encrypt() error { + token, err := crypto.EncryptB64([]byte(c.MaasAPIToken)) + if err != nil { + return errors.Wrap(err, "failed to encrypt token") + } + c.MaasAPIToken = token + + return nil +} + +func (c *MaasPluginConfig) decrypt() error { + bytes, err := crypto.DecryptB64(c.MaasAPIToken) + if err != nil { + return errors.Wrap(err, "failed to decrypt token") + } + c.MaasAPIToken = string(*bytes) + + return nil +} + // NetworkPluginConfig represents the network plugin configuration. type NetworkPluginConfig struct { Enabled bool `yaml:"enabled"` @@ -582,34 +606,6 @@ type VsphereTagRule struct { vsphereapi.TagValidationRule `yaml:",inline"` } -// MaasPluginConfig represents the MAAS plugin configuration. -type MaasPluginConfig struct { - Enabled bool `yaml:"enabled"` - Release *validator.HelmRelease `yaml:"helmRelease"` - Validator *maas.MaasValidatorSpec `yaml:"validator"` - MaasAPIToken string `yaml:"maasApiToken"` -} - -func (c *MaasPluginConfig) encrypt() error { - token, err := crypto.EncryptB64([]byte(c.MaasAPIToken)) - if err != nil { - return errors.Wrap(err, "failed to encrypt token") - } - c.MaasAPIToken = token - - return nil -} - -func (c *MaasPluginConfig) decrypt() error { - bytes, err := crypto.DecryptB64(c.MaasAPIToken) - if err != nil { - return errors.Wrap(err, "failed to decrypt token") - } - c.MaasAPIToken = string(*bytes) - - return nil -} - // PublicKeySecret represents a public key secret. type PublicKeySecret struct { Name string `yaml:"name"` diff --git a/pkg/utils/embed/resources/validator/validator-base-values.tmpl b/pkg/utils/embed/resources/validator/validator-base-values.tmpl index 3e940b68..63c14b43 100644 --- a/pkg/utils/embed/resources/validator/validator-base-values.tmpl +++ b/pkg/utils/embed/resources/validator/validator-base-values.tmpl @@ -136,6 +136,15 @@ pluginSecrets: {{- end }} {{- end }} + {{- if .MAASPlugin.Enabled }} + maas: + secretName: {{ .MAASPlugin.Validator.Auth.SecretName }} + tokenKey: {{ .MAASPlugin.Validator.Auth.TokenKey }} + maasApiToken: {{ .MAASPlugin.MaasAPIToken }} + {{- else }} + maas: {} + {{- end }} + {{- if .NetworkPlugin.Enabled }} network: {{- if gt (len .NetworkPlugin.HTTPFileAuths) 0 }} @@ -194,13 +203,3 @@ pluginSecrets: {{- else }} vSphere: {} {{- end }} - - {{- if .MAASPlugin.Enabled }} - maas: - secretName: {{ .MAASPlugin.Validator.Auth.SecretName }} - tokenKey: {{ .MAASPlugin.Validator.Auth.TokenKey }} - maasApiToken: {{ .MAASPlugin.MaasAPIToken }} - {{- else }} - maas: {} - {{- end }} - \ No newline at end of file From a1e78b97be30e642435935d1228ef6d137389383 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 21:34:27 -0700 Subject: [PATCH 12/17] feat: improve UX for configuring maas rules add client validation at the start make DNS records a selection make pools a selection --- pkg/config/constants.go | 1 + pkg/services/clouds/maas_service.go | 88 +++++++++++++++++++ pkg/services/validator/maas.go | 75 ++++------------ .../_validator/testcases/test_validator.go | 87 ++++++++++-------- 4 files changed, 158 insertions(+), 93 deletions(-) create mode 100644 pkg/services/clouds/maas_service.go diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 44efaac4..20562816 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -79,6 +79,7 @@ var ( RegistryMirrors = []string{"docker.io", "gcr.io", "ghcr.io", "k8s.gcr.io", "registry.k8s.io", "quay.io", "*"} RegistryMirrorSeparator = "::" FileInputs = []string{LocalFilepath, FileEditor} + DNSRecordTypes = []string{"A", "AAAA", "CNAME", "TXT", "MX", "NS", "SRV", "SSHFP"} // Command dirs ValidatorSubdirs = []string{"logs", "manifests"} diff --git a/pkg/services/clouds/maas_service.go b/pkg/services/clouds/maas_service.go new file mode 100644 index 00000000..1a9519a7 --- /dev/null +++ b/pkg/services/clouds/maas_service.go @@ -0,0 +1,88 @@ +package clouds + +import ( + "fmt" + "os" + + maasclient "github.com/canonical/gomaasclient/client" + "github.com/spectrocloud-labs/prompts-tui/prompts" + "github.com/validator-labs/validatorctl/pkg/components" +) + +var ( + // ReadMaasClientProps is defined to enable monkeypatching during testing + ReadMaasClientProps = readMaasClientProps + host = "https://maas.io/MAAS" +) + +func readMaasClientProps(c *components.MaasPluginConfig) error { + var err error + c.MaasAPIToken, err = prompts.ReadPassword("MAAS API token", c.MaasAPIToken, false, -1) + if err != nil { + return fmt.Errorf("failed to prompt for password for MAAS API token: %w", err) + } + + if c.Validator.Host != "" { + host = c.Validator.Host + } + c.Validator.Host, err = prompts.ReadText("MAAS Domain", host, false, -1) + if err != nil { + return err + } + + if err := validateMaasClient(c.Validator.Host, c.MaasAPIToken); err != nil { + val, err := handleMaasClientError(err) + if err != nil { + return err + } + if val == "Continue" { + return readMaasClientProps(c) + } + os.Exit(0) + } + + return nil +} + +func validateMaasClient(maasURL, maasToken string) error { + client, err := maasclient.GetClient(maasURL, maasToken, "2.0") + if err != nil { + return err + } + // gomaasclient doesnt provide a direct way to validate, so we manually check that requests return success + _, err = client.Account.ListAuthorisationTokens() + if err != nil { + return err + } + if client == nil { + return err + } + return nil +} + +func handleMaasClientError(err error) (string, error) { + errMsg := fmt.Sprintf("MAAS credentials validation failed with error: %v. Please update your credentials.", err) + val, err := prompts.Select(errMsg, []string{"Continue", "Exit"}) + if err != nil { + return "", err + } + return val, nil +} + +// GetMaasResourcePools fetches a list of resource pools in the cluster +func GetMaasResourcePools(c *components.MaasPluginConfig) ([]string, error) { + client, err := maasclient.GetClient(c.Validator.Host, c.MaasAPIToken, "2.0") + if err != nil { + return []string{}, err + } + poolsObj, err := client.ResourcePools.Get() + if err != nil { + return []string{}, err + } + + pools := make([]string, len(poolsObj)) + for i, p := range poolsObj { + pools[i] = p.Name + } + return pools, nil +} diff --git a/pkg/services/validator/maas.go b/pkg/services/validator/maas.go index 041168ef..c8d5d879 100644 --- a/pkg/services/validator/maas.go +++ b/pkg/services/validator/maas.go @@ -3,7 +3,6 @@ package validator import ( "fmt" "reflect" - "strconv" "time" "k8s.io/client-go/kubernetes" @@ -13,12 +12,12 @@ import ( cfg "github.com/validator-labs/validatorctl/pkg/config" log "github.com/validator-labs/validatorctl/pkg/logging" "github.com/validator-labs/validatorctl/pkg/services" + "github.com/validator-labs/validatorctl/pkg/services/clouds" vpmaasapi "github.com/validator-labs/validator-plugin-maas/api/v1alpha1" ) var ( - host = "https://maas.io/MAAS" maasSecretName = "maas-creds" maasTokenKey = "MAAS_API_KEY" ) @@ -63,17 +62,7 @@ func readMaasPlugin(vc *components.ValidatorConfig, tc *cfg.TaskConfig, k8sClien // nolint:dupl func readMaasPluginRules(vc *components.ValidatorConfig, _ *cfg.TaskConfig, _ kubernetes.Interface) error { log.Header("MAAS Plugin Rule Configuration") - var err error c := vc.MaasPlugin - - if c.Validator.Host != "" { - host = c.Validator.Host - } - c.Validator.Host, err = prompts.ReadText("MAAS Domain", host, false, -1) - if err != nil { - return err - } - ruleNames := make([]string, 0) if err := configureMaasResourceRules(c, &ruleNames); err != nil { @@ -122,7 +111,7 @@ func readMaasCredentials(c *components.MaasPluginConfig, tc *cfg.TaskConfig, k8s } if !tc.Direct { - c.Validator.Auth.SecretName, err = prompts.ReadText("MAAS credentials secret name", maasSecretName, false, -1) + c.Validator.Auth.SecretName, err = prompts.ReadK8sName("MAAS credentials secret name", maasSecretName, false) if err != nil { return fmt.Errorf("failed to prompt for text for MAAS credentials secret name: %w", err) } @@ -132,9 +121,8 @@ func readMaasCredentials(c *components.MaasPluginConfig, tc *cfg.TaskConfig, k8s } } - c.MaasAPIToken, err = prompts.ReadPassword("MAAS API token", c.MaasAPIToken, false, -1) - if err != nil { - return fmt.Errorf("failed to prompt for password for MAAS API token: %w", err) + if err := clouds.ReadMaasClientProps(c); err != nil { + return err } } else { @@ -157,7 +145,7 @@ func readMaasCredentials(c *components.MaasPluginConfig, tc *cfg.TaskConfig, k8s func configureMaasResourceRules(c *components.MaasPluginConfig, ruleNames *[]string) error { log.InfoCLI(` Resource Availability validation checks that the required number of machines - matching a certain criteria are "Ready" for use in an availability zone. + matching certain criteria are "Ready" for use in an availability zone. Each availability zone should have no more than 1 rule configured. `) @@ -220,14 +208,6 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA return err } - if r.Name == "" { - name, err := prompts.ReadText("Rule Name", "", false, -1) - if err != nil { - return err - } - r.Name = name - } - if r.AZ == "" { az, err := prompts.ReadText("Availability Zone", "az1", false, -1) if err != nil { @@ -239,7 +219,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA addResources := true for addResources { - resource, err := readMaasResource() + resource, err := readMaasResource(c) if err != nil { return err } @@ -259,7 +239,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA } // nolint:dupl -func readMaasResource() (vpmaasapi.Resource, error) { +func readMaasResource(c *components.MaasPluginConfig) (vpmaasapi.Resource, error) { res := vpmaasapi.Resource{} numMachines, err := prompts.ReadInt("Minimum number of machines", "1", 1, -1) @@ -286,7 +266,11 @@ func readMaasResource() (vpmaasapi.Resource, error) { } res.Disk = disk - pool, err := prompts.ReadText("Machine pool", "", true, -1) + resourcePools, err := clouds.GetMaasResourcePools(c) + if err != nil { + return res, err + } + pool, err := prompts.Select("Machine pool", resourcePools) if err != nil { return res, err } @@ -368,14 +352,6 @@ func readMaasImageRule(c *components.MaasPluginConfig, r *vpmaasapi.ImageRule, i return err } - if r.Name == "" { - name, err := prompts.ReadText("Rule Name", "", false, -1) - if err != nil { - return err - } - r.Name = name - } - addImages := true for addImages { @@ -402,13 +378,13 @@ func readMaasImageRule(c *components.MaasPluginConfig, r *vpmaasapi.ImageRule, i func readMaasImage() (vpmaasapi.Image, error) { img := vpmaasapi.Image{} - name, err := prompts.ReadText("Image name", "ubuntu/jammy", false, -1) + name, err := prompts.ReadText("Image name (standard or custom)", "ubuntu/jammy", false, -1) if err != nil { return img, err } img.Name = name - arch, err := prompts.ReadText("Architecture", "amd64/ga-22.04", false, -1) + arch, err := prompts.ReadText("Architecture formatted as / (e.g amd64/ga-22.04, arm64/hwe-20.04-edge)", "amd64/ga-22.04", false, -1) if err != nil { return img, err } @@ -548,28 +524,19 @@ func readMaasDNSRecord() (vpmaasapi.DNSRecord, error) { } rec.IP = ip - recType, err := prompts.ReadText("Record type", "A", false, -1) + recType, err := prompts.Select("Record type", cfg.DNSRecordTypes) if err != nil { return rec, err } rec.Type = recType - ttl, err := prompts.ReadText("TTL", "", true, -1) + ttl, err := prompts.ReadInt("TTL in seconds (optional, enter -1 to skip)", "-1", -1, -1) if err != nil { return rec, err } - if ttl != "" { - ttlInt, err := strconv.Atoi(ttl) - if err != nil { - return rec, err - } - if ttlInt >= 0 { - rec.TTL = ttlInt - } - } + rec.TTL = ttl return rec, nil - } // nolint:dupl @@ -635,14 +602,6 @@ func readMaasUpstreamDNSRule(c *components.MaasPluginConfig, r *vpmaasapi.Upstre return err } - if r.Name == "" { - name, err := prompts.ReadText("Rule Name", "", false, -1) - if err != nil { - return err - } - r.Name = name - } - if r.NumDNSServers <= 0 { num, err := prompts.ReadInt("Expected number of DNS servers", "1", 1, -1) if err != nil { diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index a0872f06..459b958f 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -12,6 +12,7 @@ import ( tuimocks "github.com/spectrocloud-labs/prompts-tui/prompts/mocks" "github.com/validator-labs/validator-plugin-vsphere/pkg/vsphere" + "github.com/validator-labs/validatorctl/pkg/components" cfg "github.com/validator-labs/validatorctl/pkg/config" "github.com/validator-labs/validatorctl/pkg/services/clouds" "github.com/validator-labs/validatorctl/pkg/utils/kind" @@ -492,10 +493,11 @@ func (t *ValidatorTest) vspherePluginValues(ctx *test.TestContext, vals []string func (t *ValidatorTest) maasPluginInstallValues(ctx *test.TestContext, vals []string) []string { maasVals := []string{ - "y", // install MAAS plugin - "maas-creds", // MAAS credentials secret name - "MAAS_API_KEY", // MAAS API token key - "fake:maasapi:token", // MAAS API token + "y", // install MAAS plugin + "maas-creds", // MAAS credentials secret name + "MAAS_API_KEY", // MAAS API token key + "fake:maasapi:token", // MAAS API token + "http://maas.io/MAAS", // MAAS Domain } if string_utils.IsDevVersion(ctx.Get("version")) { @@ -511,37 +513,36 @@ func (t *ValidatorTest) maasPluginInstallValues(ctx *test.TestContext, vals []st func (t *ValidatorTest) maasPluginValues(ctx *test.TestContext, vals []string, sliceVals [][]string) ([]string, [][]string) { maasVals := []any{ - "http://maas.io/MAAS", // MAAS Domain - "y", // Enable Resource Availibility validation - "res-rule-1", // Rule name - "az1", // Availability Zone - "1", // Minimum number of machines - "4", // Minimum CPU cores per machine - "16", // Minimum RAM in GB - "256", // Minimum Disk capacity in GB - "pool1", // Machine pool - []string{"tag1"}, // Tags - "n", // Add another resource - "n", // Add another resource rule - "y", // Enable os image validation - "os-rule-1", // Rule name - "ubuntu/jammy", // image name - "amd64/ga-22.04", // image architecture - "n", // Add another image - "n", // Add another image rule - "y", // Enable internal DNS validation - "maas.io", // MAAS Domain - "subdomain.maas.io", // FQDN - "10.10.10.10", // IP - "A", // Record type - "10", // ttl - "n", // add another record - "n", // add another resource - "n", // add another internal DNS rule - "y", // Enable upstream DNS validation - "udns-rule-1", // Rule name - "1", // Expected number of servers - "n", // Add another upstream dns rule + "y", // Enable Resource Availibility validation + "res-rule-1", // Rule name + "az1", // Availability Zone + "1", // Minimum number of machines + "4", // Minimum CPU cores per machine + "16", // Minimum RAM in GB + "256", // Minimum Disk capacity in GB + "pool1", // Machine pool + []string{"tag1"}, // Tags + "n", // Add another resource + "n", // Add another resource rule + "y", // Enable os image validation + "os-rule-1", // Rule name + "ubuntu/jammy", // image name + "amd64/ga-22.04", // image architecture + "n", // Add another image + "n", // Add another image rule + "y", // Enable internal DNS validation + "maas.io", // MAAS Domain + "subdomain.maas.io", // FQDN + "10.10.10.10", // IP + "A", // Record type + "10", // ttl + "n", // add another record + "n", // add another resource + "n", // add another internal DNS rule + "y", // Enable upstream DNS validation + "udns-rule-1", // Rule name + "1", // Expected number of servers + "n", // Add another upstream dns rule } return interleave(vals, sliceVals, maasVals) } @@ -695,6 +696,7 @@ func (t *ValidatorTest) PreRequisite(ctx *test.TestContext) (tr *test.TestResult } t.initVsphereDriver(ctx) + t.overrideMaasClientProps() return test.Success() } @@ -730,3 +732,18 @@ func (t *ValidatorTest) updateTestData(tokens map[string]string) error { func (t *ValidatorTest) filePath(file string) string { return fmt.Sprintf("%s/%s/%s", file_utils.ValidatorTestCasesPath(), "data", file) } + +func (t *ValidatorTest) overrideMaasClientProps() { + clouds.ReadMaasClientProps = func(c *components.MaasPluginConfig) error { + var err error + c.MaasAPIToken, err = prompts.ReadText("Token", "", false, -1) + if err != nil { + return err + } + c.Validator.Host, err = prompts.ReadText("Domain", "", false, -1) + if err != nil { + return err + } + return nil + } +} From de20e115a351442fc5205af00e4d44295eb8f081 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 21:35:48 -0700 Subject: [PATCH 13/17] chore: make reviewable --- go.mod | 2 +- pkg/config/versions.go | 8 ++++---- .../integration/_validator/testcases/data/validator.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 285035f0..c5b0d9cf 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.22.5 require ( emperror.dev/errors v0.8.1 github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1 + github.com/canonical/gomaasclient v0.6.0 github.com/fsnotify/fsnotify v1.7.0 github.com/go-logr/logr v1.4.2 github.com/google/uuid v1.6.0 @@ -99,7 +100,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver v3.5.1+incompatible // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/canonical/gomaasclient v0.6.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect diff --git a/pkg/config/versions.go b/pkg/config/versions.go index e7de6945..f2fc406c 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -2,11 +2,11 @@ package config // ValidatorChartVersions is a map of validator component names to their respective versions var ValidatorChartVersions = map[string]string{ - Validator: "v0.1.3", - ValidatorPluginAws: "v0.1.3", - ValidatorPluginAzure: "v0.0.15", + Validator: "v0.1.4", + ValidatorPluginAws: "v0.1.4", + ValidatorPluginAzure: "v0.0.16", ValidatorPluginMaas: "v0.0.7", - ValidatorPluginNetwork: "v0.0.22", + ValidatorPluginNetwork: "v0.0.23", ValidatorPluginOci: "v0.2.0", ValidatorPluginVsphere: "v0.0.30", } diff --git a/tests/integration/_validator/testcases/data/validator.yaml b/tests/integration/_validator/testcases/data/validator.yaml index 1073e580..5bbc5d38 100644 --- a/tests/integration/_validator/testcases/data/validator.yaml +++ b/tests/integration/_validator/testcases/data/validator.yaml @@ -5,7 +5,7 @@ helmRelease: chart: name: validator repository: validator - version: v0.1.3 + version: v0.1.4 values: "" helmReleaseSecret: name: validator-helm-release-validator @@ -59,7 +59,7 @@ awsPlugin: chart: name: validator-plugin-aws repository: validator-plugin-aws - version: v0.1.3 + version: v0.1.4 values: "" accessKeyId: a0XCQd+Emx7/bwAaTyY13ipTRychb4MiQw== secretAccessKey: IrGIW8FPVuOxVDRWQUdTa22SDf1MQ2PBw0kdngVq+w== @@ -173,7 +173,7 @@ networkPlugin: chart: name: validator-plugin-network repository: validator-plugin-network - version: v0.0.22 + version: v0.0.23 values: "" validator: dnsRules: @@ -524,7 +524,7 @@ azurePlugin: chart: name: validator-plugin-azure repository: validator-plugin-azure - version: v0.0.15 + version: v0.0.16 insecureSkipVerify: true values: "" tenantId: d551b7b1-78ae-43df-9d61-4935c843a454 From 200bdeb4a651720b84b78ee3b6da24d566bab08b Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Mon, 12 Aug 2024 21:53:57 -0700 Subject: [PATCH 14/17] fix: make reviewable --- pkg/config/versions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/versions.go b/pkg/config/versions.go index f2fc406c..8c328157 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -5,7 +5,7 @@ var ValidatorChartVersions = map[string]string{ Validator: "v0.1.4", ValidatorPluginAws: "v0.1.4", ValidatorPluginAzure: "v0.0.16", - ValidatorPluginMaas: "v0.0.7", + ValidatorPluginMaas: "v0.0.7", ValidatorPluginNetwork: "v0.0.23", ValidatorPluginOci: "v0.2.0", ValidatorPluginVsphere: "v0.0.30", From e223a34149bd97f4a1ee6544d2dd9ca4cba7ad99 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Tue, 13 Aug 2024 10:55:39 -0700 Subject: [PATCH 15/17] feat: make AZ selectable fix: typo in plugin name test: decrease scope of maas client mock chore: change tab to spaces to satisfy lint style: remove extra blank line test: move mocks into maas service chore: add nosec directive feat: support configuring oci validationType on a rule (#161) This PR swaps out configuring the `SkipLayerValidation` flag (which no longer exists) for the `ValidationType` which can be set to none, fast, or full. For now, i've opted to only allow the tui to configure this field on the host level (ie for all artifacts on in a rule). We can also add extra prompts to override for a particular artifact, but i felt like it would just make the tui flow more cumbersome. feat: WIP - add maas plugin feat: WIP: add maas plugin chore: make reviewable --- go.mod | 19 +- go.sum | 210 +++++++++++++++--- hack/validator.tmpl | 1 + hack/versions.tmpl | 2 +- pkg/cmd/validator/validator.go | 2 +- pkg/components/validator.go | 33 +++ pkg/config/versions.go | 2 +- pkg/services/clouds/maas_service.go | 55 +++-- pkg/services/validator/maas.go | 23 +- pkg/services/validator/oci.go | 18 +- .../validator/validator-base-values.tmpl | 10 + .../_validator/testcases/data/validator.yaml | 1 + .../_validator/testcases/test_validator.go | 54 ++--- 13 files changed, 325 insertions(+), 105 deletions(-) diff --git a/go.mod b/go.mod index c5b0d9cf..58c76842 100644 --- a/go.mod +++ b/go.mod @@ -17,13 +17,13 @@ require ( github.com/spectrocloud-labs/prompts-tui v0.1.1 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 - github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c - github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df - github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 + github.com/validator-labs/validator v0.1.4 + github.com/validator-labs/validator-plugin-aws v0.1.4 + github.com/validator-labs/validator-plugin-azure v0.0.16 github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612 - github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 - github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 - github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38 + github.com/validator-labs/validator-plugin-network v0.0.23 + github.com/validator-labs/validator-plugin-oci v0.2.0 + github.com/validator-labs/validator-plugin-vsphere v0.0.30 github.com/vmware/govmomi v0.39.0 golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa gopkg.in/yaml.v2 v2.4.0 @@ -31,7 +31,7 @@ require ( k8s.io/apimachinery v0.30.3 k8s.io/client-go v0.30.3 k8s.io/helm v2.17.0+incompatible - sigs.k8s.io/controller-runtime v0.18.4 + sigs.k8s.io/controller-runtime v0.18.5 sigs.k8s.io/yaml v1.4.0 ) @@ -254,17 +254,18 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.30.1 // indirect + k8s.io/apiextensions-apiserver v0.30.3 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect - sigs.k8s.io/cluster-api v1.7.4 // indirect + sigs.k8s.io/cluster-api v1.8.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/release-utils v0.8.4 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) // replace github.com/spectrocloud-labs/prompts-tui => ../../spectrocloud-labs/prompts-tui +replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 // replace github.com/validator-labs/validator => ../validator diff --git a/go.sum b/go.sum index b68d0571..0589f564 100644 --- a/go.sum +++ b/go.sum @@ -77,12 +77,14 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= +github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= +github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1 h1:3zcU9Ds6BHD3KnwbspH16kMGzLomnI2SNsCkq0i5avI= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1/go.mod h1:1/KTKMeXQ5X7prRFDpUAiwctY8sfb9z3Zj5q/5i7fKk= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= @@ -163,6 +165,8 @@ github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 h1:J4cbZQZFlLZNy5nGyDyPW0/VI4bivvR0EyZiR/H9Y7k= github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409/go.mod h1:rRYH2hfLDZ7Z6LNmNBbLzwnu1wK894fznN5pbVtur/s= +github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 h1:J4cbZQZFlLZNy5nGyDyPW0/VI4bivvR0EyZiR/H9Y7k= +github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409/go.mod h1:rRYH2hfLDZ7Z6LNmNBbLzwnu1wK894fznN5pbVtur/s= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= @@ -231,6 +235,8 @@ github.com/buildkite/roko v1.2.0/go.mod h1:23R9e6nHxgedznkwwfmqZ6+0VJZJZ2Sg/uVcp github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -258,10 +264,10 @@ github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= -github.com/coredns/caddy v1.1.0 h1:ezvsPrT/tA/7pYDBZxu0cT0VmWk75AfIaf6GSYCNMf0= -github.com/coredns/caddy v1.1.0/go.mod h1:A6ntJQlAWuQfFlsd9hvigKbo2WS0VUs2l1e2F+BawD4= -github.com/coredns/corefile-migration v1.0.21 h1:W/DCETrHDiFo0Wj03EyMkaQ9fwsmSgqTCQDHpceaSsE= -github.com/coredns/corefile-migration v1.0.21/go.mod h1:XnhgULOEouimnzgn0t4WPuFDN2/PJQcTxdWKC5eXNGE= +github.com/coredns/caddy v1.1.1 h1:2eYKZT7i6yxIfGP3qLJoJ7HAsDJqYB+X68g4NYjSrE0= +github.com/coredns/caddy v1.1.1/go.mod h1:A6ntJQlAWuQfFlsd9hvigKbo2WS0VUs2l1e2F+BawD4= +github.com/coredns/corefile-migration v1.0.23 h1:Fp4FETmk8sT/IRgnKX2xstC2dL7+QdcU+BL5AYIN3Jw= +github.com/coredns/corefile-migration v1.0.23/go.mod h1:8HyMhuyzx9RLZp8cRc9Uf3ECpEAafHOFxQWUPqktMQI= github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI= github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -279,6 +285,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/digitorus/pkcs7 v0.0.0-20230713084857-e76b763bdc49/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 h1:ge14PCmCvPjpMQMIAH7uKg0lrtNSOdpYsRXlwk3QbaE= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= @@ -286,8 +294,8 @@ github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 h1:lxmTCgmHE1G github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7/go.mod h1:GvWntX9qiTlOud0WkQ6ewFm0LPy5JUR1Xo0Ngbd1w6Y= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= -github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v27.1.1+incompatible h1:goaZxOqs4QKxznZjjBWKONQci/MywhtRv2oNn0GkeZE= github.com/docker/cli v27.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= @@ -309,8 +317,8 @@ github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -374,6 +382,7 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -387,6 +396,7 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -415,6 +425,7 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -454,9 +465,14 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -476,6 +492,7 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25L github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= @@ -502,6 +519,12 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jellydator/ttlcache/v3 v3.2.0 h1:6lqVJ8X3ZaUwvzENqPAobDsXNExfUJd61u++uW8a3LE= @@ -588,6 +611,76 @@ github.com/juju/version v0.0.0-20210303051006-2015802527a8/go.mod h1:YUOK6VK9+V4 github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23/go.mod h1:Ljlbryh9sYaUSGXucslAEDf0A2XUSGvDbHJgW8ps6nc= github.com/juju/version/v2 v2.0.0/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= github.com/julienschmidt/httprouter v1.1.1-0.20151013225520-77a895ad01eb/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/juju/ansiterm v0.0.0-20160907234532-b99631de12cf/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA= +github.com/juju/clock v0.0.0-20220202072423-1b0f830854c4/go.mod h1:zDZCPSgCJQINeZtQwHx2/cFk4seaBC8Yiqe8V82xiP0= +github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= +github.com/juju/clock v1.0.0/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= +github.com/juju/clock v1.0.2 h1:dJFdUGjtR/76l6U5WLVVI/B3i6+u3Nb9F9s1m+xxrxo= +github.com/juju/clock v1.0.2/go.mod h1:HIBvJ8kiV/n7UHwKuCkdYL4l/MDECztHR2sAvWDxxf0= +github.com/juju/cmd v0.0.0-20171107070456-e74f39857ca0/go.mod h1:yWJQHl73rdSX4DHVKGqkAip+huBslxRwS8m9CrOLq18= +github.com/juju/cmd/v3 v3.0.0-20220202061353-b1cc80b193b0/go.mod h1:EoGJiEG+vbMwO9l+Es0SDTlaQPjH6nLcnnc4NfZB3cY= +github.com/juju/collections v0.0.0-20200605021417-0d0ec82b7271/go.mod h1:5XgO71dV1JClcOJE+4dzdn4HrI5LiyKd7PlVG6eZYhY= +github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= +github.com/juju/collections v1.0.0/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= +github.com/juju/collections v1.0.4 h1:GjL+aN512m2rVDqhPII7P6qB0e+iYFubz8sqBhZaZtk= +github.com/juju/collections v1.0.4/go.mod h1:hVrdB0Zwq9wIU1Fl6ItD2+UETeNeOEs+nGvJufVe+0c= +github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/errors v0.0.0-20200330140219-3fe23663418f/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff/go.mod h1:i1eL7XREII6aHpQ2gApI/v6FkVUDEBremNkcBCKYAcY= +github.com/juju/errors v0.0.0-20220203013757-bd733f3c86b9/go.mod h1:TRm7EVGA3mQOqSVcBySRY7a9Y1/gyVhh/WTCnc5sD4U= +github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM= +github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/juju/gomaasapi/v2 v2.3.0 h1:97yPBrp/U+JwX/UVrBpkWsZKVREmIlykl8n/a58PYlE= +github.com/juju/gomaasapi/v2 v2.3.0/go.mod h1:ZsohFbU4xShV1aSQYQ21hR1lKj7naNGY0SPuyelcUmk= +github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767/go.mod h1:+MaLYz4PumRkkyHYeXJ2G5g5cIW0sli2bOfpmbaMV/g= +github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/loggo v0.0.0-20200526014432-9ce3a2e09b5e/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/loggo v1.0.0 h1:Y6ZMQOGR9Aj3BGkiWx7HBbIx6zNwNkxhVNOHU2i1bl0= +github.com/juju/loggo v1.0.0/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/mgo/v2 v2.0.0-20210302023703-70d5d206e208/go.mod h1:0OChplkvPTZ174D2FYZXg4IB9hbEwyHkD+zT+/eK+Fg= +github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090/go.mod h1:N614SE0a4e+ih2rg96Vi2PeC3cTpUOWgCTv3Cgk974c= +github.com/juju/mgo/v2 v2.0.2 h1:ufYtW2OFNjniTuxOngecP3Mk5sSclo8Zl1mnmyGWUWA= +github.com/juju/mgo/v2 v2.0.2/go.mod h1:Z2QbXIrR9JuJcSyankQOw31tINNA5p3qevW73oDoHsM= +github.com/juju/mutex v0.0.0-20171110020013-1fe2a4bf0a3a/go.mod h1:Y3oOzHH8CQ0Ppt0oCKJ2JFO81/EsWenH5AEqigLH+yY= +github.com/juju/mutex/v2 v2.0.0-20220128011612-57176ebdcfa3/go.mod h1:TTCG9BJD9rCC4DZFz3jA0QvCqFDHw8Eqz0jstwY7RTQ= +github.com/juju/mutex/v2 v2.0.0-20220203023141-11eeddb42c6c/go.mod h1:jwCfBs/smYDaeZLqeaCi8CB8M+tOes4yf827HoOEoqk= +github.com/juju/retry v0.0.0-20151029024821-62c620325291/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= +github.com/juju/retry v0.0.0-20180821225755-9058e192b216/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= +github.com/juju/retry v1.0.0/go.mod h1:SssN1eYeK3A2qjnFGTiVMbdzGJ2BfluaJblJXvuvgqA= +github.com/juju/schema v1.0.1 h1:GBEiwxZQeoQuXI6gOTG58W/ZpdongMwl9pfZq1KcNgM= +github.com/juju/schema v1.0.1/go.mod h1:Y+ThzXpUJ0E7NYYocAbuvJ7vTivXfrof/IfRPq/0abI= +github.com/juju/testing v0.0.0-20180402130637-44801989f0f7/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20180517134105-72703b1e95eb/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20210302031854-2c7ee8570c07/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= +github.com/juju/testing v0.0.0-20210324180055-18c50b0c2098/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= +github.com/juju/testing v0.0.0-20220202055744-1ad0816210a6/go.mod h1:QgWc2UdIPJ8t3rnvv95tFNOsQDfpXYEZDbP281o3b2c= +github.com/juju/testing v0.0.0-20220203020004-a0ff61f03494/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= +github.com/juju/testing v1.0.0/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= +github.com/juju/testing v1.0.2 h1:OR90RqCd9CJONxXamZAjLknpZdtqDyxqW8IwCbgw3i4= +github.com/juju/testing v1.0.2/go.mod h1:h3Vd2rzB57KrdsBEy6R7bmSKPzP76BnNavt7i8PerwQ= +github.com/juju/utils v0.0.0-20180424094159-2000ea4ff043/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= +github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647 h1:wQpkHVbIIpz1PCcLYku9KFWsJ7aEMQXHBBmLy3tRBTk= +github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= +github.com/juju/utils/v2 v2.0.0-20200923005554-4646bfea2ef1/go.mod h1:fdlDtQlzundleLLz/ggoYinEt/LmnrpNKcNTABQATNI= +github.com/juju/utils/v3 v3.0.0-20220130232349-cd7ecef0e94a/go.mod h1:LzwbbEN7buYjySp4nqnti6c6olSqRXUk6RkbSUUP1n8= +github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89/go.mod h1:wf5w+8jyTh2IYnSX0sHnMJo4ZPwwuiBWn+xN3DkQg4k= +github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= +github.com/juju/utils/v3 v3.0.0 h1:Gg3n63mGPbBuoXCo+EPJuMi44hGZfloI8nlCIebHu2Q= +github.com/juju/utils/v3 v3.0.0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= +github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20180108022336-b64dbd566305/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20191219164919-81c1be00b9a6/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= +github.com/juju/version v0.0.0-20210303051006-2015802527a8 h1:BTo6HzRR0zPBcXbs1Sy08aQNfvdm3ey8O+mBTiO3g00= +github.com/juju/version v0.0.0-20210303051006-2015802527a8/go.mod h1:YUOK6VK9+V4hpmsBYx8ymvOzEXRzoIGjRDKpIezTi60= +github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23/go.mod h1:Ljlbryh9sYaUSGXucslAEDf0A2XUSGvDbHJgW8ps6nc= +github.com/juju/version/v2 v2.0.0/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= +github.com/julienschmidt/httprouter v1.1.1-0.20151013225520-77a895ad01eb/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= @@ -599,6 +692,7 @@ github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y7 github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -613,6 +707,8 @@ github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8 github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -625,12 +721,23 @@ github.com/masterzen/winrm v0.0.0-20211231115050-232efb40349e/go.mod h1:Iju3u6Nz github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/masterzen/azure-sdk-for-go v3.2.0-beta.0.20161014135628-ee4f0065d00c+incompatible/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= +github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= +github.com/masterzen/winrm v0.0.0-20161014151040-7a535cd943fc/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= +github.com/masterzen/winrm v0.0.0-20211231115050-232efb40349e/go.mod h1:Iju3u6NzoTAvjuhsGCZc+7fReNnr/Bd6DsWj3WTokIU= +github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= +github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -670,6 +777,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 h1:Up6+btDp321ZG5/zdSLo48H9Iaq0UQGthrhWC6pCxzE= github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481/go.mod h1:yKZQO8QE2bHlgozqWDiRVqTFlLQSj30K/6SAK8EeYFw= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -855,20 +963,20 @@ github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG81+twTK4= github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A= -github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c h1:9Dy8DW7qdSQflkwiNPcBPkf/wgAOT+ddmSDvOabjnVQ= -github.com/validator-labs/validator v0.1.3-0.20240809205255-c05a36eebd3c/go.mod h1:TU04WjenuJxvJI/uhRsBJRym3ysA+dvSwUs2qvnak1Q= -github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df h1:ryzjKVisPy4yRIBOBUyKO4k7/CAL8wDHHN+9T6+bPUE= -github.com/validator-labs/validator-plugin-aws v0.1.4-0.20240809205833-8085473f77df/go.mod h1:NAPw04DYgOQUKN7GmGy65gETac19lDAjCAPtE4nLe5Q= -github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10 h1:BFlJUBviwxKnrgYnemEqW643Ohj32XvDr6VNbQYzmOI= -github.com/validator-labs/validator-plugin-azure v0.0.16-0.20240809210033-fab1ab878d10/go.mod h1:Lg4K6Uc7BkNi3KIr0gEPYDcwfjmFNI0uYHm4tbVyswo= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612 h1:dM8Ot/EX0/tNvGfOtK8OMPwpYfXltxWJeN7yO49SzwY= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612/go.mod h1:sla9fLOH2YRzKYfzqCf4ljA7LtiPT+DxuI8R/X0GZh8= -github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4 h1:iHmrJU1FBgfBzMuQ1tcYZiy2nZ5Qwmvu6GZ787b5odo= -github.com/validator-labs/validator-plugin-network v0.0.23-0.20240809205936-18ffc3b792c4/go.mod h1:zA+EcB7wV2qj67SiFpzpTq1Bv08BIqJWU/+XrbeBRZM= -github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104 h1:5A/j5XFU720xFvmuqunGM4Rz1NB1KIWVodQqhleP4Jk= -github.com/validator-labs/validator-plugin-oci v0.1.1-0.20240809205756-c1942b7a7104/go.mod h1:lC/pR8XKRKLKlDYObm8v6eDaj7NkmBjAskheuQXE7V0= -github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38 h1:hYw3ZTbHBdhCJoFeXkhYipWHkVpdLufwWsSxuoWN1aE= -github.com/validator-labs/validator-plugin-vsphere v0.0.30-0.20240809210242-a318dfc2be38/go.mod h1:hBGQsKzO2TCG0QArBnZHNUpofxT02J9WYBV/rtDVcok= +github.com/validator-labs/validator v0.1.4 h1:NWmOwJMciLGvJ/zfOAiYRvXNtlB4MUj0PeQ0sr8Vits= +github.com/validator-labs/validator v0.1.4/go.mod h1:UwuzW7ebeg8HTei2fBDHtMgEvs2gYQsBLawjYsUcMjY= +github.com/validator-labs/validator-plugin-aws v0.1.4 h1:0SMEIddrCRJfHvsqkyMCmkDQ5zfLHnju0ZDlAMEnr1M= +github.com/validator-labs/validator-plugin-aws v0.1.4/go.mod h1:Nh/RM9SygPPV9aMmMoOHg7PnYlCRYEHeOfOQ0qk5hBs= +github.com/validator-labs/validator-plugin-azure v0.0.16 h1:ttQmsmF8sG2Q6WPaTxzJ/rOYom4gR3TnNVxlQkMW0Po= +github.com/validator-labs/validator-plugin-azure v0.0.16/go.mod h1:gcBBYgKfx6WH6fT8BL94kn7aPrBBchEUEjP4wlekCKs= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 h1:mw98qwizN2s2y9q/L4yLK8osmFc52bVHmLkDoymFKtY= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70/go.mod h1:JyQk0ehRB+zNnhyYRpzk5ZekZZReFOfeJ7L6z0kln64= +github.com/validator-labs/validator-plugin-network v0.0.23 h1:+1fooiXuve73NAOUTTjf2jPd9DDYHekzEKh7bLtrOFc= +github.com/validator-labs/validator-plugin-network v0.0.23/go.mod h1:9f7tzIR1toQD0XVMTIba/42V+06j4IoUhwELe+V0Jfs= +github.com/validator-labs/validator-plugin-oci v0.2.0 h1:gdSkuzbHxld8aD6KPuFJ6IqsrNmEBLPWgydqJHNqzZ0= +github.com/validator-labs/validator-plugin-oci v0.2.0/go.mod h1:lC/pR8XKRKLKlDYObm8v6eDaj7NkmBjAskheuQXE7V0= +github.com/validator-labs/validator-plugin-vsphere v0.0.30 h1:CgJUW8vEftslSAb/xmHZW5dtS51tEA/n6pmN+dwk9Ao= +github.com/validator-labs/validator-plugin-vsphere v0.0.30/go.mod h1:g2+O2WYlXYYX5FxHfa7Vu7GCJLtX9QgQ0A8+9IODpQY= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/vmware/govmomi v0.39.0 h1:soLZ08Q2zvjRSinNup8xVlw0KDDCJPPA1rIDmBhi7As= @@ -877,6 +985,8 @@ github.com/xanzy/go-gitlab v0.107.0 h1:P2CT9Uy9yN9lJo3FLxpMZ4xj6uWcpnigXsjvqJ6nd github.com/xanzy/go-gitlab v0.107.0/go.mod h1:wKNKh3GkYDMOsGmnfuX+ITCmDuSDWFO0G+C4AygL9RY= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= @@ -904,12 +1014,18 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIX go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= +go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= go.step.sm/crypto v0.51.1 h1:ktUg/2hetEMiBAqgz502ktZDGoDoGrcHFg3XpkmkvvA= go.step.sm/crypto v0.51.1/go.mod h1:PdrhttNU/tG9/YsVd4fdlysBN+UV503p0o2irFZQlAw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -921,15 +1037,19 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -953,6 +1073,7 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -961,17 +1082,21 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -1006,6 +1131,8 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1017,6 +1144,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1050,6 +1178,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= @@ -1114,13 +1243,17 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= +gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/httprequest.v1 v1.1.1/go.mod h1:/CkavNL+g3qLOrpFHVrEx4NKepeqR4XTZWNj4sGGjz0= +gopkg.in/httprequest.v1 v1.1.1/go.mod h1:/CkavNL+g3qLOrpFHVrEx4NKepeqR4XTZWNj4sGGjz0= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1129,10 +1262,15 @@ gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= gopkg.in/yaml.v2 v2.0.0-20170712054546-1be3d31502d6/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= +gopkg.in/yaml.v2 v2.0.0-20170712054546-1be3d31502d6/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1149,18 +1287,18 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= -k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= +k8s.io/apiextensions-apiserver v0.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= +k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/apiserver v0.30.1 h1:BEWEe8bzS12nMtDKXzCF5Q5ovp6LjjYkSp8qOPk8LZ8= -k8s.io/apiserver v0.30.1/go.mod h1:i87ZnQ+/PGAmSbD/iEKM68bm1D5reX8fO4Ito4B01mo= +k8s.io/apiserver v0.30.3 h1:QZJndA9k2MjFqpnyYv/PH+9PE0SHhx3hBho4X0vE65g= +k8s.io/apiserver v0.30.3/go.mod h1:6Oa88y1CZqnzetd2JdepO0UXzQX4ZnOekx2/PtEjrOg= k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= -k8s.io/cluster-bootstrap v0.29.3 h1:DIMDZSN8gbFMy9CS2mAS2Iqq/fIUG783WN/1lqi5TF8= -k8s.io/cluster-bootstrap v0.29.3/go.mod h1:aPAg1VtXx3uRrx5qU2jTzR7p1rf18zLXWS+pGhiqPto= -k8s.io/component-base v0.30.1 h1:bvAtlPh1UrdaZL20D9+sWxsJljMi0QZ3Lmw+kmZAaxQ= -k8s.io/component-base v0.30.1/go.mod h1:e/X9kDiOebwlI41AvBHuWdqFriSRrX50CdwA9TFaHLI= +k8s.io/cluster-bootstrap v0.30.3 h1:MgxyxMkpaC6mu0BKWJ8985XCOnKU+eH3Iy+biwtDXRk= +k8s.io/cluster-bootstrap v0.30.3/go.mod h1:h8BoLDfdD7XEEIXy7Bx9FcMzxHwz29jsYYi34bM5DKU= +k8s.io/component-base v0.30.3 h1:Ci0UqKWf4oiwy8hr1+E3dsnliKnkMLZMVbWzeorlk7s= +k8s.io/component-base v0.30.3/go.mod h1:C1SshT3rGPCuNtBs14RmVD2xW0EhRSeLvBh7AGk1quA= k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao= k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= @@ -1171,10 +1309,14 @@ k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCI k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= -sigs.k8s.io/cluster-api v1.7.4 h1:gT9WGbLXKE19pNR6s/cTLRqK2G0EbwxxQrUrw7/w5P4= -sigs.k8s.io/cluster-api v1.7.4/go.mod h1:V9ZhKLvQtsDODwjXOKgbitjyCmC71yMBwDcMyNNIov0= -sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= -sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= +launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 h1:Tc9rS7JJoZ9sl3OpL4842oIk6lH7gWBb0JOmJ0ute7M= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0/go.mod h1:1ewhL9l1gkPcU/IU/6rFYfikf+7Y5imWv7ARVbBOzNs= +sigs.k8s.io/cluster-api v1.8.0 h1:xdF9svGCbezxOn9Y6QmlVnNaZ0n9QkRJpNuKJkeorUw= +sigs.k8s.io/cluster-api v1.8.0/go.mod h1:iSUcU8rHBNRa6wZJvU6klHKI3EVQC0aMcgjeSofBwKw= +sigs.k8s.io/controller-runtime v0.18.5 h1:nTHio/W+Q4aBlQMgbnC5hZb4IjIidyrizMai9P6n4Rk= +sigs.k8s.io/controller-runtime v0.18.5/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/release-utils v0.8.4 h1:4QVr3UgbyY/d9p74LBhg0njSVQofUsAZqYOzVZBhdBw= diff --git a/hack/validator.tmpl b/hack/validator.tmpl index 4c70f1d9..8a624789 100644 --- a/hack/validator.tmpl +++ b/hack/validator.tmpl @@ -223,6 +223,7 @@ ociPlugin: ociRegistryRules: - name: public ecr registry host: public.ecr.aws + validationType: none artifacts: - ref: u5n5j0b4/oci-test-public vspherePlugin: diff --git a/hack/versions.tmpl b/hack/versions.tmpl index 987ca1c7..d79240b3 100644 --- a/hack/versions.tmpl +++ b/hack/versions.tmpl @@ -5,7 +5,7 @@ var ValidatorChartVersions = map[string]string{ Validator: "v${VALIDATOR_VERSION}", ValidatorPluginAws: "v${AWS_VERSION}", ValidatorPluginAzure: "v${AZURE_VERSION}", - ValidatorPluginMaas: "v${MAAS_VERSION}", + ValidatorPluginMaas: "v${MAAS_VERSION}", ValidatorPluginNetwork: "v${NETWORK_VERSION}", ValidatorPluginOci: "v${OCI_VERSION}", ValidatorPluginVsphere: "v${VSPHERE_VERSION}", diff --git a/pkg/cmd/validator/validator.go b/pkg/cmd/validator/validator.go index ef912c9d..c087bc1e 100644 --- a/pkg/cmd/validator/validator.go +++ b/pkg/cmd/validator/validator.go @@ -543,7 +543,7 @@ func executePlugins(c *cfg.Config, vc *components.ValidatorConfig) error { if vc.MaasPlugin.Enabled { v := &maasapi.MaasValidator{ ObjectMeta: metav1.ObjectMeta{ - Name: "azure-validator", + Name: "maas-validator", Namespace: "N/A", }, Spec: *vc.MaasPlugin.Validator, diff --git a/pkg/components/validator.go b/pkg/components/validator.go index 3980c2c4..3cb6f4e4 100644 --- a/pkg/components/validator.go +++ b/pkg/components/validator.go @@ -41,6 +41,7 @@ type ValidatorConfig struct { NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"` OCIPlugin *OCIPluginConfig `yaml:"ociPlugin,omitempty"` VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"` + MaasPlugin *MaasPluginConfig `yaml:"maasPlugin,omitempty"` } // NewValidatorConfig creates a new ValidatorConfig object. @@ -122,6 +123,10 @@ func (c *ValidatorConfig) EnabledPluginsHaveRules() (bool, []string) { if c.MaasPlugin.Enabled && c.MaasPlugin.Validator.ResultCount() == 0 { invalidPlugins = append(invalidPlugins, c.MaasPlugin.Validator.PluginCode()) } + if c.MaasPlugin.Enabled && c.MaasPlugin.Validator.ResultCount() == 0 { + // invalidPlugins = append(invalidPlugins, c.MaasPlugin.Validator.PluginCode()) + invalidPlugins = append(invalidPlugins, "MAAS") + } if c.NetworkPlugin.Enabled && c.NetworkPlugin.Validator.ResultCount() == 0 { invalidPlugins = append(invalidPlugins, c.NetworkPlugin.Validator.PluginCode()) } @@ -606,6 +611,34 @@ type VsphereTagRule struct { vsphereapi.TagValidationRule `yaml:",inline"` } +// MaasPluginConfig represents the MAAS plugin configuration. +type MaasPluginConfig struct { + Enabled bool `yaml:"enabled"` + Release *validator.HelmRelease `yaml:"helmRelease"` + Validator *maas.MaasValidatorSpec `yaml:"validator"` + MaasAPIToken string `yaml:"maasApiToken"` +} + +func (c *MaasPluginConfig) encrypt() error { + token, err := crypto.EncryptB64([]byte(c.MaasAPIToken)) + if err != nil { + return errors.Wrap(err, "failed to encrypt token") + } + c.MaasAPIToken = token + + return nil +} + +func (c *MaasPluginConfig) decrypt() error { + bytes, err := crypto.DecryptB64(c.MaasAPIToken) + if err != nil { + return errors.Wrap(err, "failed to decrypt token") + } + c.MaasAPIToken = string(*bytes) + + return nil +} + // PublicKeySecret represents a public key secret. type PublicKeySecret struct { Name string `yaml:"name"` diff --git a/pkg/config/versions.go b/pkg/config/versions.go index 8c328157..f2fc406c 100644 --- a/pkg/config/versions.go +++ b/pkg/config/versions.go @@ -5,7 +5,7 @@ var ValidatorChartVersions = map[string]string{ Validator: "v0.1.4", ValidatorPluginAws: "v0.1.4", ValidatorPluginAzure: "v0.0.16", - ValidatorPluginMaas: "v0.0.7", + ValidatorPluginMaas: "v0.0.7", ValidatorPluginNetwork: "v0.0.23", ValidatorPluginOci: "v0.2.0", ValidatorPluginVsphere: "v0.0.30", diff --git a/pkg/services/clouds/maas_service.go b/pkg/services/clouds/maas_service.go index 1a9519a7..332c8423 100644 --- a/pkg/services/clouds/maas_service.go +++ b/pkg/services/clouds/maas_service.go @@ -5,17 +5,19 @@ import ( "os" maasclient "github.com/canonical/gomaasclient/client" + "github.com/canonical/gomaasclient/entity" "github.com/spectrocloud-labs/prompts-tui/prompts" "github.com/validator-labs/validatorctl/pkg/components" ) var ( - // ReadMaasClientProps is defined to enable monkeypatching during testing - ReadMaasClientProps = readMaasClientProps - host = "https://maas.io/MAAS" + // GetMaasClient is defined to enable monkeypatching during testing + GetMaasClient = getMaasClient + host = "https://maas.io/MAAS" ) -func readMaasClientProps(c *components.MaasPluginConfig) error { +// ReadMaasClientProps gathers and validates MAAS client credentials +func ReadMaasClientProps(c *components.MaasPluginConfig) error { var err error c.MaasAPIToken, err = prompts.ReadPassword("MAAS API token", c.MaasAPIToken, false, -1) if err != nil { @@ -36,7 +38,7 @@ func readMaasClientProps(c *components.MaasPluginConfig) error { return err } if val == "Continue" { - return readMaasClientProps(c) + return ReadMaasClientProps(c) } os.Exit(0) } @@ -45,7 +47,7 @@ func readMaasClientProps(c *components.MaasPluginConfig) error { } func validateMaasClient(maasURL, maasToken string) error { - client, err := maasclient.GetClient(maasURL, maasToken, "2.0") + client, err := GetMaasClient(maasURL, maasToken) if err != nil { return err } @@ -69,20 +71,47 @@ func handleMaasClientError(err error) (string, error) { return val, nil } -// GetMaasResourcePools fetches a list of resource pools in the cluster -func GetMaasResourcePools(c *components.MaasPluginConfig) ([]string, error) { - client, err := maasclient.GetClient(c.Validator.Host, c.MaasAPIToken, "2.0") +// GetMaasResourceProps fetches a list of resource pools and availability zones in the cluster +func GetMaasResourceProps(c *components.MaasPluginConfig) ([]string, []string, error) { + client, err := GetMaasClient(c.Validator.Host, c.MaasAPIToken) if err != nil { - return []string{}, err + return []string{}, []string{}, err } + poolsObj, err := client.ResourcePools.Get() if err != nil { - return []string{}, err + return []string{}, []string{}, err } - pools := make([]string, len(poolsObj)) for i, p := range poolsObj { pools[i] = p.Name } - return pools, nil + + zonesObj, err := client.Zones.Get() + if err != nil { + return []string{}, []string{}, err + } + zones := make([]string, len(zonesObj)) + for i, z := range zonesObj { + zones[i] = z.Name + } + return pools, zones, nil +} + +func getMaasClient(maasURL, maasToken string) (*maasclient.Client, error) { + client, err := maasclient.GetClient(maasURL, maasToken, "2.0") + if err != nil { + return &maasclient.Client{}, err + } + return client, nil +} + +// MockMaasAccount replaces the maasclient.Account struct for integration testing +type MockMaasAccount struct { + maasclient.Account +} + +// ListAuthorisationTokens replaces the maasclient.Account.ListAuthorisationTokens method for integration testing +func (a *MockMaasAccount) ListAuthorisationTokens() ([]entity.AuthorisationTokenListItem, error) { + return []entity.AuthorisationTokenListItem{}, nil } diff --git a/pkg/services/validator/maas.go b/pkg/services/validator/maas.go index c8d5d879..5f11ed6c 100644 --- a/pkg/services/validator/maas.go +++ b/pkg/services/validator/maas.go @@ -3,6 +3,7 @@ package validator import ( "fmt" "reflect" + "slices" "time" "k8s.io/client-go/kubernetes" @@ -19,7 +20,7 @@ import ( var ( maasSecretName = "maas-creds" - maasTokenKey = "MAAS_API_KEY" + maasTokenKey = "MAAS_API_KEY" //#nosec ) type maasRule interface { @@ -208,8 +209,14 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA return err } + resourcePools, availabilityZones, err := clouds.GetMaasResourceProps(c) + if err != nil { + return err + } + resourcePools = slices.Insert(resourcePools, 0, "N/A") + if r.AZ == "" { - az, err := prompts.ReadText("Availability Zone", "az1", false, -1) + az, err := prompts.Select("Availability Zone", availabilityZones) if err != nil { return err } @@ -219,7 +226,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA addResources := true for addResources { - resource, err := readMaasResource(c) + resource, err := readMaasResource(&resourcePools) if err != nil { return err } @@ -239,7 +246,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA } // nolint:dupl -func readMaasResource(c *components.MaasPluginConfig) (vpmaasapi.Resource, error) { +func readMaasResource(resourcePools *[]string) (vpmaasapi.Resource, error) { res := vpmaasapi.Resource{} numMachines, err := prompts.ReadInt("Minimum number of machines", "1", 1, -1) @@ -266,15 +273,11 @@ func readMaasResource(c *components.MaasPluginConfig) (vpmaasapi.Resource, error } res.Disk = disk - resourcePools, err := clouds.GetMaasResourcePools(c) - if err != nil { - return res, err - } - pool, err := prompts.Select("Machine pool", resourcePools) + pool, err := prompts.Select("Resource pool (optional)", *resourcePools) if err != nil { return res, err } - if pool != "" { + if pool != "N/A" { res.Pool = pool } diff --git a/pkg/services/validator/oci.go b/pkg/services/validator/oci.go index 7f76e20c..3b9cbf49 100644 --- a/pkg/services/validator/oci.go +++ b/pkg/services/validator/oci.go @@ -290,6 +290,18 @@ func readOciRegistryRule(c *components.OCIPluginConfig, r *plug.OciRegistryRule, r.Auth = plug.Auth{SecretName: &authSecretName} } + log.InfoCLI(` + The following validation types are available: + - 'none': only the existence of the artifacts in the registry is validated + - 'fast': the artifacts are pulled and fast layer, manifest, and config validation is performed + - 'full': the artifacts are pulled and full layer, manifest, and config validation is performed + `) + vType, err := prompts.Select("Validation type", []string{string(plug.ValidationTypeNone), string(plug.ValidationTypeFast), string(plug.ValidationTypeFull)}) + if err != nil { + return err + } + r.ValidationType = plug.ValidationType(vType) + if err := readArtifactRefs(r); err != nil { return err } @@ -345,12 +357,6 @@ func readArtifactRefs(r *plug.OciRegistryRule) error { } } - log.InfoCLI("Full layer validation is enabled by default for all artifacts.") - r.SkipLayerValidation, err = prompts.ReadBool("Disable full layer validation for all artifacts", false) - if err != nil { - return err - } - return nil } diff --git a/pkg/utils/embed/resources/validator/validator-base-values.tmpl b/pkg/utils/embed/resources/validator/validator-base-values.tmpl index 63c14b43..bc5b8c1e 100644 --- a/pkg/utils/embed/resources/validator/validator-base-values.tmpl +++ b/pkg/utils/embed/resources/validator/validator-base-values.tmpl @@ -203,3 +203,13 @@ pluginSecrets: {{- else }} vSphere: {} {{- end }} + + {{- if .MAASPlugin.Validator.Auth.SecretName }} + maas: + secretName: {{ .MAASPlugin.Validator.Auth.SecretName }} + tokenKey: {{ .MAASPlugin.Validator.Auth.TokenKey }} + maasApiToken: {{ .MAASPlugin.MaasAPIToken }} + {{- else }} + maas: {} + {{- end }} + \ No newline at end of file diff --git a/tests/integration/_validator/testcases/data/validator.yaml b/tests/integration/_validator/testcases/data/validator.yaml index 5bbc5d38..cf6fc019 100644 --- a/tests/integration/_validator/testcases/data/validator.yaml +++ b/tests/integration/_validator/testcases/data/validator.yaml @@ -223,6 +223,7 @@ ociPlugin: ociRegistryRules: - name: public ecr registry host: public.ecr.aws + validationType: none artifacts: - ref: u5n5j0b4/oci-test-public vspherePlugin: diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index 459b958f..5902e895 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -11,8 +11,8 @@ import ( "github.com/spectrocloud-labs/prompts-tui/prompts" tuimocks "github.com/spectrocloud-labs/prompts-tui/prompts/mocks" + maasclient "github.com/canonical/gomaasclient/client" "github.com/validator-labs/validator-plugin-vsphere/pkg/vsphere" - "github.com/validator-labs/validatorctl/pkg/components" cfg "github.com/validator-labs/validatorctl/pkg/config" "github.com/validator-labs/validatorctl/pkg/services/clouds" "github.com/validator-labs/validatorctl/pkg/utils/kind" @@ -56,21 +56,21 @@ func (t *ValidatorTest) Execute(ctx *test.TestContext) (tr *test.TestResult) { if result := t.testInstallSilent(); result.IsFailed() { return result } - if result := t.testInstallSilentWait(); result.IsFailed() { - return result - } - if result := t.testCheckDirect(); result.IsFailed() { - return result - } - if result := t.testDescribe(); result.IsFailed() { - return result - } - if result := t.testUndeploy(); result.IsFailed() { - return result - } - if result := t.testInstallUpdatePasswords(); result.IsFailed() { - return result - } + // if result := t.testInstallSilentWait(); result.IsFailed() { + // return result + // } + // if result := t.testCheckDirect(); result.IsFailed() { + // return result + // } + // if result := t.testDescribe(); result.IsFailed() { + // return result + // } + // if result := t.testUndeploy(); result.IsFailed() { + // return result + // } + // if result := t.testInstallUpdatePasswords(); result.IsFailed() { + // return result + // } return test.Success() } @@ -404,8 +404,8 @@ func (t *ValidatorTest) ociPluginValues(ctx *test.TestContext, vals []string) [] "public ecr registry", // rule name "public.ecr.aws", // registry host "N/A", // registry auth secret name + "none", // validation type "public.ecr.aws/u5n5j0b4/oci-test-public", // artifact references - "y", // disable full layer validation "N/A", // signature verification secret name "", // ca certificate "n", // add another registry rule @@ -696,7 +696,7 @@ func (t *ValidatorTest) PreRequisite(ctx *test.TestContext) (tr *test.TestResult } t.initVsphereDriver(ctx) - t.overrideMaasClientProps() + t.overrideMaasClient() return test.Success() } @@ -733,17 +733,11 @@ func (t *ValidatorTest) filePath(file string) string { return fmt.Sprintf("%s/%s/%s", file_utils.ValidatorTestCasesPath(), "data", file) } -func (t *ValidatorTest) overrideMaasClientProps() { - clouds.ReadMaasClientProps = func(c *components.MaasPluginConfig) error { - var err error - c.MaasAPIToken, err = prompts.ReadText("Token", "", false, -1) - if err != nil { - return err - } - c.Validator.Host, err = prompts.ReadText("Domain", "", false, -1) - if err != nil { - return err - } - return nil +func (t *ValidatorTest) overrideMaasClient() { + clouds.GetMaasClient = func(maasURL, maasToken string) (*maasclient.Client, error) { + client := &maasclient.Client{} + client.Account = &clouds.MockMaasAccount{} + + return client, nil } } From 2c58959c43d300f2add66b0959cf914da9d88087 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Tue, 13 Aug 2024 13:20:40 -0700 Subject: [PATCH 16/17] chore: make reviewable --- go.mod | 3 - go.sum | 133 +----------------------------------- pkg/components/validator.go | 29 -------- 3 files changed, 2 insertions(+), 163 deletions(-) diff --git a/go.mod b/go.mod index 58c76842..fd5afcf6 100644 --- a/go.mod +++ b/go.mod @@ -264,9 +264,6 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) -// replace github.com/spectrocloud-labs/prompts-tui => ../../spectrocloud-labs/prompts-tui -replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 - // replace github.com/validator-labs/validator => ../validator replace github.com/canonical/gomaasclient v0.6.0 => github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 diff --git a/go.sum b/go.sum index 0589f564..5f8d2d1f 100644 --- a/go.sum +++ b/go.sum @@ -77,14 +77,12 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1 h1:3zcU9Ds6BHD3KnwbspH16kMGzLomnI2SNsCkq0i5avI= github.com/L30Bola/aws-policy v0.0.0-20230126045340-5e6118545ac1/go.mod h1:1/KTKMeXQ5X7prRFDpUAiwctY8sfb9z3Zj5q/5i7fKk= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= @@ -165,8 +163,6 @@ github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 h1:J4cbZQZFlLZNy5nGyDyPW0/VI4bivvR0EyZiR/H9Y7k= github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409/go.mod h1:rRYH2hfLDZ7Z6LNmNBbLzwnu1wK894fznN5pbVtur/s= -github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409 h1:J4cbZQZFlLZNy5nGyDyPW0/VI4bivvR0EyZiR/H9Y7k= -github.com/arturshadnik/gomaasclient v0.0.0-20240731231205-8239cfb13409/go.mod h1:rRYH2hfLDZ7Z6LNmNBbLzwnu1wK894fznN5pbVtur/s= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= @@ -285,8 +281,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= -github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= -github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/digitorus/pkcs7 v0.0.0-20230713084857-e76b763bdc49/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 h1:ge14PCmCvPjpMQMIAH7uKg0lrtNSOdpYsRXlwk3QbaE= github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352/go.mod h1:SKVExuS+vpu2l9IoOc0RwqE7NYnb0JlcFHFnEJkVDzc= @@ -382,7 +376,6 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -396,7 +389,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -425,7 +417,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -465,8 +456,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -492,7 +481,6 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25L github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= @@ -519,12 +507,6 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jellydator/ttlcache/v3 v3.2.0 h1:6lqVJ8X3ZaUwvzENqPAobDsXNExfUJd61u++uW8a3LE= @@ -611,76 +593,6 @@ github.com/juju/version v0.0.0-20210303051006-2015802527a8/go.mod h1:YUOK6VK9+V4 github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23/go.mod h1:Ljlbryh9sYaUSGXucslAEDf0A2XUSGvDbHJgW8ps6nc= github.com/juju/version/v2 v2.0.0/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= github.com/julienschmidt/httprouter v1.1.1-0.20151013225520-77a895ad01eb/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/juju/ansiterm v0.0.0-20160907234532-b99631de12cf/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/juju/clock v0.0.0-20190205081909-9c5c9712527c/go.mod h1:nD0vlnrUjcjJhqN5WuCWZyzfd5AHZAC9/ajvbSx69xA= -github.com/juju/clock v0.0.0-20220202072423-1b0f830854c4/go.mod h1:zDZCPSgCJQINeZtQwHx2/cFk4seaBC8Yiqe8V82xiP0= -github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= -github.com/juju/clock v1.0.0/go.mod h1:GZ/FY8Cqw3KHG6DwRVPUKbSPTAwyrU28xFi5cqZnLsc= -github.com/juju/clock v1.0.2 h1:dJFdUGjtR/76l6U5WLVVI/B3i6+u3Nb9F9s1m+xxrxo= -github.com/juju/clock v1.0.2/go.mod h1:HIBvJ8kiV/n7UHwKuCkdYL4l/MDECztHR2sAvWDxxf0= -github.com/juju/cmd v0.0.0-20171107070456-e74f39857ca0/go.mod h1:yWJQHl73rdSX4DHVKGqkAip+huBslxRwS8m9CrOLq18= -github.com/juju/cmd/v3 v3.0.0-20220202061353-b1cc80b193b0/go.mod h1:EoGJiEG+vbMwO9l+Es0SDTlaQPjH6nLcnnc4NfZB3cY= -github.com/juju/collections v0.0.0-20200605021417-0d0ec82b7271/go.mod h1:5XgO71dV1JClcOJE+4dzdn4HrI5LiyKd7PlVG6eZYhY= -github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= -github.com/juju/collections v1.0.0/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo= -github.com/juju/collections v1.0.4 h1:GjL+aN512m2rVDqhPII7P6qB0e+iYFubz8sqBhZaZtk= -github.com/juju/collections v1.0.4/go.mod h1:hVrdB0Zwq9wIU1Fl6ItD2+UETeNeOEs+nGvJufVe+0c= -github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/errors v0.0.0-20200330140219-3fe23663418f/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff/go.mod h1:i1eL7XREII6aHpQ2gApI/v6FkVUDEBremNkcBCKYAcY= -github.com/juju/errors v0.0.0-20220203013757-bd733f3c86b9/go.mod h1:TRm7EVGA3mQOqSVcBySRY7a9Y1/gyVhh/WTCnc5sD4U= -github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM= -github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8= -github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= -github.com/juju/gomaasapi/v2 v2.3.0 h1:97yPBrp/U+JwX/UVrBpkWsZKVREmIlykl8n/a58PYlE= -github.com/juju/gomaasapi/v2 v2.3.0/go.mod h1:ZsohFbU4xShV1aSQYQ21hR1lKj7naNGY0SPuyelcUmk= -github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767/go.mod h1:+MaLYz4PumRkkyHYeXJ2G5g5cIW0sli2bOfpmbaMV/g= -github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/loggo v0.0.0-20200526014432-9ce3a2e09b5e/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= -github.com/juju/loggo v1.0.0 h1:Y6ZMQOGR9Aj3BGkiWx7HBbIx6zNwNkxhVNOHU2i1bl0= -github.com/juju/loggo v1.0.0/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= -github.com/juju/mgo/v2 v2.0.0-20210302023703-70d5d206e208/go.mod h1:0OChplkvPTZ174D2FYZXg4IB9hbEwyHkD+zT+/eK+Fg= -github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090/go.mod h1:N614SE0a4e+ih2rg96Vi2PeC3cTpUOWgCTv3Cgk974c= -github.com/juju/mgo/v2 v2.0.2 h1:ufYtW2OFNjniTuxOngecP3Mk5sSclo8Zl1mnmyGWUWA= -github.com/juju/mgo/v2 v2.0.2/go.mod h1:Z2QbXIrR9JuJcSyankQOw31tINNA5p3qevW73oDoHsM= -github.com/juju/mutex v0.0.0-20171110020013-1fe2a4bf0a3a/go.mod h1:Y3oOzHH8CQ0Ppt0oCKJ2JFO81/EsWenH5AEqigLH+yY= -github.com/juju/mutex/v2 v2.0.0-20220128011612-57176ebdcfa3/go.mod h1:TTCG9BJD9rCC4DZFz3jA0QvCqFDHw8Eqz0jstwY7RTQ= -github.com/juju/mutex/v2 v2.0.0-20220203023141-11eeddb42c6c/go.mod h1:jwCfBs/smYDaeZLqeaCi8CB8M+tOes4yf827HoOEoqk= -github.com/juju/retry v0.0.0-20151029024821-62c620325291/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= -github.com/juju/retry v0.0.0-20180821225755-9058e192b216/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= -github.com/juju/retry v1.0.0/go.mod h1:SssN1eYeK3A2qjnFGTiVMbdzGJ2BfluaJblJXvuvgqA= -github.com/juju/schema v1.0.1 h1:GBEiwxZQeoQuXI6gOTG58W/ZpdongMwl9pfZq1KcNgM= -github.com/juju/schema v1.0.1/go.mod h1:Y+ThzXpUJ0E7NYYocAbuvJ7vTivXfrof/IfRPq/0abI= -github.com/juju/testing v0.0.0-20180402130637-44801989f0f7/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/juju/testing v0.0.0-20180517134105-72703b1e95eb/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/juju/testing v0.0.0-20210302031854-2c7ee8570c07/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= -github.com/juju/testing v0.0.0-20210324180055-18c50b0c2098/go.mod h1:7lxZW0B50+xdGFkvhAb8bwAGt6IU87JB1H9w4t8MNVM= -github.com/juju/testing v0.0.0-20220202055744-1ad0816210a6/go.mod h1:QgWc2UdIPJ8t3rnvv95tFNOsQDfpXYEZDbP281o3b2c= -github.com/juju/testing v0.0.0-20220203020004-a0ff61f03494/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= -github.com/juju/testing v1.0.0/go.mod h1:rUquetT0ALL48LHZhyRGvjjBH8xZaZ8dFClulKK5wK4= -github.com/juju/testing v1.0.2 h1:OR90RqCd9CJONxXamZAjLknpZdtqDyxqW8IwCbgw3i4= -github.com/juju/testing v1.0.2/go.mod h1:h3Vd2rzB57KrdsBEy6R7bmSKPzP76BnNavt7i8PerwQ= -github.com/juju/utils v0.0.0-20180424094159-2000ea4ff043/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= -github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647 h1:wQpkHVbIIpz1PCcLYku9KFWsJ7aEMQXHBBmLy3tRBTk= -github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= -github.com/juju/utils/v2 v2.0.0-20200923005554-4646bfea2ef1/go.mod h1:fdlDtQlzundleLLz/ggoYinEt/LmnrpNKcNTABQATNI= -github.com/juju/utils/v3 v3.0.0-20220130232349-cd7ecef0e94a/go.mod h1:LzwbbEN7buYjySp4nqnti6c6olSqRXUk6RkbSUUP1n8= -github.com/juju/utils/v3 v3.0.0-20220202114721-338bb0530e89/go.mod h1:wf5w+8jyTh2IYnSX0sHnMJo4ZPwwuiBWn+xN3DkQg4k= -github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= -github.com/juju/utils/v3 v3.0.0 h1:Gg3n63mGPbBuoXCo+EPJuMi44hGZfloI8nlCIebHu2Q= -github.com/juju/utils/v3 v3.0.0/go.mod h1:8csUcj1VRkfjNIRzBFWzLFCMLwLqsRWvkmhfVAUwbC4= -github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= -github.com/juju/version v0.0.0-20180108022336-b64dbd566305/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= -github.com/juju/version v0.0.0-20191219164919-81c1be00b9a6/go.mod h1:kE8gK5X0CImdr7qpSKl3xB2PmpySSmfj7zVbkZFs81U= -github.com/juju/version v0.0.0-20210303051006-2015802527a8 h1:BTo6HzRR0zPBcXbs1Sy08aQNfvdm3ey8O+mBTiO3g00= -github.com/juju/version v0.0.0-20210303051006-2015802527a8/go.mod h1:YUOK6VK9+V4hpmsBYx8ymvOzEXRzoIGjRDKpIezTi60= -github.com/juju/version/v2 v2.0.0-20211007103408-2e8da085dc23/go.mod h1:Ljlbryh9sYaUSGXucslAEDf0A2XUSGvDbHJgW8ps6nc= -github.com/juju/version/v2 v2.0.0/go.mod h1:ZeFjNy+UFEWJDDPdzW7Cm9NeU6dsViGaFYhXzycLQrw= -github.com/julienschmidt/httprouter v1.1.1-0.20151013225520-77a895ad01eb/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= @@ -692,7 +604,6 @@ github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y7 github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -707,8 +618,6 @@ github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8 github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -721,23 +630,12 @@ github.com/masterzen/winrm v0.0.0-20211231115050-232efb40349e/go.mod h1:Iju3u6Nz github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/masterzen/azure-sdk-for-go v3.2.0-beta.0.20161014135628-ee4f0065d00c+incompatible/go.mod h1:mf8fjOu33zCqxUjuiU3I8S1lJMyEAlH+0F2+M5xl3hE= -github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20161014151040-7a535cd943fc/go.mod h1:CfZSN7zwz5gJiFhZJz49Uzk7mEBHIceWmbFmYx7Hf7E= -github.com/masterzen/winrm v0.0.0-20211231115050-232efb40349e/go.mod h1:Iju3u6NzoTAvjuhsGCZc+7fReNnr/Bd6DsWj3WTokIU= -github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= -github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -777,7 +675,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 h1:Up6+btDp321ZG5/zdSLo48H9Iaq0UQGthrhWC6pCxzE= github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481/go.mod h1:yKZQO8QE2bHlgozqWDiRVqTFlLQSj30K/6SAK8EeYFw= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -969,8 +866,8 @@ github.com/validator-labs/validator-plugin-aws v0.1.4 h1:0SMEIddrCRJfHvsqkyMCmkD github.com/validator-labs/validator-plugin-aws v0.1.4/go.mod h1:Nh/RM9SygPPV9aMmMoOHg7PnYlCRYEHeOfOQ0qk5hBs= github.com/validator-labs/validator-plugin-azure v0.0.16 h1:ttQmsmF8sG2Q6WPaTxzJ/rOYom4gR3TnNVxlQkMW0Po= github.com/validator-labs/validator-plugin-azure v0.0.16/go.mod h1:gcBBYgKfx6WH6fT8BL94kn7aPrBBchEUEjP4wlekCKs= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70 h1:mw98qwizN2s2y9q/L4yLK8osmFc52bVHmLkDoymFKtY= -github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240807214621-951e09472a70/go.mod h1:JyQk0ehRB+zNnhyYRpzk5ZekZZReFOfeJ7L6z0kln64= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612 h1:dM8Ot/EX0/tNvGfOtK8OMPwpYfXltxWJeN7yO49SzwY= +github.com/validator-labs/validator-plugin-maas v0.0.8-0.20240809210245-5894f5118612/go.mod h1:sla9fLOH2YRzKYfzqCf4ljA7LtiPT+DxuI8R/X0GZh8= github.com/validator-labs/validator-plugin-network v0.0.23 h1:+1fooiXuve73NAOUTTjf2jPd9DDYHekzEKh7bLtrOFc= github.com/validator-labs/validator-plugin-network v0.0.23/go.mod h1:9f7tzIR1toQD0XVMTIba/42V+06j4IoUhwELe+V0Jfs= github.com/validator-labs/validator-plugin-oci v0.2.0 h1:gdSkuzbHxld8aD6KPuFJ6IqsrNmEBLPWgydqJHNqzZ0= @@ -985,8 +882,6 @@ github.com/xanzy/go-gitlab v0.107.0 h1:P2CT9Uy9yN9lJo3FLxpMZ4xj6uWcpnigXsjvqJ6nd github.com/xanzy/go-gitlab v0.107.0/go.mod h1:wKNKh3GkYDMOsGmnfuX+ITCmDuSDWFO0G+C4AygL9RY= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= @@ -1037,19 +932,15 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1073,7 +964,6 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1082,21 +972,17 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -1131,8 +1017,6 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1144,7 +1028,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1178,7 +1061,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= @@ -1243,17 +1125,13 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= -gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/httprequest.v1 v1.1.1/go.mod h1:/CkavNL+g3qLOrpFHVrEx4NKepeqR4XTZWNj4sGGjz0= -gopkg.in/httprequest.v1 v1.1.1/go.mod h1:/CkavNL+g3qLOrpFHVrEx4NKepeqR4XTZWNj4sGGjz0= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1262,15 +1140,10 @@ gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= gopkg.in/yaml.v2 v2.0.0-20170712054546-1be3d31502d6/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= -gopkg.in/yaml.v2 v2.0.0-20170712054546-1be3d31502d6/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1309,8 +1182,6 @@ k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCI k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= -launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= -launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0 h1:Tc9rS7JJoZ9sl3OpL4842oIk6lH7gWBb0JOmJ0ute7M= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.0/go.mod h1:1ewhL9l1gkPcU/IU/6rFYfikf+7Y5imWv7ARVbBOzNs= sigs.k8s.io/cluster-api v1.8.0 h1:xdF9svGCbezxOn9Y6QmlVnNaZ0n9QkRJpNuKJkeorUw= diff --git a/pkg/components/validator.go b/pkg/components/validator.go index 3cb6f4e4..36167f8b 100644 --- a/pkg/components/validator.go +++ b/pkg/components/validator.go @@ -41,7 +41,6 @@ type ValidatorConfig struct { NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"` OCIPlugin *OCIPluginConfig `yaml:"ociPlugin,omitempty"` VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"` - MaasPlugin *MaasPluginConfig `yaml:"maasPlugin,omitempty"` } // NewValidatorConfig creates a new ValidatorConfig object. @@ -611,34 +610,6 @@ type VsphereTagRule struct { vsphereapi.TagValidationRule `yaml:",inline"` } -// MaasPluginConfig represents the MAAS plugin configuration. -type MaasPluginConfig struct { - Enabled bool `yaml:"enabled"` - Release *validator.HelmRelease `yaml:"helmRelease"` - Validator *maas.MaasValidatorSpec `yaml:"validator"` - MaasAPIToken string `yaml:"maasApiToken"` -} - -func (c *MaasPluginConfig) encrypt() error { - token, err := crypto.EncryptB64([]byte(c.MaasAPIToken)) - if err != nil { - return errors.Wrap(err, "failed to encrypt token") - } - c.MaasAPIToken = token - - return nil -} - -func (c *MaasPluginConfig) decrypt() error { - bytes, err := crypto.DecryptB64(c.MaasAPIToken) - if err != nil { - return errors.Wrap(err, "failed to decrypt token") - } - c.MaasAPIToken = string(*bytes) - - return nil -} - // PublicKeySecret represents a public key secret. type PublicKeySecret struct { Name string `yaml:"name"` From b936dd57202b8ba12f33e11c15e7978e5fe54a47 Mon Sep 17 00:00:00 2001 From: arturshadnik Date: Tue, 13 Aug 2024 14:46:43 -0700 Subject: [PATCH 17/17] feat: split up maas resource get functions test: reassign maas client after tests test: enable all integration tests --- pkg/services/clouds/maas_service.go | 21 +++++++--- pkg/services/validator/maas.go | 14 ++++--- .../_validator/testcases/test_validator.go | 40 +++++++++++-------- 3 files changed, 47 insertions(+), 28 deletions(-) diff --git a/pkg/services/clouds/maas_service.go b/pkg/services/clouds/maas_service.go index 332c8423..f8c93911 100644 --- a/pkg/services/clouds/maas_service.go +++ b/pkg/services/clouds/maas_service.go @@ -71,31 +71,40 @@ func handleMaasClientError(err error) (string, error) { return val, nil } -// GetMaasResourceProps fetches a list of resource pools and availability zones in the cluster -func GetMaasResourceProps(c *components.MaasPluginConfig) ([]string, []string, error) { +// GetMaasResourcePools fetches a list of resource pools in the cluster +func GetMaasResourcePools(c *components.MaasPluginConfig) ([]string, error) { client, err := GetMaasClient(c.Validator.Host, c.MaasAPIToken) if err != nil { - return []string{}, []string{}, err + return nil, err } poolsObj, err := client.ResourcePools.Get() if err != nil { - return []string{}, []string{}, err + return nil, err } pools := make([]string, len(poolsObj)) for i, p := range poolsObj { pools[i] = p.Name } + return pools, nil +} + +// GetMaasZones fetches a list of availability zones in the cluster +func GetMaasZones(c *components.MaasPluginConfig) ([]string, error) { + client, err := GetMaasClient(c.Validator.Host, c.MaasAPIToken) + if err != nil { + return nil, err + } zonesObj, err := client.Zones.Get() if err != nil { - return []string{}, []string{}, err + return nil, err } zones := make([]string, len(zonesObj)) for i, z := range zonesObj { zones[i] = z.Name } - return pools, zones, nil + return zones, nil } func getMaasClient(maasURL, maasToken string) (*maasclient.Client, error) { diff --git a/pkg/services/validator/maas.go b/pkg/services/validator/maas.go index 5f11ed6c..d5fad3c3 100644 --- a/pkg/services/validator/maas.go +++ b/pkg/services/validator/maas.go @@ -209,11 +209,10 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA return err } - resourcePools, availabilityZones, err := clouds.GetMaasResourceProps(c) + availabilityZones, err := clouds.GetMaasZones(c) if err != nil { return err } - resourcePools = slices.Insert(resourcePools, 0, "N/A") if r.AZ == "" { az, err := prompts.Select("Availability Zone", availabilityZones) @@ -226,7 +225,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA addResources := true for addResources { - resource, err := readMaasResource(&resourcePools) + resource, err := readMaasResource(c) if err != nil { return err } @@ -246,7 +245,7 @@ func readMaasResourceRule(c *components.MaasPluginConfig, r *vpmaasapi.ResourceA } // nolint:dupl -func readMaasResource(resourcePools *[]string) (vpmaasapi.Resource, error) { +func readMaasResource(c *components.MaasPluginConfig) (vpmaasapi.Resource, error) { res := vpmaasapi.Resource{} numMachines, err := prompts.ReadInt("Minimum number of machines", "1", 1, -1) @@ -273,7 +272,12 @@ func readMaasResource(resourcePools *[]string) (vpmaasapi.Resource, error) { } res.Disk = disk - pool, err := prompts.Select("Resource pool (optional)", *resourcePools) + resourcePools, err := clouds.GetMaasResourcePools(c) + if err != nil { + return res, err + } + resourcePools = slices.Insert(resourcePools, 0, "N/A") + pool, err := prompts.Select("Resource pool (optional)", resourcePools) if err != nil { return res, err } diff --git a/tests/integration/_validator/testcases/test_validator.go b/tests/integration/_validator/testcases/test_validator.go index 5902e895..e993465e 100644 --- a/tests/integration/_validator/testcases/test_validator.go +++ b/tests/integration/_validator/testcases/test_validator.go @@ -56,21 +56,21 @@ func (t *ValidatorTest) Execute(ctx *test.TestContext) (tr *test.TestResult) { if result := t.testInstallSilent(); result.IsFailed() { return result } - // if result := t.testInstallSilentWait(); result.IsFailed() { - // return result - // } - // if result := t.testCheckDirect(); result.IsFailed() { - // return result - // } - // if result := t.testDescribe(); result.IsFailed() { - // return result - // } - // if result := t.testUndeploy(); result.IsFailed() { - // return result - // } - // if result := t.testInstallUpdatePasswords(); result.IsFailed() { - // return result - // } + if result := t.testInstallSilentWait(); result.IsFailed() { + return result + } + if result := t.testCheckDirect(); result.IsFailed() { + return result + } + if result := t.testDescribe(); result.IsFailed() { + return result + } + if result := t.testUndeploy(); result.IsFailed() { + return result + } + if result := t.testInstallUpdatePasswords(); result.IsFailed() { + return result + } return test.Success() } @@ -696,7 +696,7 @@ func (t *ValidatorTest) PreRequisite(ctx *test.TestContext) (tr *test.TestResult } t.initVsphereDriver(ctx) - t.overrideMaasClient() + t.overrideMaasClient(ctx) return test.Success() } @@ -714,6 +714,10 @@ func (t *ValidatorTest) TearDown(ctx *test.TestContext) { // restore clouds.GetVSphereDriver vsphereDriverFunc := ctx.Get("vsphereDriverFunc") clouds.GetVSphereDriver = vsphereDriverFunc.(func(account *vsphere.CloudAccount) (vsphere.Driver, error)) + + // restore clouds.GetMaasClient + maasClientFunc := ctx.Get("maasClientFunc") + clouds.GetMaasClient = maasClientFunc.(func(maasURL, maasToken string) (*maasclient.Client, error)) } // updateTestData updates the hard-coded validator config used for silent installation tests @@ -733,7 +737,9 @@ func (t *ValidatorTest) filePath(file string) string { return fmt.Sprintf("%s/%s/%s", file_utils.ValidatorTestCasesPath(), "data", file) } -func (t *ValidatorTest) overrideMaasClient() { +func (t *ValidatorTest) overrideMaasClient(ctx *test.TestContext) { + maasClientFunc := clouds.GetMaasClient + ctx.Put("maasClientFunc", maasClientFunc) clouds.GetMaasClient = func(maasURL, maasToken string) (*maasclient.Client, error) { client := &maasclient.Client{} client.Account = &clouds.MockMaasAccount{}