diff --git a/.golangci.yml b/.golangci.yml index 3c3f5c3..2aae2b9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,6 +3,7 @@ run: skip-files: - "zz_generated\\..+\\.go$" + - "vendored/.+\\.go$" build-tags: - e2e diff --git a/e2e/main_test.go b/e2e/main_test.go index a10affe..1a1cfb1 100644 --- a/e2e/main_test.go +++ b/e2e/main_test.go @@ -8,12 +8,12 @@ import ( "os" "testing" + "github.com/crossplane-contrib/xp-testing/pkg/vendored" "github.com/vladimirvivien/gexe" "k8s.io/klog/v2" "sigs.k8s.io/e2e-framework/pkg/envconf" "sigs.k8s.io/e2e-framework/support/kind" - xpv1alpha1 "github.com/crossplane/crossplane/apis/pkg/v1alpha1" "sigs.k8s.io/e2e-framework/pkg/env" "github.com/crossplane-contrib/xp-testing/pkg/images" @@ -41,8 +41,8 @@ func TestMain(m *testing.M) { ProviderName: "provider-nop", Images: imgs, CrossplaneVersion: "1.14.0", - ControllerConfig: &xpv1alpha1.ControllerConfig{ - Spec: xpv1alpha1.ControllerConfigSpec{ + ControllerConfig: &vendored.ControllerConfig{ + Spec: vendored.ControllerConfigSpec{ Image: &imgs.Package, }, }, @@ -58,7 +58,7 @@ func TestMain(m *testing.M) { } func pullPackageOrPanic(image string) { - klog.Info("Pulling %s", image) + klog.Info("Pulling ", image) runner := gexe.New() p := runner.RunProc(fmt.Sprintf("docker pull %s", image)) klog.V(4).Info(p.Out()) diff --git a/e2e/provider/config.yaml b/e2e/provider/config.yaml index ed97d53..e69de29 100644 --- a/e2e/provider/config.yaml +++ b/e2e/provider/config.yaml @@ -1 +0,0 @@ ---- diff --git a/go.mod b/go.mod index 8786b2f..8b435d2 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,7 @@ go 1.20 require ( github.com/GoogleContainerTools/container-diff v0.17.0 - github.com/crossplane/crossplane v1.14.1 - github.com/crossplane/crossplane-runtime v1.14.2 - github.com/google/go-cmp v0.6.0 + github.com/crossplane/crossplane-runtime v0.19.3 github.com/pkg/errors v0.9.1 github.com/samber/lo v1.38.1 github.com/stretchr/testify v1.8.4 @@ -16,16 +14,12 @@ require ( k8s.io/apimachinery v0.28.4 k8s.io/client-go v0.28.4 k8s.io/klog/v2 v2.100.1 - sigs.k8s.io/controller-runtime v0.16.3 sigs.k8s.io/e2e-framework v0.3.0 - sigs.k8s.io/kind v0.20.0 ) require ( - dario.cat/mergo v1.0.0 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/alessio/shellescape v1.4.1 // indirect github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -45,17 +39,15 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-containerregistry v0.16.1 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect github.com/google/uuid v1.3.1 // indirect github.com/imdario/mergo v0.3.16 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.1 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -64,11 +56,9 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/opencontainers/runc v0.1.1 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/vbatts/tar-split v0.11.5 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect @@ -88,6 +78,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/controller-runtime v0.16.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect diff --git a/go.sum b/go.sum index 08aa373..a082746 100644 --- a/go.sum +++ b/go.sum @@ -36,17 +36,13 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= code.cloudfoundry.org/bytefmt v0.0.0-20180906201452-2aa6f33b730c/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/GoogleContainerTools/container-diff v0.17.0 h1:P9va/peQsiBcFuL+hcZWHp3Ry7bCLLoNhUrjj7DBNFQ= github.com/GoogleContainerTools/container-diff v0.17.0/go.mod h1:pddOdZb5Wghtb2fmqbKy7Kj/sgoafW9AvUp4KS9svmg= @@ -56,8 +52,6 @@ github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5 github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= -github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -83,17 +77,9 @@ github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 h1:4BX8f882b github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= 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/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/crossplane/crossplane v1.14.0 h1:cfq1WXYQNl/O1/B+VK34cUziN24kJYgQ4z/2/O0moGs= -github.com/crossplane/crossplane v1.14.0/go.mod h1:3gHjPrttSWmVbq39OM6SCUAzsc8CV7HMW/3X2hkY3E4= -github.com/crossplane/crossplane v1.14.1 h1:EIEH4Qh9fRBXCvQIWxPBBoIjryF1izcpqemndasvqb4= -github.com/crossplane/crossplane v1.14.1/go.mod h1:Yptd7mAxZ9KbLhVDOitgsI8SPtZjoYC8R5rIkelN/cE= -github.com/crossplane/crossplane-runtime v1.14.0 h1:MFo93iOJLvYaMCaCoyH2vFWsHebdA1kv3QdOm7hcm5k= -github.com/crossplane/crossplane-runtime v1.14.0/go.mod h1:aOP+5W2wKpvthVs3pFNbVOe1jwrKYbJho0ThGNCVz9o= -github.com/crossplane/crossplane-runtime v1.14.2 h1:pV5JMzyzi/kcbeVBVPCat5MHH8zS94MBUapAyGx/Ry0= -github.com/crossplane/crossplane-runtime v1.14.2/go.mod h1:aOP+5W2wKpvthVs3pFNbVOe1jwrKYbJho0ThGNCVz9o= +github.com/crossplane/crossplane-runtime v0.19.3 h1:UzICzc3FY84k83YAB2Kqi7drmVWF7KvLt8xq2WzlTME= +github.com/crossplane/crossplane-runtime v0.19.3/go.mod h1:OJQ1NxtQK2ZTRmvtnQPoy8LsXsARTnVydRVDQEgIuz4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -223,10 +209,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 h1:pUa4ghanp6q4IJHwE9RwLgmVFfReJN+KbQ8ExNEUUoQ= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 h1:SJ+NtwL6QaZ21U+IrK7d0gGgpjGGvd2kz+FzTHVzdqI= -github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2/go.mod h1:Tv1PlzqC9t8wNnpPdctvtSUOPUUg4SHeE6vR1Ir2hmg= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -248,8 +232,6 @@ github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd/go.mod h1:3LVOLeyx9XVvwP github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -281,9 +263,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -305,7 +284,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nightlyone/lockfile v0.0.0-20180618180623-0ad87eef1443/go.mod h1:JbxfV1Iifij2yhRjXai0oFrbpxszXHRx1E5RuM26o4Y= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= @@ -322,8 +300,6 @@ github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/ github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -349,7 +325,6 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -363,9 +338,6 @@ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:s github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -401,7 +373,7 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -552,9 +524,8 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/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-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -699,7 +670,7 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -718,7 +689,7 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -737,7 +708,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/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-20200902074654-038fdea0a05b/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.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -764,23 +734,15 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.28.3 h1:Gj1HtbSdB4P08C8rs9AR94MfSGpRhJgsS+GF9V26xMM= -k8s.io/api v0.28.3/go.mod h1:MRCV/jr1dW87/qJnZ57U5Pak65LGmQVkKTzf3AtKFHc= k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= -k8s.io/apiextensions-apiserver v0.28.3 h1:Od7DEnhXHnHPZG+W9I97/fSQkVpVPQx2diy+2EtmY08= -k8s.io/apiextensions-apiserver v0.28.3/go.mod h1:NE1XJZ4On0hS11aWWJUTNkmVB03j9LM7gJSisbRt8Lc= k8s.io/apiextensions-apiserver v0.28.4 h1:AZpKY/7wQ8n+ZYDtNHbAJBb+N4AXXJvyZx6ww6yAJvU= k8s.io/apiextensions-apiserver v0.28.4/go.mod h1:pgQIZ1U8eJSMQcENew/0ShUTlePcSGFq6dxSxf2mwPM= -k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A= -k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8= k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8= k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg= -k8s.io/client-go v0.28.3 h1:2OqNb72ZuTZPKCl+4gTKvqao0AMOl9f3o2ijbAj3LI4= -k8s.io/client-go v0.28.3/go.mod h1:LTykbBp9gsA7SwqirlCXBWtK0guzfhpoW4qSm7i9dxo= k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY= k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4= -k8s.io/component-base v0.28.3 h1:rDy68eHKxq/80RiMb2Ld/tbH8uAE75JdCqJyi6lXMzI= +k8s.io/component-base v0.28.4 h1:c/iQLWPdUgI90O+T9TeECg8o7N3YJTiuz2sKxILYcYo= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= @@ -796,8 +758,6 @@ sigs.k8s.io/e2e-framework v0.3.0 h1:eqQALBtPCth8+ulTs6lcPK7ytV5rZSSHJzQHZph4O7U= sigs.k8s.io/e2e-framework v0.3.0/go.mod h1:C+ef37/D90Dc7Xq1jQnNbJYscrUGpxrWog9bx2KIa+c= 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/kind v0.20.0 h1:f0sc3v9mQbGnjBUaqSFST1dwIuiikKVGgoTwpoP33a8= -sigs.k8s.io/kind v0.20.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go index 2ad9894..bf404b1 100644 --- a/pkg/resources/resources.go +++ b/pkg/resources/resources.go @@ -10,17 +10,15 @@ import ( "time" "github.com/crossplane-contrib/xp-testing/pkg/xpconditions" - - crossplanev1 "github.com/crossplane/crossplane/apis/pkg/v1" "github.com/samber/lo" v1extensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" "k8s.io/klog/v2" - "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/e2e-framework/klient/decoder" "sigs.k8s.io/e2e-framework/klient/k8s" "sigs.k8s.io/e2e-framework/klient/k8s/resources" @@ -29,6 +27,10 @@ import ( "sigs.k8s.io/e2e-framework/pkg/envconf" ) +var ( + providerSchema = schema.GroupVersionResource{Group: "pkg.crossplane.io", Version: "v1", Resource: "providers"} +) + // ImportResources gets the resources from dir func ImportResources(ctx context.Context, t *testing.T, cfg *envconf.Config, dir string) { r := resClient(cfg) @@ -95,8 +97,8 @@ func WaitForResourcesToBeSynced( } type mockList struct { - client.ObjectList - + metav1.ListInterface + runtime.Object Items []k8s.Object } @@ -138,16 +140,15 @@ func DumpManagedResources(ctx context.Context, t *testing.T, cfg *envconf.Config } func dumpProviders(ctx context.Context, t *testing.T, client *resources.Resources) { - var providers crossplanev1.ProviderList + dynamiq := dynamic.NewForConfigOrDie(client.GetConfig()) - if err := crossplanev1.AddToScheme(client.GetScheme()); err != nil { - t.Fatal(err) - } - - if err := client.List(ctx, &providers); err != nil { + res := dynamiq.Resource(providerSchema) + list, err := res.List(ctx, metav1.ListOptions{}) + if err != nil { t.Fatal(err) + return } - for _, provider := range providers.Items { + for _, provider := range list.Items { t.Log(provider) } } diff --git a/pkg/setup/setup.go b/pkg/setup/setup.go index fff5f36..4b07c23 100644 --- a/pkg/setup/setup.go +++ b/pkg/setup/setup.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/crossplane-contrib/xp-testing/pkg/envvar" - "github.com/crossplane/crossplane/apis/pkg/v1alpha1" + "github.com/crossplane-contrib/xp-testing/pkg/vendored" "github.com/vladimirvivien/gexe" "k8s.io/apimachinery/pkg/runtime" log "k8s.io/klog/v2" @@ -29,7 +29,7 @@ const ( type ClusterSetup struct { ProviderName string Images images.ProviderImages - ControllerConfig *v1alpha1.ControllerConfig + ControllerConfig *vendored.ControllerConfig SecretData map[string]string AddToSchemaFuncs []func(s *runtime.Scheme) error CrossplaneVersion string diff --git a/pkg/vendored/controller_config.go b/pkg/vendored/controller_config.go new file mode 100644 index 0000000..fbd5b25 --- /dev/null +++ b/pkg/vendored/controller_config.go @@ -0,0 +1,372 @@ +// manually vendored to reduce dependency to c/c +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package vendored + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ControllerConfigSpec specifies the configuration for a packaged controller. +// Values provided will override package manager defaults. Labels and +// annotations are passed to both the controller Deployment and ServiceAccount. +type ControllerConfigSpec struct { + // Metadata that will be added to the provider Pod. + // +optional + Metadata *PodObjectMeta `json:"metadata,omitempty"` + + // Number of desired pods. This is a pointer to distinguish between explicit + // zero and not specified. Defaults to 1. + // Note: If more than 1 replica is set and leader election is not enabled then + // controllers could conflict. Environment variable "LEADER_ELECTION" can be + // used to enable leader election process. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + // Docker image name. + // More info: https://kubernetes.io/docs/concepts/containers/images + // This field is optional to allow higher level config management to default or override + // container images in workload controllers like Deployments and StatefulSets. + // +optional + Image *string `json:"image,omitempty"` + // NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run this pod. + // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ + // If specified, a ServiceAccount named this ServiceAccountName will be used for + // the spec.serviceAccountName field in Pods to be created and for the subjects.name field + // in a ClusterRoleBinding to be created. + // If there is no ServiceAccount named this ServiceAccountName, a new ServiceAccount + // will be created. + // If there is a pre-existing ServiceAccount named this ServiceAccountName, the ServiceAccount + // will be used. The annotations in the ControllerConfig will be copied to the ServiceAccount + // and pre-existing annotations will be kept. + // Regardless of whether there is a ServiceAccount created by Crossplane or is in place already, + // the ServiceAccount will be deleted once the Provider and ControllerConfig are deleted. + // +optional + ServiceAccountName *string `json:"serviceAccountName,omitempty"` + // NodeName is a request to schedule this pod onto a specific node. If it is non-empty, + // the scheduler simply schedules this pod onto that node, assuming that it fits resource + // requirements. + // +optional + NodeName *string `json:"nodeName,omitempty"` + // PodSecurityContext holds pod-level security attributes and common container settings. + // Optional: Defaults to empty. See type description for default values of each field. + // +optional + PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"` + // SecurityContext holds container-level security attributes and common container settings. + // Optional: Defaults to empty. See type description for default values of each field. + // +optional + SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"` + // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. + // If specified, these secrets will be passed to individual puller implementations for them to use. For example, + // in the case of docker, only DockerConfig type secrets are honored. + // More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod + // Setting ImagePullSecrets will replace any secrets that have been + // propagated to a controller Deployment, typically via packagePullSecrets. + // +optional + ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // Image pull policy. + // One of Always, Never, IfNotPresent. + // Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. + // Cannot be updated. + // More info: https://kubernetes.io/docs/concepts/containers/images#updating-images + // +optional + ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"` + // If specified, the pod's scheduling constraints + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + // If specified, the pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + // If specified, indicates the pod's priority. "system-node-critical" and + // "system-cluster-critical" are two special keywords which indicate the + // highest priorities with the former being the highest priority. Any other + // name must be defined by creating a PriorityClass object with that name. + // If not specified, the pod priority will be default or zero if there is no + // default. + // +optional + PriorityClassName *string `json:"priorityClassName,omitempty"` + // RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used + // to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. + // If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an + // empty definition that uses the default runtime handler. + // More info: https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md + // This is a beta feature as of Kubernetes v1.14. + // +optional + RuntimeClassName *string `json:"runtimeClassName,omitempty"` + // Compute Resources required by this container. + // Cannot be updated. + // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + // +optional + ResourceRequirements *corev1.ResourceRequirements `json:"resources,omitempty"` + // Arguments to the entrypoint. + // The docker image's CMD is used if this is not provided. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + // regardless of whether the variable exists or not. + // Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` + // List of sources to populate environment variables in the container. + // The keys defined within a source must be a C_IDENTIFIER. All invalid keys + // will be reported as an event when the container is starting. When a key exists in multiple + // sources, the value associated with the last source will take precedence. + // Values defined by an Env with a duplicate key will take precedence. + // Cannot be updated. + // +optional + EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` + // List of environment variables to set in the container. + // Cannot be updated. + // +optional + Env []corev1.EnvVar `json:"env,omitempty"` + // List of container ports to expose on the container + // +optional + Ports []corev1.ContainerPort `json:"ports,omitempty"` + // List of volumes that can be mounted by containers belonging to the pod. + // More info: https://kubernetes.io/docs/concepts/storage/volumes + // +optional + Volumes []corev1.Volume `json:"volumes,omitempty"` + // List of VolumeMounts to mount into the container's filesystem. + // Cannot be updated. + // +optional + VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` +} + +// PodObjectMeta is metadata that is added to the Pods in a provider's +// Deployment. +type PodObjectMeta struct { + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + // +optional + Annotations map[string]string `json:"annotations,omitempty"` + + // Map of string keys and values that can be used to organize and + // categorize (scope and select) objects. This will only affect + // labels on the pod, not the pod selector. Labels will be merged + // with internal labels used by crossplane, and labels with a + // crossplane.io key might be overwritten. + // More info: http://kubernetes.io/docs/user-guide/labels + // +optional + Labels map[string]string `json:"labels,omitempty"` +} + +// ControllerConfig is the CRD type for a packaged controller configuration. +// Deprecated: This API is replaced by DeploymentRuntimeConfig, and is scheduled +// to be removed in a future release. See the design doc for more details: +// https://github.com/crossplane/crossplane/blob/11bbe13ea3604928cc4e24e8d0d18f3f5f7e847c/design/one-pager-package-runtime-config.md +type ControllerConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ControllerConfigSpec `json:"spec,omitempty"` +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControllerConfig) DeepCopyInto(out *ControllerConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerConfig. +func (in *ControllerConfig) DeepCopy() *ControllerConfig { + if in == nil { + return nil + } + out := new(ControllerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ControllerConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControllerConfigSpec) DeepCopyInto(out *ControllerConfigSpec) { + *out = *in + if in.Metadata != nil { + in, out := &in.Metadata, &out.Metadata + *out = new(PodObjectMeta) + (*in).DeepCopyInto(*out) + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(string) + **out = **in + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ServiceAccountName != nil { + in, out := &in.ServiceAccountName, &out.ServiceAccountName + *out = new(string) + **out = **in + } + if in.NodeName != nil { + in, out := &in.NodeName, &out.NodeName + *out = new(string) + **out = **in + } + if in.PodSecurityContext != nil { + in, out := &in.PodSecurityContext, &out.PodSecurityContext + *out = new(corev1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + *out = new(corev1.SecurityContext) + (*in).DeepCopyInto(*out) + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]corev1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.ImagePullPolicy != nil { + in, out := &in.ImagePullPolicy, &out.ImagePullPolicy + *out = new(corev1.PullPolicy) + **out = **in + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(corev1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]corev1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PriorityClassName != nil { + in, out := &in.PriorityClassName, &out.PriorityClassName + *out = new(string) + **out = **in + } + if in.RuntimeClassName != nil { + in, out := &in.RuntimeClassName, &out.RuntimeClassName + *out = new(string) + **out = **in + } + if in.ResourceRequirements != nil { + in, out := &in.ResourceRequirements, &out.ResourceRequirements + *out = new(corev1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.EnvFrom != nil { + in, out := &in.EnvFrom, &out.EnvFrom + *out = make([]corev1.EnvFromSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]corev1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Ports != nil { + in, out := &in.Ports, &out.Ports + *out = make([]corev1.ContainerPort, len(*in)) + copy(*out, *in) + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]corev1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VolumeMounts != nil { + in, out := &in.VolumeMounts, &out.VolumeMounts + *out = make([]corev1.VolumeMount, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerConfigSpec. +func (in *ControllerConfigSpec) DeepCopy() *ControllerConfigSpec { + if in == nil { + return nil + } + out := new(ControllerConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodObjectMeta) DeepCopyInto(out *PodObjectMeta) { + *out = *in + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodObjectMeta. +func (in *PodObjectMeta) DeepCopy() *PodObjectMeta { + if in == nil { + return nil + } + out := new(PodObjectMeta) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/xpconditions/xpconditions.go b/pkg/xpconditions/xpconditions.go index 8f11822..a6b1d61 100644 --- a/pkg/xpconditions/xpconditions.go +++ b/pkg/xpconditions/xpconditions.go @@ -2,21 +2,26 @@ package xpconditions import ( "context" - "encoding/json" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" "github.com/crossplane/crossplane-runtime/pkg/resource" - pkgv1 "github.com/crossplane/crossplane/apis/pkg/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" apimachinerywait "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/dynamic" "k8s.io/klog/v2" "sigs.k8s.io/e2e-framework/klient/k8s" "sigs.k8s.io/e2e-framework/klient/k8s/resources" apimachineryconditions "sigs.k8s.io/e2e-framework/klient/wait/conditions" ) +var ( + providerSchema = schema.GroupVersionResource{Group: "pkg.crossplane.io", Version: "v1", Resource: "providers"} +) + // Conditions helps with matching resources on conditions type Conditions struct { apimachineryconditions.Condition @@ -30,47 +35,71 @@ func New(r *resources.Resources) *Conditions { // ProviderConditionMatch checks if a Provider has a matching condition func (c *Conditions) ProviderConditionMatch( - provider k8s.Object, + name string, conditionType xpv1.ConditionType, conditionStatus corev1.ConditionStatus, ) apimachinerywait.ConditionWithContextFunc { return func(ctx context.Context) (done bool, err error) { - klog.V(4).Infof("Awaiting provider %s to be ready", provider.GetName()) - if err := c.resources.Get(ctx, provider.GetName(), provider.GetNamespace(), provider); err != nil { + klog.V(4).Infof("Awaiting provider %s to be ready", name) + + cl, err := dynamic.NewForConfig(c.resources.GetConfig()) + if err != nil { return false, err } - for _, cond := range provider.(*pkgv1.Provider).Status.Conditions { - klog.V(4).Infof("provider %s, condition: %s: %s", provider.GetName(), cond.Type, cond.Status) - if cond.Type == conditionType && cond.Status == conditionStatus { - done = true - } + res := cl.Resource(providerSchema) + providerObject, err := res.Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return false, resource.IgnoreNotFound(err) } - return + + result := checkCondition(providerObject, conditionType, conditionStatus) + return result, nil } } +func checkCondition(unstruc *unstructured.Unstructured, desiredType xpv1.ConditionType, desiredStatus corev1.ConditionStatus) bool { + + conditions, ok, err := unstructured.NestedSlice(unstruc.UnstructuredContent(), "status", "conditions") + if err != nil { + klog.V(4).Infof("Could not extract conditions of (%s) %s, %s", unstruc.GroupVersionKind().String(), unstruc.GetName(), err.Error()) + return false + } else if !ok { + klog.V(4).Infof("Object (%s) %s doesnt have conditions", unstruc.GroupVersionKind().String(), unstruc.GetName()) + return false + } + + status := "" + for _, condition := range conditions { + c := condition.(map[string]interface{}) + curType := c["type"] + if curType == string(desiredType) { + status = c["status"].(string) + } + } + matchedConditionStatus := false + if status == string(desiredStatus) { + matchedConditionStatus = true + } + + klog.V(4).Infof("Object (%s) %s, condition: %s: %s, matched: %b", unstruc.GroupVersionKind().String(), unstruc.GetName(), desiredType, status, matchedConditionStatus) + + return matchedConditionStatus +} + // IsManagedResourceReadyAndReady returns if a managed resource has condtions Synced = True and Ready = True func (c *Conditions) IsManagedResourceReadyAndReady(object k8s.Object) bool { - managed := convertToManaged(object) - return managedCheckCondition(managed, xpv1.TypeSynced, corev1.ConditionTrue) && - managedCheckCondition(managed, xpv1.TypeReady, corev1.ConditionTrue) + us := convertToUnstructured(object) + return checkCondition(us, xpv1.TypeSynced, corev1.ConditionTrue) && + checkCondition(us, xpv1.TypeReady, corev1.ConditionTrue) } -func convertToManaged(object k8s.Object) resource.Managed { - unstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(object) +func convertToUnstructured(object k8s.Object) *unstructured.Unstructured { + data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(object) if err != nil { return nil } - var managed DummyManaged - err = runtime.DefaultUnstructuredConverter. - FromUnstructured(unstructured, &managed) - - if err != nil { - panic(err) - } - - return &managed + return &unstructured.Unstructured{Object: data} } // ManagedResourcesReadyAndReady checks if a list of ManagedResources has a matching condition @@ -79,35 +108,3 @@ func (c *Conditions) ManagedResourcesReadyAndReady( ) apimachinerywait.ConditionWithContextFunc { return c.ResourcesMatch(list, c.IsManagedResourceReadyAndReady) } - -func managedCheckCondition(o resource.Managed, conditionType xpv1.ConditionType, want corev1.ConditionStatus) bool { - klog.V(4).Infof("Checking Managed Resource %s to be condition: %s: %s", o.GetName(), conditionType, want) - got := o.GetCondition(conditionType) - klog.V(4).Infof("Got Managed Resource %s to be condition: %s: %s, message: %s", o.GetName(), conditionType, got.Status, got.Message) - return want == got.Status -} - -var _ resource.Managed = &DummyManaged{} - -// DummyManaged acts as a fake / dummy to allow generic checks on any managed resource -type DummyManaged struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - resource.ProviderConfigReferencer - resource.ConnectionSecretWriterTo - resource.ConnectionDetailsPublisherTo - resource.Manageable - resource.Orphanable - xpv1.ConditionedStatus `json:"status"` -} - -// DeepCopyObject returns a copy of the object as runtime.Object -func (m *DummyManaged) DeepCopyObject() runtime.Object { - out := &DummyManaged{} - j, err := json.Marshal(m) - if err != nil { - panic(err) - } - _ = json.Unmarshal(j, out) - return out -} diff --git a/pkg/xpconditions/xpconditions_test.go b/pkg/xpconditions/xpconditions_test.go index bbb22f6..fa695f1 100644 --- a/pkg/xpconditions/xpconditions_test.go +++ b/pkg/xpconditions/xpconditions_test.go @@ -4,88 +4,159 @@ import ( "testing" xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/google/go-cmp/cmp" + v1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/e2e-framework/klient/k8s" ) -func Test_convertToManaged(t *testing.T) { +func TestConditions_awaitCondition(t *testing.T) { type args struct { - object k8s.Object + obj unstructured.Unstructured + conditionType xpv1.ConditionType + conditionStatus corev1.ConditionStatus + } + conditionSyncedTrue := map[string]interface{}{ + "type": "Synced", + "status": "True", + } + conditionReadyTrue := map[string]interface{}{ + "type": "Ready", + "status": "True", + } + conditionReadyFalse := map[string]interface{}{ + "type": "Ready", + "status": "False", } + tests := []struct { name string args args - want resource.Managed + want bool }{ { - name: "happy path", + name: "existing condition, matches expectation", args: args{ - object: &unstructured.Unstructured{ + obj: unstructured.Unstructured{ Object: map[string]interface{}{ - "apiVersion": "foo.crossplane.io/v1", - "kind": "Foo", - "metadata": map[string]interface{}{ - "name": "example-resource", - }, - // Should be ignored - "spec": map[string]interface{}{ - "forProvider": map[string]interface{}{ - "propertyKey": "value", - }, - }, "status": map[string]interface{}{ - "atProvider": map[string]interface{}{ - "providerState": true, - }, "conditions": []interface{}{ - map[string]interface{}{ - "reason": "Available", - "status": "True", - "type": "Ready", - }, - map[string]interface{}{ - "reason": "ReconcileSuccess", - "status": "True", - "type": "Synced", - }, + conditionReadyTrue}, + }, + }, + }, + conditionType: xpv1.TypeReady, + conditionStatus: corev1.ConditionTrue, + }, + want: true, + }, + { + name: "existing condition, doesnt match expectation", + args: args{ + obj: unstructured.Unstructured{ + Object: map[string]interface{}{ + "Status": map[string]interface{}{ + "Conditions": []interface{}{ + conditionSyncedTrue, + conditionReadyFalse, }, }, }, }, + conditionType: xpv1.TypeReady, + conditionStatus: corev1.ConditionFalse, + }, + want: false, + }, + { + name: "non existing condition, doesnt match expectation", + args: args{ + obj: unstructured.Unstructured{}, + conditionType: xpv1.TypeReady, + conditionStatus: corev1.ConditionFalse, + }, + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := checkCondition(&tt.args.obj, tt.args.conditionType, tt.args.conditionStatus); got != tt.want { + t.Errorf("checkCondition() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestConditions_IsManagedResourceReadyAndReady(t *testing.T) { + type args struct { + object k8s.Object + } + tests := []struct { + name string + args args + want bool + }{ + { + name: "No conditions, return false", + args: args{ + object: &v1.DaemonSet{ + Status: v1.DaemonSetStatus{Conditions: []v1.DaemonSetCondition{}}, + }, }, - want: &DummyManaged{ - TypeMeta: metav1.TypeMeta{ - Kind: "Foo", - APIVersion: "foo.crossplane.io/v1", + want: false, + }, + { + name: "No matching condition, return false", + args: args{ + object: &v1.DaemonSet{ + Status: v1.DaemonSetStatus{Conditions: []v1.DaemonSetCondition{ + {Type: "Foo", Status: corev1.ConditionTrue}, + }}, }, - ObjectMeta: metav1.ObjectMeta{ - Name: "example-resource", + }, + want: false, + }, + { + name: "Synced=True condition, return false", + args: args{ + object: &v1.DaemonSet{ + Status: v1.DaemonSetStatus{Conditions: []v1.DaemonSetCondition{ + {Type: "Synced", Status: corev1.ConditionTrue}, + }}, }, - ConditionedStatus: xpv1.ConditionedStatus{ - Conditions: []xpv1.Condition{ - { - Type: xpv1.TypeReady, - Status: corev1.ConditionTrue, - Reason: xpv1.ReasonAvailable, - }, - { - Type: xpv1.TypeSynced, - Status: corev1.ConditionTrue, - Reason: xpv1.ReasonReconcileSuccess, - }, - }, + }, + want: false, + }, + { + name: "Synced=True,Ready=True conditions, return true", + args: args{ + object: &v1.DaemonSet{ + Status: v1.DaemonSetStatus{Conditions: []v1.DaemonSetCondition{ + {Type: "Synced", Status: corev1.ConditionTrue}, + {Type: "Ready", Status: corev1.ConditionTrue}, + }}, + }, + }, + want: true, + }, + { + name: "Synced=Unknown,Ready=True conditions, return false", + args: args{ + object: &v1.DaemonSet{ + Status: v1.DaemonSetStatus{Conditions: []v1.DaemonSetCondition{ + {Type: "Synced", Status: corev1.ConditionUnknown}, + {Type: "Ready", Status: corev1.ConditionTrue}, + }}, }, - }}, + }, + want: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got := convertToManaged(tt.args.object) - if diff := cmp.Diff(tt.want, got); diff != "" { - t.Errorf("convertToManaged() = %v, want %v, diff: %v", got, tt.want, diff) + c := &Conditions{} + if got := c.IsManagedResourceReadyAndReady(tt.args.object); got != tt.want { + t.Errorf("IsManagedResourceReadyAndReady() = %v, want %v", got, tt.want) } }) } diff --git a/pkg/xpenvfuncs/xpenvfuncs.go b/pkg/xpenvfuncs/xpenvfuncs.go index 09a5192..d963fd7 100644 --- a/pkg/xpenvfuncs/xpenvfuncs.go +++ b/pkg/xpenvfuncs/xpenvfuncs.go @@ -13,14 +13,16 @@ import ( "time" resHelper "github.com/crossplane-contrib/xp-testing/pkg/resources" + "github.com/crossplane-contrib/xp-testing/pkg/vendored" xconditions "github.com/crossplane-contrib/xp-testing/pkg/xpconditions" - pkgv1 "github.com/crossplane/crossplane/apis/pkg/v1" - "github.com/crossplane/crossplane/apis/pkg/v1alpha1" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" v1extensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" "k8s.io/klog/v2" "sigs.k8s.io/e2e-framework/klient/decoder" "sigs.k8s.io/e2e-framework/klient/k8s" @@ -84,6 +86,10 @@ const ( errNoClusterInContext = "could get get cluster with this name from context" ) +var ( + controllerConfigSchema = schema.GroupVersionResource{Group: "pkg.crossplane.io", Version: "v1alpha1", Resource: "controllerconfigs"} +) + // InstallCrossplane returns an env.Func that is used to install crossplane into the given cluster func InstallCrossplane(clusterName string, crossplaneVersion string) env.Func { cacheName := "package-cache" @@ -159,7 +165,7 @@ type InstallCrossplaneProviderOptions struct { Name string Package string ControllerImage *string // TODO read from package - ControllerConfig *v1alpha1.ControllerConfig + ControllerConfig *vendored.ControllerConfig } // InstallCrossplaneProvider returns an env.Func that is used to @@ -296,18 +302,11 @@ func installCrossplaneProviderEnvFunc(_ string, opts InstallCrossplaneProviderOp } if opts.ControllerConfig != nil { - config := opts.ControllerConfig.DeepCopy() - config.ObjectMeta = metav1.ObjectMeta{ - Name: opts.Name, - } data.ControllerConfig = opts.Name - res := cfg.Client().Resources() - if err := v1alpha1.AddToScheme(res.GetScheme()); err != nil { - return ctx, err - } - err := res.Create(ctx, config) + + err := applyControllerConfig(ctx, cfg, opts) if err != nil { - return nil, err + return ctx, err } } @@ -322,22 +321,38 @@ func installCrossplaneProviderEnvFunc(_ string, opts InstallCrossplaneProviderOp } } +func applyControllerConfig(ctx context.Context, cfg *envconf.Config, opts InstallCrossplaneProviderOptions) error { + config := opts.ControllerConfig.DeepCopy() + config.TypeMeta.Kind = "ControllerConfig" + config.TypeMeta.APIVersion = controllerConfigSchema.GroupVersion().Identifier() + config.ObjectMeta = metav1.ObjectMeta{ + Name: opts.Name, + } + + cl, err := dynamic.NewForConfig(cfg.Client().RESTConfig()) + if err != nil { + return err + } + res := cl.Resource(controllerConfigSchema) + data, err := runtime.DefaultUnstructuredConverter.ToUnstructured(config) + if err != nil { + return err + } + unstruc := unstructured.Unstructured{Object: data} + _, err = res.Create(ctx, &unstruc, metav1.CreateOptions{}) + return err +} + func awaitProviderHealthy(opts InstallCrossplaneProviderOptions) env.Func { return func(ctx context.Context, cfg *envconf.Config) (context.Context, error) { - provider := pkgv1.Provider{ - ObjectMeta: metav1.ObjectMeta{Name: opts.Name}, - } r, err := resources.New(cfg.Client().RESTConfig()) if err != nil { return ctx, err } - if err := pkgv1.AddToScheme(r.GetScheme()); err != nil { - return ctx, err - } err = wait.For( xconditions.New(r).ProviderConditionMatch( - &provider, - pkgv1.TypeHealthy, + opts.Name, + "Healthy", corev1.ConditionTrue, ), wait.WithTimeout(time.Minute*5), )