mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
Chore: remove unnecessary go mod (#6093)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
@@ -77,7 +77,7 @@ jobs:
|
||||
|
||||
- name: Get Ginkgo
|
||||
run: |
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@v2.10.0
|
||||
go get github.com/onsi/gomega/...
|
||||
|
||||
- name: Load image
|
||||
|
||||
@@ -10,31 +10,21 @@ require (
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8
|
||||
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
|
||||
github.com/bluele/gcache v0.0.2
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
|
||||
github.com/briandowns/spinner v1.23.0
|
||||
github.com/chartmuseum/helm-push v0.10.3
|
||||
github.com/cloudtty/cloudtty v0.5.3
|
||||
github.com/chartmuseum/helm-push v0.10.4
|
||||
github.com/containerd/containerd v1.7.1
|
||||
github.com/coreos/prometheus-operator v0.41.1
|
||||
github.com/crossplane/crossplane-runtime v0.19.2
|
||||
github.com/cue-exp/kubevelafix v0.0.0-20220922150317-aead819d979d
|
||||
github.com/dave/jennifer v1.6.1
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
|
||||
github.com/ettle/strcase v0.1.1
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
|
||||
github.com/fatih/camelcase v1.0.0 // indirect
|
||||
github.com/fatih/color v1.15.0
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/fluxcd/helm-controller/api v0.32.2
|
||||
github.com/fluxcd/source-controller/api v0.24.4
|
||||
github.com/form3tech-oss/jwt-go v3.2.5+incompatible
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/gertd/go-pluralize v0.2.1
|
||||
github.com/getkin/kin-openapi v0.94.0
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.6.1
|
||||
github.com/go-logr/logr v1.2.4
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
@@ -42,8 +32,6 @@ require (
|
||||
github.com/google/go-cmp v0.5.9
|
||||
github.com/google/go-containerregistry v0.15.2
|
||||
github.com/google/go-github/v32 v32.1.0
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/gosuri/uitable v0.0.4
|
||||
github.com/hashicorp/go-version v1.6.0
|
||||
github.com/hashicorp/hcl/v2 v2.16.2
|
||||
@@ -54,14 +42,13 @@ require (
|
||||
github.com/kyokomi/emoji v2.2.4+incompatible
|
||||
github.com/magiconair/properties v1.8.7
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2
|
||||
github.com/oam-dev/cluster-gateway v1.9.0-alpha.2
|
||||
github.com/oam-dev/cluster-register v1.0.4-0.20230424040021-147f7c1fefe5
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
|
||||
github.com/oam-dev/terraform-controller v0.7.10
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/ginkgo/v2 v2.9.5
|
||||
github.com/onsi/ginkgo/v2 v2.10.0
|
||||
github.com/onsi/gomega v1.27.7
|
||||
github.com/openkruise/kruise-api v1.4.0
|
||||
github.com/openkruise/rollouts v0.3.0
|
||||
@@ -77,23 +64,18 @@ require (
|
||||
github.com/stretchr/testify v1.8.3
|
||||
github.com/tidwall/gjson v1.14.4
|
||||
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f
|
||||
github.com/wonderflow/cert-manager-api v1.0.4-0.20210304051430-e08aa76f6c5f
|
||||
github.com/xanzy/go-gitlab v0.83.0
|
||||
github.com/xlab/treeprint v1.2.0
|
||||
go.uber.org/multierr v1.11.0
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/crypto v0.9.0
|
||||
golang.org/x/oauth2 v0.8.0
|
||||
golang.org/x/sync v0.2.0
|
||||
golang.org/x/term v0.8.0
|
||||
golang.org/x/text v0.9.0
|
||||
golang.org/x/tools v0.9.1
|
||||
golang.org/x/tools v0.9.3
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gotest.tools v2.2.0+incompatible
|
||||
helm.sh/helm/v3 v3.11.2
|
||||
istio.io/client-go v1.14.0
|
||||
k8s.io/api v0.26.3
|
||||
k8s.io/apiextensions-apiserver v0.26.3
|
||||
k8s.io/apimachinery v0.26.3
|
||||
@@ -156,14 +138,21 @@ require (
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
|
||||
github.com/emicklei/proto v1.10.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
|
||||
github.com/fatih/camelcase v1.0.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
|
||||
github.com/fluxcd/pkg/apis/kustomize v1.0.0 // indirect
|
||||
github.com/fluxcd/pkg/apis/meta v1.0.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/fvbommel/sortorder v1.0.1 // indirect
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
@@ -189,7 +178,9 @@ require (
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
||||
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
|
||||
@@ -207,9 +198,7 @@ require (
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/pty v1.1.8 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/lib/pq v1.10.7 // indirect
|
||||
@@ -228,6 +217,7 @@ require (
|
||||
github.com/moby/locker v1.0.1 // indirect
|
||||
github.com/moby/spdystream v0.2.0 // indirect
|
||||
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
@@ -275,6 +265,7 @@ require (
|
||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
@@ -289,8 +280,7 @@ require (
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
istio.io/api v0.0.0-20220512212136-561ffec82582 // indirect
|
||||
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
k8s.io/klog v1.0.0 // indirect
|
||||
k8s.io/kms v0.26.3 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
|
||||
|
||||
@@ -185,8 +185,6 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
|
||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||
github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw=
|
||||
github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
@@ -221,8 +219,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk=
|
||||
github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHeQQ+5AjwawxA=
|
||||
github.com/chartmuseum/helm-push v0.10.3 h1:0NQq4FJvy7gXm7nlUg2aucv7LTI5wszyI71oYm1zkzk=
|
||||
github.com/chartmuseum/helm-push v0.10.3/go.mod h1:zVskBtjr1r6F3yx6TGrNeqvs2lWcvKeJqUcDMEzle6k=
|
||||
github.com/chartmuseum/helm-push v0.10.4 h1:vJTEwhQQ/c+puHSZv+n/3qoHQEAkjjX2b7ODvFVL14s=
|
||||
github.com/chartmuseum/helm-push v0.10.4/go.mod h1:T+g3wEExKHZADxEU3ZwCRZm5Wa5crecdqJWBfETGTKw=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
@@ -233,8 +231,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
||||
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
|
||||
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
|
||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||
github.com/cloudtty/cloudtty v0.5.3 h1:DrTqLoIpzq2GRx7ia2bJucSMqXLDhgSFgxTHnPdmb3Q=
|
||||
github.com/cloudtty/cloudtty v0.5.3/go.mod h1:dVTmjHlIsjUJIeFfJxK/9rqG2Ww4W1X4RJvlyruG6ek=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||
@@ -417,8 +413,6 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdk
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell/v2 v2.6.0 h1:OKbluoP9VYmJwZwq/iLb4BxwKcwGthaa1YNBJIyCySg=
|
||||
github.com/gdamore/tcell/v2 v2.6.0/go.mod h1:be9omFATkdr0D9qewWW3d+MEvl5dha+Etb5y65J2H8Y=
|
||||
github.com/gertd/go-pluralize v0.2.1 h1:M3uASbVjMnTsPb0PNqg+E/24Vwigyo/tvyMTtAlLgiA=
|
||||
github.com/gertd/go-pluralize v0.2.1/go.mod h1:rbYaKDbsXxmRfr8uygAEKhOWsjyrrqrkHVpZvoOp8zk=
|
||||
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
|
||||
github.com/getkin/kin-openapi v0.94.0 h1:bAxg2vxgnHHHoeefVdmGbR+oxtJlcv5HsJJa3qmAHuo=
|
||||
github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q=
|
||||
@@ -467,7 +461,6 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=
|
||||
github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro=
|
||||
github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A=
|
||||
github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4=
|
||||
@@ -1151,15 +1144,14 @@ github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8Ay
|
||||
github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo=
|
||||
github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw=
|
||||
github.com/onsi/ginkgo/v2 v2.6.0/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc=
|
||||
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
|
||||
github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
|
||||
github.com/onsi/ginkgo/v2 v2.10.0 h1:sfUl4qgLdvkChZrWCYndY2EAu9BRIw1YphNAzy1VNWs=
|
||||
github.com/onsi/ginkgo/v2 v2.10.0/go.mod h1:UDQOh5wbQUlMnkLfVaIUMtQ1Vus92oM+P2JX1aulgcE=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
|
||||
@@ -1455,8 +1447,6 @@ github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXST
|
||||
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/wonderflow/cert-manager-api v1.0.4-0.20210304051430-e08aa76f6c5f h1:DAWUgvjpY7r474gC2ZWkWCJaaJLnTq1r1kF9KGckJV0=
|
||||
github.com/wonderflow/cert-manager-api v1.0.4-0.20210304051430-e08aa76f6c5f/go.mod h1:1Se7MSg11/eNYlo4fWv6vOM55/jTBMOzg2DN1kVFiSc=
|
||||
github.com/xanzy/go-gitlab v0.83.0 h1:37p0MpTPNbsTMKX/JnmJtY8Ch1sFiJzVF342+RvZEGw=
|
||||
github.com/xanzy/go-gitlab v0.83.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
@@ -2003,13 +1993,12 @@ golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717/go.mod h1:Uh6Zz+xoGYZom
|
||||
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
|
||||
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
|
||||
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
|
||||
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
|
||||
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU=
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY=
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc=
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
|
||||
@@ -2197,12 +2186,6 @@ 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=
|
||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
|
||||
istio.io/api v0.0.0-20220512212136-561ffec82582 h1:AzLIET6ePAqxlWaXA6GOzapoRX1GRC6mZ8GY+cQIWYU=
|
||||
istio.io/api v0.0.0-20220512212136-561ffec82582/go.mod h1:8ZZgyVgYrHhsFQarEgTfPnMGpdgTDZbxSjYhdwTUuAQ=
|
||||
istio.io/client-go v1.14.0 h1:KKXMnxXx3U2866OP8FBYlJhjKdI3yIUQnt8L6hSzDHE=
|
||||
istio.io/client-go v1.14.0/go.mod h1:C7K0CKQlvY84yQKkZhxQbD1riqvnsgXJm3jF5GOmzNg=
|
||||
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e h1:z2WI3y55w0K3c6hmarcp5EcOiP4vVpTBXA8nYstP+cE=
|
||||
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e/go.mod h1:vJDAniIqryf/z///fgZqVPKJ7N2lBk7Gg8DCTB7oCfU=
|
||||
k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A=
|
||||
k8s.io/api v0.0.0-20190813020757-36bff7324fb7/go.mod h1:3Iy+myeAORNCLgjd/Xu9ebwN7Vh59Bw0vh9jhoX+V58=
|
||||
k8s.io/api v0.0.0-20191115095533-47f6de673b26/go.mod h1:iA/8arsvelvo4IDqIhX4IbjTEKBGgvsf2OraTuRtLFU=
|
||||
@@ -2210,7 +2193,6 @@ k8s.io/api v0.0.0-20191122220107-b5267f2975e0/go.mod h1:vYpRfxYkMrmPPSesoHEkGNHx
|
||||
k8s.io/api v0.17.5/go.mod h1:0zV5/ungglgy2Rlm3QK8fbxkXVs+BSJWpJP/+8gUVLY=
|
||||
k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78=
|
||||
k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA=
|
||||
k8s.io/api v0.18.6/go.mod h1:eeyxr+cwCjMdLAmr2W3RyDI0VvTawSg/3RFFBEnmZGI=
|
||||
k8s.io/api v0.22.1/go.mod h1:bh13rkTp3F1XEaLGykbyRD2QaTTzPm0e/BMd8ptFONY=
|
||||
k8s.io/api v0.23.0/go.mod h1:8wmDdLBHBNxtOIytwLstXt5E9PddnZb0GaMcqsvDBpg=
|
||||
k8s.io/api v0.24.0/go.mod h1:5Jl90IUrJHUJYEMANRURMiVvJ0g7Ax7r3R1bqO8zx8I=
|
||||
@@ -2218,7 +2200,6 @@ k8s.io/api v0.26.1/go.mod h1:xd/GBNgR0f707+ATNyPmQ1oyKSgndzXij81FzWGsejg=
|
||||
k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU=
|
||||
k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE=
|
||||
k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY=
|
||||
k8s.io/apiextensions-apiserver v0.18.6/go.mod h1:lv89S7fUysXjLZO7ke783xOwVTm6lKizADfvUM/SS/M=
|
||||
k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG40+GsWhKhAxY4=
|
||||
k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM=
|
||||
k8s.io/apiextensions-apiserver v0.26.3 h1:5PGMm3oEzdB1W/FTMgGIDmm100vn7IaUP5er36dB+YE=
|
||||
@@ -2230,7 +2211,6 @@ k8s.io/apimachinery v0.0.0-20191121175448-79c2a76c473a/go.mod h1:b9qmWdKlLuU9EBh
|
||||
k8s.io/apimachinery v0.17.5/go.mod h1:ioIo1G/a+uONV7Tv+ZmCbMG1/a3kVw5YcDdncd8ugQ0=
|
||||
k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA=
|
||||
k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
|
||||
k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
|
||||
k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0=
|
||||
k8s.io/apimachinery v0.23.0/go.mod h1:fFCTTBKvKcwTPFzjlcxp91uPFZr+JA0FubU4fLzzFYc=
|
||||
k8s.io/apimachinery v0.24.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
|
||||
@@ -2239,7 +2219,6 @@ k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k=
|
||||
k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
|
||||
k8s.io/apiserver v0.0.0-20191122221311-9d521947b1e1/go.mod h1:RbsZY5zzBIWnz4KbctZsTVjwIuOpTp4Z8oCgFHN4kZQ=
|
||||
k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw=
|
||||
k8s.io/apiserver v0.18.6/go.mod h1:Zt2XvTHuaZjBz6EFYzpp+X4hTmgWGy8AthNVnTdm3Wg=
|
||||
k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4=
|
||||
k8s.io/apiserver v0.26.1/go.mod h1:wr75z634Cv+sifswE9HlAo5FQ7UoUauIICRlOE+5dCg=
|
||||
k8s.io/apiserver v0.26.3 h1:blBpv+yOiozkPH2aqClhJmJY+rp53Tgfac4SKPDJnU4=
|
||||
@@ -2251,7 +2230,6 @@ k8s.io/client-go v0.0.0-20191122220542-ed16ecbdf3a0/go.mod h1:tyxNgOmR/Xi39HrlQ/
|
||||
k8s.io/client-go v0.17.5/go.mod h1:S8uZpBpjJJdEH/fEyxcqg7Rn0P5jH+ilkgBHjriSmNo=
|
||||
k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU=
|
||||
k8s.io/client-go v0.18.3/go.mod h1:4a/dpQEvzAhT1BbuWW09qvIaGw6Gbu1gZYiQZIi1DMw=
|
||||
k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q=
|
||||
k8s.io/client-go v0.22.1/go.mod h1:BquC5A4UOo4qVDUtoc04/+Nxp1MeHcVc1HJm1KmG8kk=
|
||||
k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA=
|
||||
k8s.io/client-go v0.24.0/go.mod h1:VFPQET+cAFpYxh6Bq6f4xyMY80G6jKKktU6G0m00VDw=
|
||||
@@ -2259,14 +2237,12 @@ k8s.io/client-go v0.26.1/go.mod h1:IWNSglg+rQ3OcvDkhY6+QLeasV4OYHDjdqeWkDQZwGE=
|
||||
k8s.io/client-go v0.26.3 h1:k1UY+KXfkxV2ScEL3gilKcF7761xkYsSD6BC9szIu8s=
|
||||
k8s.io/client-go v0.26.3/go.mod h1:ZPNu9lm8/dbRIPAgteN30RSXea6vrCpFvq+MateTUuQ=
|
||||
k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
|
||||
k8s.io/code-generator v0.18.6/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
|
||||
k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE=
|
||||
k8s.io/code-generator v0.24.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
|
||||
k8s.io/code-generator v0.26.1/go.mod h1:OMoJ5Dqx1wgaQzKgc+ZWaZPfGjdRq/Y3WubFrZmeI3I=
|
||||
k8s.io/code-generator v0.26.3/go.mod h1:ryaiIKwfxEJEaywEzx3dhWOydpVctKYbqLajJf0O8dI=
|
||||
k8s.io/component-base v0.0.0-20191122220729-2684fb322cb9/go.mod h1:NFuUusy/X4Tk21m21tcNUihnmp4OI7lXU7/xA+rYXkc=
|
||||
k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM=
|
||||
k8s.io/component-base v0.18.6/go.mod h1:knSVsibPR5K6EW2XOjEHik6sdU5nCvKMrzMt2D4In14=
|
||||
k8s.io/component-base v0.23.0/go.mod h1:DHH5uiFvLC1edCpvcTDV++NKULdYYU6pR9Tt3HIKMKI=
|
||||
k8s.io/component-base v0.24.0/go.mod h1:Dgazgon0i7KYUsS8krG8muGiMVtUZxG037l1MKyXgrA=
|
||||
k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU=
|
||||
@@ -2340,7 +2316,6 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 h1:PUuX1qIFv309A
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36/go.mod h1:WxjusMwXlKzfAs4p9km6XJRndVt2FROgMVCE4cdohFo=
|
||||
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221118041430-0a6394f6dda3 h1:dyxGc8BvxTtTdDEHKRqm6fbV+FIv/i4Bb0xM8fm1SAo=
|
||||
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221118041430-0a6394f6dda3/go.mod h1:HxSglExoUMNBtAqXUsvSLpMXPZglrY+iJ8UPsuQ2fas=
|
||||
sigs.k8s.io/controller-runtime v0.6.0/go.mod h1:CpYf5pdNY/B352A1TFLAS2JVSlnGQ5O2cftPHndTroo=
|
||||
sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
|
||||
sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA=
|
||||
sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0=
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCheckAddonName(t *testing.T) {
|
||||
@@ -50,7 +50,7 @@ func TestCheckAddonName(t *testing.T) {
|
||||
}
|
||||
for _, name := range validNames {
|
||||
err = CheckAddonName(name)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ func TestInitCmd_CreateScaffold(t *testing.T) {
|
||||
HelmChartName: "nginx",
|
||||
}
|
||||
err = cmd.CreateScaffold()
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll("with-helm")
|
||||
_, err = os.Stat(filepath.Join("with-helm", ResourcesDirName, "helm.cue"))
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// with ref-obj
|
||||
cmd = InitCmd{
|
||||
@@ -102,8 +102,8 @@ func TestInitCmd_CreateScaffold(t *testing.T) {
|
||||
assert.ErrorContains(t, err, "not a valid url")
|
||||
cmd.RefObjURLs[0] = "https://some.com"
|
||||
err = cmd.CreateScaffold()
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll("with-refobj")
|
||||
_, err = os.Stat(filepath.Join("with-refobj", ResourcesDirName, "from-url.cue"))
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"cuelang.org/go/cue/format"
|
||||
json2cue "cuelang.org/go/encoding/json"
|
||||
"github.com/crossplane/crossplane-runtime/pkg/fieldpath"
|
||||
"github.com/kubevela/pkg/util/slices"
|
||||
terraformapi "github.com/oam-dev/terraform-controller/api/v1beta2"
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -53,7 +54,6 @@ import (
|
||||
velaprocess "github.com/oam-dev/kubevela/pkg/cue/process"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
utilscommon "github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
|
||||
// constant error information
|
||||
@@ -959,7 +959,7 @@ func (af *Appfile) LoadDynamicComponent(ctx context.Context, cli client.Client,
|
||||
}
|
||||
// nolint
|
||||
for _, url := range spec.URLs {
|
||||
objs := utilscommon.FilterObjectsByCondition(af.ReferredObjects, func(obj *unstructured.Unstructured) bool {
|
||||
objs := slices.Filter(af.ReferredObjects, func(obj *unstructured.Unstructured) bool {
|
||||
return obj.GetAnnotations() != nil && obj.GetAnnotations()[oam.AnnotationResourceURL] == url
|
||||
})
|
||||
uns = component.AppendUnstructuredObjects(uns, objs...)
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/pkg/errors"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@@ -1188,17 +1188,17 @@ spec:
|
||||
|
||||
gotArtifacts := prepareArtifactsData(compManifests)
|
||||
gotWorkload, _, err := unstructured.NestedMap(gotArtifacts, "readyComp", "workload")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
diff := cmp.Diff(gotWorkload, map[string]interface{}{"fake": string("workload")})
|
||||
assert.Equal(t, diff, "")
|
||||
|
||||
_, gotIngress, err := unstructured.NestedMap(gotArtifacts, "readyComp", "traits", "ingress", "ingress")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
if !gotIngress {
|
||||
t.Fatalf("cannot get ingress trait")
|
||||
}
|
||||
_, gotSvc, err := unstructured.NestedMap(gotArtifacts, "readyComp", "traits", "ingress", "service")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
if !gotSvc {
|
||||
t.Fatalf("cannot get service trait")
|
||||
}
|
||||
@@ -1235,7 +1235,7 @@ func TestBaseGenerateComponent(t *testing.T) {
|
||||
inst := cuecontext.New().CompileString(base)
|
||||
bs, _ := model.NewBase(inst.Value())
|
||||
err := pContext.SetBase(bs)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
tr := &Trait{
|
||||
Name: traitName,
|
||||
engine: definition.NewTraitAbstractEngine(traitName, nil),
|
||||
@@ -1254,7 +1254,7 @@ if context.componentType == "stateless" {
|
||||
}
|
||||
wl := &Workload{Type: "stateful", Traits: []*Trait{tr}}
|
||||
cm, err := baseGenerateComponent(pContext, wl, appName, ns)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, cm.Traits[0].Object["kind"], "StatefulSet")
|
||||
assert.Equal(t, cm.Traits[0].Object["workflowName"], workflowName)
|
||||
assert.Equal(t, cm.Traits[0].Object["publishVersion"], publishVersion)
|
||||
|
||||
@@ -19,7 +19,7 @@ package build
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/builtin/registry"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/cue/model/value"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestContext(t *testing.T) {
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
cmdutil "github.com/oam-dev/kubevela/pkg/cmd/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/env"
|
||||
)
|
||||
|
||||
@@ -38,7 +37,6 @@ func GetNamespace(f Factory, cmd *cobra.Command) string {
|
||||
// ignore env if the command does not use the flag
|
||||
return ""
|
||||
}
|
||||
cmdutil.CheckErr(common.SetGlobalClient(f.Client()))
|
||||
var envMeta *types.EnvMeta
|
||||
if envName != "" {
|
||||
envMeta, err = env.GetEnvByName(envName)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/kubevela/pkg/util/slices"
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -40,7 +41,6 @@ import (
|
||||
"github.com/oam-dev/kubevela/pkg/features"
|
||||
"github.com/oam-dev/kubevela/pkg/multicluster"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
utilscommon "github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -182,7 +182,7 @@ func SelectRefObjectsForDispatch(ctx context.Context, cli client.Client, appNs s
|
||||
|
||||
// ReferredObjectsDelegatingClient delegate client get/list function by retrieving ref-objects from existing objects
|
||||
func ReferredObjectsDelegatingClient(cli client.Client, objs []*unstructured.Unstructured) client.Client {
|
||||
objs = utilscommon.FilterObjectsByCondition(objs, func(obj *unstructured.Unstructured) bool {
|
||||
objs = slices.Filter(objs, func(obj *unstructured.Unstructured) bool {
|
||||
return obj.GetAnnotations() == nil || obj.GetAnnotations()[oam.AnnotationResourceURL] == ""
|
||||
})
|
||||
return velaclient.DelegatingHandlerClient{
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
"github.com/magiconair/properties"
|
||||
"github.com/pelletier/go-toml"
|
||||
"gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/cue/model/value"
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetTerraformConfigurationFromRemote(t *testing.T) {
|
||||
@@ -107,9 +107,9 @@ variable "aaa" {
|
||||
tmpPath := filepath.Join(path, tc.args.name, tc.args.path)
|
||||
if len(tc.args.data) > 0 {
|
||||
err := os.MkdirAll(tmpPath, os.ModePerm)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
err = os.WriteFile(filepath.Clean(filepath.Join(tmpPath, tc.args.variableFile)), tc.args.data, 0644)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
defer os.RemoveAll(tmpPath)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
|
||||
"github.com/crossplane/crossplane-runtime/pkg/test"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
@@ -405,7 +405,7 @@ func TestGetGitSSHPublicKey(t *testing.T) {
|
||||
TJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==`)
|
||||
|
||||
pubKey, err := gitssh.NewPublicKeys("git", sshAuth[corev1.SSHAuthPrivateKey], "")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
k8sClient := fake.NewClientBuilder().Build()
|
||||
ctx := context.Background()
|
||||
@@ -419,7 +419,7 @@ func TestGetGitSSHPublicKey(t *testing.T) {
|
||||
Type: corev1.SecretTypeSSHAuth,
|
||||
}
|
||||
err = k8sClient.Create(ctx, &secret)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
secret = corev1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
@@ -431,7 +431,7 @@ func TestGetGitSSHPublicKey(t *testing.T) {
|
||||
},
|
||||
}
|
||||
err = k8sClient.Create(ctx, &secret)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
secret = corev1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
@@ -444,7 +444,7 @@ func TestGetGitSSHPublicKey(t *testing.T) {
|
||||
Type: corev1.SecretTypeSSHAuth,
|
||||
}
|
||||
err = k8sClient.Create(ctx, &secret)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
type args struct {
|
||||
k8sClient client.Client
|
||||
@@ -525,12 +525,12 @@ func TestGetGitSSHPublicKey(t *testing.T) {
|
||||
}
|
||||
|
||||
if tc.want.publicKey != nil {
|
||||
assert.DeepEqual(t, publicKey.Signer.PublicKey().Marshal(), tc.want.publicKey.Signer.PublicKey().Marshal())
|
||||
assert.DeepEqual(t, publicKey.User, tc.want.publicKey.User)
|
||||
assert.Equal(t, publicKey.Signer.PublicKey().Marshal(), tc.want.publicKey.Signer.PublicKey().Marshal())
|
||||
assert.Equal(t, publicKey.User, tc.want.publicKey.User)
|
||||
known_hosts_filepath := os.Getenv("SSH_KNOWN_HOSTS")
|
||||
known_hosts, err := os.ReadFile(known_hosts_filepath)
|
||||
assert.NilError(t, err)
|
||||
assert.DeepEqual(t, known_hosts, sshAuth[GitCredsKnownHosts])
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, known_hosts, sshAuth[GitCredsKnownHosts])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/cue/model"
|
||||
"github.com/kubevela/workflow/pkg/cue/model/value"
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/cue/process"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var templateScript = `
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
cueJson "cuelang.org/go/pkg/encoding/json"
|
||||
"github.com/bmizerany/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/cue/process"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metricsV1beta1api "k8s.io/metrics/pkg/apis/metrics/v1beta1"
|
||||
@@ -66,24 +66,24 @@ func TestRefresh(t *testing.T) {
|
||||
fakeClient.AddCluster(DisconnectedClusterName, disconnectedCluster)
|
||||
|
||||
mgr, err := NewClusterMetricsMgr(context.Background(), fakeClient, 15*time.Second)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = mgr.Refresh()
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
clusters, err := ListVirtualClusters(context.Background(), fakeClient)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, cluster := range clusters {
|
||||
assertClusterMetrics(t, &cluster)
|
||||
}
|
||||
|
||||
disCluster, err := GetVirtualCluster(context.Background(), fakeClient, DisconnectedClusterName)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assertClusterMetrics(t, disCluster)
|
||||
|
||||
norCluster, err := GetVirtualCluster(context.Background(), fakeClient, NormalClusterName)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assertClusterMetrics(t, norCluster)
|
||||
|
||||
exportMetrics(disCluster.Metrics, disCluster.Name)
|
||||
@@ -95,18 +95,18 @@ func assertClusterMetrics(t *testing.T, cluster *VirtualCluster) {
|
||||
switch cluster.Name {
|
||||
case DisconnectedClusterName:
|
||||
assert.Equal(t, metrics.IsConnected, false)
|
||||
assert.Assert(t, metrics.ClusterInfo == nil)
|
||||
assert.Assert(t, metrics.ClusterUsageMetrics == nil)
|
||||
assert.True(t, metrics.ClusterInfo == nil)
|
||||
assert.True(t, metrics.ClusterUsageMetrics == nil)
|
||||
case NormalClusterName:
|
||||
assert.Equal(t, metrics.IsConnected, true)
|
||||
|
||||
assert.Assert(t, resource.MustParse("15").Equal(metrics.ClusterInfo.CPUCapacity))
|
||||
assert.Assert(t, resource.MustParse(strconv.FormatInt(48*1024*1024*1024, 10)).Equal(metrics.ClusterInfo.MemoryCapacity))
|
||||
assert.Assert(t, resource.MustParse("15").Equal(metrics.ClusterInfo.CPUAllocatable))
|
||||
assert.Assert(t, resource.MustParse(strconv.FormatInt(48*1024*1024*1024, 10)).Equal(metrics.ClusterInfo.MemoryAllocatable))
|
||||
assert.True(t, resource.MustParse("15").Equal(metrics.ClusterInfo.CPUCapacity))
|
||||
assert.True(t, resource.MustParse(strconv.FormatInt(48*1024*1024*1024, 10)).Equal(metrics.ClusterInfo.MemoryCapacity))
|
||||
assert.True(t, resource.MustParse("15").Equal(metrics.ClusterInfo.CPUAllocatable))
|
||||
assert.True(t, resource.MustParse(strconv.FormatInt(48*1024*1024*1024, 10)).Equal(metrics.ClusterInfo.MemoryAllocatable))
|
||||
|
||||
assert.Assert(t, resource.MustParse("5").Equal(metrics.ClusterUsageMetrics.CPUUsage))
|
||||
assert.Assert(t, resource.MustParse(strconv.FormatInt(11*1024*1024*1024, 10)).Equal(metrics.ClusterUsageMetrics.MemoryUsage))
|
||||
assert.True(t, resource.MustParse("5").Equal(metrics.ClusterUsageMetrics.CPUUsage))
|
||||
assert.True(t, resource.MustParse(strconv.FormatInt(11*1024*1024*1024, 10)).Equal(metrics.ClusterUsageMetrics.MemoryUsage))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
assert2 "github.com/stretchr/testify/assert"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
@@ -75,11 +74,11 @@ func TestReplicateComponents(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
result, err := selectReplicateComponents(tc.Components, tc.Selectors)
|
||||
if tc.WantErr != nil {
|
||||
assert2.Error(t, err)
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(result), len(tc.Output))
|
||||
assert.DeepEqual(t, result, tc.Output)
|
||||
assert.Equal(t, result, tc.Output)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -156,11 +155,11 @@ func TestGetReplicationComponents(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
comps, err := ReplicateComponents(tc.Policies, tc.Components)
|
||||
if tc.WantErr != nil {
|
||||
assert2.Error(t, err)
|
||||
assert2.Contains(t, err.Error(), tc.WantErr.Error())
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), tc.WantErr.Error())
|
||||
} else {
|
||||
assert.NilError(t, err)
|
||||
assert.DeepEqual(t, comps, tc.WantComps)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, comps, tc.WantComps)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,33 +23,33 @@ import (
|
||||
"cuelang.org/go/cue/build"
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"cuelang.org/go/cue/parser"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/stdlib"
|
||||
)
|
||||
|
||||
func TestGetPackages(t *testing.T) {
|
||||
pkgs, err := getPackages()
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
cuectx := cuecontext.New()
|
||||
for path, content := range pkgs {
|
||||
file, err := parser.ParseFile(path, content)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
_ = cuectx.BuildFile(file)
|
||||
}
|
||||
|
||||
file, err := parser.ParseFile("-", `
|
||||
import "vela/custom"
|
||||
out: custom.context`)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
builder := &build.Instance{}
|
||||
err = builder.AddSyntax(file)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
err = stdlib.AddImportsFor(builder, "context: id: \"xxx\"")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
inst := cuectx.BuildInstance(builder)
|
||||
str, err := inst.LookupPath(cue.ParsePath("out.id")).String()
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, str, "xxx")
|
||||
}
|
||||
|
||||
+1
-104
@@ -36,14 +36,11 @@ import (
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"cuelang.org/go/encoding/openapi"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
cloudshellv1alpha1 "github.com/cloudtty/cloudtty/pkg/apis/cloudshell/v1alpha1"
|
||||
"github.com/hashicorp/hcl/v2/hclparse"
|
||||
"github.com/oam-dev/terraform-config-inspect/tfconfig"
|
||||
kruise "github.com/openkruise/kruise-api/apps/v1alpha1"
|
||||
kruisev1alpha1 "github.com/openkruise/rollouts/api/v1alpha1"
|
||||
certmanager "github.com/wonderflow/cert-manager-api/pkg/apis/certmanager/v1"
|
||||
yamlv3 "gopkg.in/yaml.v3"
|
||||
istioclientv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
@@ -61,14 +58,12 @@ import (
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/cue/model/value"
|
||||
"github.com/kubevela/workflow/pkg/cue/packages"
|
||||
clustergatewayapi "github.com/oam-dev/cluster-gateway/pkg/apis/cluster/v1alpha1"
|
||||
terraformapiv1 "github.com/oam-dev/terraform-controller/api/v1beta1"
|
||||
terraformapi "github.com/oam-dev/terraform-controller/api/v1beta2"
|
||||
|
||||
"github.com/kubevela/workflow/pkg/cue/packages"
|
||||
|
||||
oamcore "github.com/oam-dev/kubevela/apis/core.oam.dev"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
velacue "github.com/oam-dev/kubevela/pkg/cue"
|
||||
"github.com/oam-dev/kubevela/pkg/cue/process"
|
||||
@@ -89,13 +84,6 @@ var (
|
||||
forbidRedirectClient = &http.Client{CheckRedirect: forbidRedirectFunc}
|
||||
)
|
||||
|
||||
const (
|
||||
// AddonObservabilityApplication is the application name for Addon Observability
|
||||
AddonObservabilityApplication = "addon-observability"
|
||||
// AddonObservabilityGrafanaSvc is grafana service name for Addon Observability
|
||||
AddonObservabilityGrafanaSvc = "grafana"
|
||||
)
|
||||
|
||||
// CreateCustomNamespace display the create namespace message
|
||||
const CreateCustomNamespace = "create new namespace"
|
||||
|
||||
@@ -104,8 +92,6 @@ func init() {
|
||||
_ = apiregistrationv1.AddToScheme(Scheme)
|
||||
_ = crdv1.AddToScheme(Scheme)
|
||||
_ = oamcore.AddToScheme(Scheme)
|
||||
_ = istioclientv1beta1.AddToScheme(Scheme)
|
||||
_ = certmanager.AddToScheme(Scheme)
|
||||
_ = kruise.AddToScheme(Scheme)
|
||||
_ = terraformapi.AddToScheme(Scheme)
|
||||
_ = terraformapiv1.AddToScheme(Scheme)
|
||||
@@ -115,7 +101,6 @@ func init() {
|
||||
_ = clustergatewayapi.AddToScheme(Scheme)
|
||||
_ = metricsV1beta1api.AddToScheme(Scheme)
|
||||
_ = kruisev1alpha1.AddToScheme(Scheme)
|
||||
_ = cloudshellv1alpha1.AddToScheme(Scheme)
|
||||
_ = gatewayv1beta1.AddToScheme(Scheme)
|
||||
// +kubebuilder:scaffold:scheme
|
||||
}
|
||||
@@ -145,23 +130,6 @@ func InitBaseRestConfig() (Args, error) {
|
||||
return args, nil
|
||||
}
|
||||
|
||||
// globalClient will be a client for whole command lifecycle
|
||||
var globalClient client.Client
|
||||
|
||||
// SetGlobalClient will set a client for one cli command
|
||||
func SetGlobalClient(clt client.Client) error {
|
||||
globalClient = clt
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetClient will K8s client in args
|
||||
func GetClient() (client.Client, error) {
|
||||
if globalClient != nil {
|
||||
return globalClient, nil
|
||||
}
|
||||
return nil, errors.New("client not set, call SetGlobalClient first")
|
||||
}
|
||||
|
||||
// HTTPGetResponse use HTTP option and default client to send request and get raw response
|
||||
func HTTPGetResponse(ctx context.Context, url string, opts *HTTPOption) (*http.Response, error) {
|
||||
// Change NewRequest to NewRequestWithContext and pass context it
|
||||
@@ -362,44 +330,6 @@ func RealtimePrintCommandOutput(cmd *exec.Cmd, logFile string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResourceLocation indicates the resource location
|
||||
type ResourceLocation struct {
|
||||
Cluster string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
type clusterObjectReferenceFilter func(common.ClusterObjectReference) bool
|
||||
|
||||
var resourceNameClusterObjectReferenceFilter = func(resourceName []string) clusterObjectReferenceFilter {
|
||||
return func(reference common.ClusterObjectReference) bool {
|
||||
if len(resourceName) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, r := range resourceName {
|
||||
if r == reference.Name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func filterResource(inputs []common.ClusterObjectReference, filters ...clusterObjectReferenceFilter) (outputs []common.ClusterObjectReference) {
|
||||
for _, item := range inputs {
|
||||
flag := true
|
||||
for _, filter := range filters {
|
||||
if !filter(item) {
|
||||
flag = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if flag {
|
||||
outputs = append(outputs, item)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// AskToChooseOneNamespace ask for choose one namespace as env
|
||||
func AskToChooseOneNamespace(c client.Client, envMeta *types.EnvMeta) error {
|
||||
var nsList v1.NamespaceList
|
||||
@@ -436,29 +366,6 @@ func AskToChooseOneNamespace(c client.Client, envMeta *types.EnvMeta) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func filterClusterObjectRefFromAddonObservability(resources []common.ClusterObjectReference) []common.ClusterObjectReference {
|
||||
var observabilityResources []common.ClusterObjectReference
|
||||
for _, res := range resources {
|
||||
if res.Namespace == types.DefaultKubeVelaNS && res.Name == AddonObservabilityGrafanaSvc {
|
||||
res.Kind = "Service"
|
||||
res.APIVersion = "v1"
|
||||
observabilityResources = append(observabilityResources, res)
|
||||
}
|
||||
}
|
||||
resources = observabilityResources
|
||||
return resources
|
||||
}
|
||||
|
||||
func removeEmptyString(items []string) []string {
|
||||
r := []string{}
|
||||
for _, i := range items {
|
||||
if i != "" {
|
||||
r = append(r, i)
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// ReadYamlToObject will read a yaml K8s object to runtime.Object
|
||||
func ReadYamlToObject(path string, object k8sruntime.Object) error {
|
||||
data, err := os.ReadFile(filepath.Clean(path))
|
||||
@@ -526,13 +433,3 @@ func NewK8sClient() (client.Client, error) {
|
||||
}
|
||||
return k8sClient, nil
|
||||
}
|
||||
|
||||
// FilterObjectsByCondition filter object slices by condition function
|
||||
func FilterObjectsByCondition(objs []*unstructured.Unstructured, filter func(unstructured2 *unstructured.Unstructured) bool) (outs []*unstructured.Unstructured) {
|
||||
for _, obj := range objs {
|
||||
if filter(obj) {
|
||||
outs = append(outs, obj)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -36,10 +36,6 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/kubevela/workflow/pkg/cue/model/value"
|
||||
"github.com/stretchr/testify/assert"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
)
|
||||
|
||||
var ResponseString = "Hello HTTP Get."
|
||||
@@ -601,71 +597,6 @@ patch: {
|
||||
assert.NoError(t, filledVal.Err())
|
||||
}
|
||||
|
||||
func TestFilterClusterObjectRefFromAddonObservability(t *testing.T) {
|
||||
ref := common.ClusterObjectReference{}
|
||||
ref.Name = AddonObservabilityGrafanaSvc
|
||||
ref.Namespace = types.DefaultKubeVelaNS
|
||||
resources := []common.ClusterObjectReference{ref}
|
||||
|
||||
res := filterClusterObjectRefFromAddonObservability(resources)
|
||||
assert.Equal(t, 1, len(res))
|
||||
assert.Equal(t, "Service", res[0].Kind)
|
||||
assert.Equal(t, "v1", res[0].APIVersion)
|
||||
}
|
||||
|
||||
func TestResourceNameClusterObjectReferenceFilter(t *testing.T) {
|
||||
fooRef := common.ClusterObjectReference{
|
||||
ObjectReference: corev1.ObjectReference{
|
||||
Name: "foo",
|
||||
}}
|
||||
barRef := common.ClusterObjectReference{
|
||||
ObjectReference: corev1.ObjectReference{
|
||||
Name: "bar",
|
||||
}}
|
||||
bazRef := common.ClusterObjectReference{
|
||||
ObjectReference: corev1.ObjectReference{
|
||||
Name: "baz",
|
||||
}}
|
||||
var refs = []common.ClusterObjectReference{
|
||||
fooRef, barRef, bazRef,
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
caseName string
|
||||
filter clusterObjectReferenceFilter
|
||||
filteredRefs []common.ClusterObjectReference
|
||||
}{
|
||||
{
|
||||
caseName: "filter one resource",
|
||||
filter: resourceNameClusterObjectReferenceFilter([]string{"foo"}),
|
||||
filteredRefs: []common.ClusterObjectReference{fooRef},
|
||||
},
|
||||
{
|
||||
caseName: "not filter resources",
|
||||
filter: resourceNameClusterObjectReferenceFilter([]string{}),
|
||||
filteredRefs: []common.ClusterObjectReference{fooRef, barRef, bazRef},
|
||||
},
|
||||
{
|
||||
caseName: "filter multi resources",
|
||||
filter: resourceNameClusterObjectReferenceFilter([]string{"foo", "bar"}),
|
||||
filteredRefs: []common.ClusterObjectReference{fooRef, barRef},
|
||||
},
|
||||
}
|
||||
for _, c := range testCases {
|
||||
filteredResource := filterResource(refs, c.filter)
|
||||
assert.Equal(t, c.filteredRefs, filteredResource, c.caseName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveEmptyString(t *testing.T) {
|
||||
withEmpty := []string{"foo", "bar", "", "baz", ""}
|
||||
noEmpty := removeEmptyString(withEmpty)
|
||||
assert.Equal(t, len(noEmpty), 3)
|
||||
for _, s := range noEmpty {
|
||||
assert.NotEmpty(t, s)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTTPGetKubernetesObjects(t *testing.T) {
|
||||
_, err := HTTPGetKubernetesObjects(context.Background(), "invalid-url")
|
||||
assert.NotNil(t, err)
|
||||
|
||||
Vendored
+8
-29
@@ -24,6 +24,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/kubevela/pkg/util/singleton"
|
||||
"github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -40,10 +41,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// IndicatingLabel is label key indicating application is an env
|
||||
IndicatingLabel = "cli.env.oam.dev/name"
|
||||
// RawType is component type of raw
|
||||
RawType = "raw"
|
||||
// DefaultEnvNamespace is namespace of default env
|
||||
DefaultEnvNamespace = "default"
|
||||
)
|
||||
@@ -52,11 +49,8 @@ const (
|
||||
|
||||
// CreateEnv will create e env.
|
||||
// Because Env equals to namespace, one env should not be updated
|
||||
func CreateEnv(envArgs *types.EnvMeta) error {
|
||||
c, err := common.GetClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func CreateEnv(envArgs *types.EnvMeta) (err error) {
|
||||
c := singleton.KubeClient.Get()
|
||||
if envArgs.Namespace == "" {
|
||||
err = common.AskToChooseOneNamespace(c, envArgs)
|
||||
if err != nil {
|
||||
@@ -136,14 +130,11 @@ func ListEnvs(envName string) ([]*types.EnvMeta, error) {
|
||||
envList = append(envList, env)
|
||||
return envList, err
|
||||
}
|
||||
clt, err := common.GetClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clt := singleton.KubeClient.Get()
|
||||
|
||||
ctx := context.Background()
|
||||
var nsList v1.NamespaceList
|
||||
err = clt.List(ctx, &nsList, client.MatchingLabels{oam.LabelControlPlaneNamespaceUsage: oam.VelaNamespaceUsageEnv})
|
||||
err := clt.List(ctx, &nsList, client.MatchingLabels{oam.LabelControlPlaneNamespaceUsage: oam.VelaNamespaceUsageEnv})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -180,10 +171,7 @@ func DeleteEnv(envName string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
clt, err := common.GetClient()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
clt := singleton.KubeClient.Get()
|
||||
var appList v1beta1.ApplicationList
|
||||
err = clt.List(context.TODO(), &appList, client.InNamespace(envMeta.Namespace))
|
||||
if err != nil {
|
||||
@@ -247,13 +235,9 @@ func SetCurrentEnv(meta *types.EnvMeta) error {
|
||||
|
||||
// getEnvNamespaceByName get v1.Namespace object by env name
|
||||
func getEnvNamespaceByName(name string) (*v1.Namespace, error) {
|
||||
clt, err := common.GetClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx := context.Background()
|
||||
var nsList v1.NamespaceList
|
||||
err = clt.List(ctx, &nsList, client.MatchingLabels{oam.LabelNamespaceOfEnvName: name})
|
||||
err := singleton.KubeClient.Get().List(ctx, &nsList, client.MatchingLabels{oam.LabelNamespaceOfEnvName: name})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -266,11 +250,6 @@ func getEnvNamespaceByName(name string) (*v1.Namespace, error) {
|
||||
|
||||
// SetEnvLabels set labels for namespace
|
||||
func SetEnvLabels(envArgs *types.EnvMeta) error {
|
||||
c, err := common.GetClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
namespace, err := getEnvNamespaceByName(envArgs.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -282,7 +261,7 @@ func SetEnvLabels(envArgs *types.EnvMeta) error {
|
||||
|
||||
namespace.Labels = util.MergeMapOverrideWithDst(namespace.GetLabels(), labelsMap)
|
||||
|
||||
err = c.Update(context.Background(), namespace)
|
||||
err = singleton.KubeClient.Get().Update(context.Background(), namespace)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "fail to set env labelsMap")
|
||||
}
|
||||
|
||||
Vendored
+2
-3
@@ -23,6 +23,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/kubevela/pkg/util/singleton"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
@@ -31,7 +32,6 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/envtest"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
|
||||
var testEnv *envtest.Environment
|
||||
@@ -90,8 +90,7 @@ func TestCreateEnv(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := common.SetGlobalClient(rawClient)
|
||||
assert.NoError(t, err)
|
||||
singleton.KubeClient.Set(rawClient)
|
||||
err = CreateEnv(tc.envMeta)
|
||||
if err != nil && cmp.Diff(tc.want.data, err.Error()) != "" {
|
||||
t.Errorf("CreateEnv(...): \n -want: \n%s,\n +got:\n%s", tc.want.data, err.Error())
|
||||
|
||||
@@ -21,29 +21,29 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsEmptyDir(t *testing.T) {
|
||||
// Test with an empty dir
|
||||
err := os.Mkdir("testdir", 0750)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
defer func() {
|
||||
_ = os.RemoveAll("testdir")
|
||||
}()
|
||||
isEmptyDir, err := IsEmptyDir("testdir")
|
||||
assert.Equal(t, isEmptyDir, true)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
// Test with a file
|
||||
err = os.WriteFile(filepath.Join("testdir", "testfile"), []byte("test"), 0644)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
isEmptyDir, err = IsEmptyDir(filepath.Join("testdir", "testfile"))
|
||||
assert.Equal(t, isEmptyDir, false)
|
||||
assert.Equal(t, err != nil, true)
|
||||
// Test with a non-empty dir
|
||||
isEmptyDir, err = IsEmptyDir("testdir")
|
||||
assert.Equal(t, isEmptyDir, false)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestGetFilenameFromLocalOrRemote(t *testing.T) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package filters
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -119,21 +119,21 @@ func TestByAppliedWorkload(t *testing.T) {
|
||||
trait := v1beta1.TraitDefinition{}
|
||||
trait.Spec.AppliesToWorkloads = []string{"*"}
|
||||
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&trait)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, true, f(unstructured.Unstructured{Object: u}))
|
||||
|
||||
// Test with AppliesToWorkloads=workload
|
||||
trait = v1beta1.TraitDefinition{}
|
||||
trait.Spec.AppliesToWorkloads = []string{"workload"}
|
||||
u, err = runtime.DefaultUnstructuredConverter.ToUnstructured(&trait)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, true, f(unstructured.Unstructured{Object: u}))
|
||||
|
||||
// Test with AppliesToWorkloads=wrong
|
||||
trait = v1beta1.TraitDefinition{}
|
||||
trait.Spec.AppliesToWorkloads = []string{"wrong"}
|
||||
u, err = runtime.DefaultUnstructuredConverter.ToUnstructured(&trait)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, false, f(unstructured.Unstructured{Object: u}))
|
||||
|
||||
// Test not a definition
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/crossplane/crossplane-runtime/pkg/test"
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
@@ -52,13 +52,13 @@ func TestLoad(t *testing.T) {
|
||||
loader := NewWorkflowStepTemplateLoader(cli)
|
||||
|
||||
tmpl, err := loader.LoadTemplate(context.Background(), "builtin-apply-component")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
expected, err := os.ReadFile("./static/builtin-apply-component.cue")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, tmpl, string(expected))
|
||||
|
||||
tmpl, err = loader.LoadTemplate(context.Background(), "apply-oam-component")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, tmpl, `import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
+6
-21
@@ -19,7 +19,7 @@ package cli
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/kubevela/pkg/util/singleton"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
@@ -59,10 +59,7 @@ func NewEnvListCommand(c common.Args, ioStream cmdutil.IOStreams) *cobra.Command
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = common.SetGlobalClient(clt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
singleton.KubeClient.Set(clt)
|
||||
return ListEnvs(args, ioStream)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
@@ -87,10 +84,7 @@ func NewEnvInitCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Comman
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = common.SetGlobalClient(clt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
singleton.KubeClient.Set(clt)
|
||||
return CreateEnv(&envArgs, args, ioStreams)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
@@ -115,10 +109,7 @@ func NewEnvDeleteCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Comm
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = common.SetGlobalClient(clt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
singleton.KubeClient.Set(clt)
|
||||
return DeleteEnv(args, ioStreams)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
@@ -144,10 +135,7 @@ func NewEnvSetCommand(c common.Args, ioStreams cmdutil.IOStreams) *cobra.Command
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = common.SetGlobalClient(clt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
singleton.KubeClient.Set(clt)
|
||||
return SetEnv(&envArgs, args, ioStreams)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
@@ -236,10 +224,7 @@ func GetFlagEnvOrCurrent(cmd *cobra.Command, args common.Args) (*types.EnvMeta,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = common.SetGlobalClient(clt)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get flag env fail")
|
||||
}
|
||||
singleton.KubeClient.Set(clt)
|
||||
var envName string
|
||||
if cmd != nil {
|
||||
envName = cmd.Flag("env").Value.String()
|
||||
|
||||
@@ -20,9 +20,9 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/bmizerany/assert"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestClusterList_ToTableBody(t *testing.T) {
|
||||
|
||||
@@ -21,40 +21,17 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
util2 "github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
common2 "github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
"github.com/oam-dev/kubevela/references/common"
|
||||
)
|
||||
|
||||
func TestTraitsAppliedToAllWorkloads(t *testing.T) {
|
||||
trait := types.Capability{
|
||||
Name: "route",
|
||||
CrdName: "routes.oam.dev",
|
||||
AppliesTo: []string{"*"},
|
||||
}
|
||||
workloads := []types.Capability{
|
||||
{
|
||||
Name: "deployment",
|
||||
CrdName: "deployments.apps",
|
||||
},
|
||||
{
|
||||
Name: "clonset",
|
||||
CrdName: "clonsets.alibaba",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, []string{"*"}, common.ConvertApplyTo(trait.AppliesTo, workloads))
|
||||
}
|
||||
|
||||
var _ = Describe("Test trait cli", func() {
|
||||
|
||||
When("there are container-image and configmap traits", func() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
|
||||
@@ -18,13 +18,10 @@ package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
plur "github.com/gertd/go-pluralize"
|
||||
client2 "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
@@ -51,55 +48,3 @@ func ListRawWorkloadDefinitions(userNamespace string, c common.Args) ([]v1beta1.
|
||||
}
|
||||
return append(workloadList.Items, sysWorkloadList.Items...), nil
|
||||
}
|
||||
|
||||
// ConvertApplyTo will convert applyTo slice to workload capability name if CRD matches
|
||||
func ConvertApplyTo(applyTo []string, workloads []types.Capability) []string {
|
||||
var converted []string
|
||||
if in(applyTo, "*") {
|
||||
converted = append(converted, "*")
|
||||
} else {
|
||||
for _, v := range applyTo {
|
||||
newName, exist := check(v, workloads)
|
||||
if !exist {
|
||||
continue
|
||||
}
|
||||
if !in(converted, newName) {
|
||||
converted = append(converted, newName)
|
||||
}
|
||||
}
|
||||
}
|
||||
return converted
|
||||
}
|
||||
|
||||
func check(applyto string, workloads []types.Capability) (string, bool) {
|
||||
for _, v := range workloads {
|
||||
if Parse(applyto) == v.CrdName || Parse(applyto) == v.Name {
|
||||
return v.Name, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
func in(l []string, v string) bool {
|
||||
for _, ll := range l {
|
||||
if ll == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Parse will parse applyTo(with format Group/Version.Kind) to crd name by just calculate the plural of kind word.
|
||||
// TODO we should use discoverymapper instead of calculate plural
|
||||
func Parse(applyTo string) string {
|
||||
l := strings.Split(applyTo, "/")
|
||||
if len(l) != 2 {
|
||||
return applyTo
|
||||
}
|
||||
apigroup, versionKind := l[0], l[1]
|
||||
l = strings.Split(versionKind, ".")
|
||||
if len(l) != 2 {
|
||||
return applyTo
|
||||
}
|
||||
return plur.NewClient().Plural(strings.ToLower(l[1])) + "." + apigroup
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user