Skip to content

Commit 1210c41

Browse files
committed
refactor: kubectl kcl apply function
Signed-off-by: peefy <[email protected]>
1 parent 187f40c commit 1210c41

File tree

8 files changed

+183
-499
lines changed

8 files changed

+183
-499
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.0
1+
0.9.0

cmd/apply.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"github.com/spf13/cobra"
5+
"kcl-lang.io/kubectl-kcl/pkg/kube"
56
"kcl-lang.io/kubectl-kcl/pkg/options"
67
)
78

@@ -26,5 +27,6 @@ func NewApplyCmd() *cobra.Command {
2627
f.StringVarP(&o.Namespace, "namespace", "n", "default", "kubernetes namespace default is the default namespace ")
2728
f.StringVarP(&o.Selector, "selector", "l", "", "Selector (label query) to filter on.(e.g. -l key1=value1,key2=value2)")
2829
f.StringVarP(&o.FieldSelector, "field-selector", "", "", "Selector (field query) to filter on.(e.g. --field-selector key1=value1,key2=value2)")
30+
kube.AddKubeConfigFlags(cmd)
2931
return cmd
3032
}

go.mod

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module kcl-lang.io/kubectl-kcl
22

3-
go 1.22
3+
go 1.22.1
44

55
require (
66
github.com/spf13/cobra v1.8.1
77
go.uber.org/zap v1.27.0
8-
k8s.io/apimachinery v0.28.3
9-
k8s.io/cli-runtime v0.28.1
10-
k8s.io/kubectl v0.28.1
8+
k8s.io/cli-runtime v0.30.2
119
kcl-lang.io/kcl-go v0.9.1
12-
kcl-lang.io/krm-kcl v0.9.1
10+
kcl-lang.io/krm-kcl v0.9.2-0.20240712054726-a90738c67ae2
1311
)
1412

1513
require (
@@ -19,17 +17,19 @@ require (
1917
cloud.google.com/go/storage v1.38.0 // indirect
2018
dario.cat/mergo v1.0.0 // indirect
2119
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
22-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
20+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
2321
github.com/BurntSushi/toml v1.4.0 // indirect
2422
github.com/Microsoft/go-winio v0.6.2 // indirect
2523
github.com/Microsoft/hcsshim v0.12.3 // indirect
2624
github.com/ProtonMail/go-crypto v1.0.0 // indirect
2725
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
26+
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
2827
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
29-
github.com/aws/aws-sdk-go v1.44.122 // indirect
28+
github.com/aws/aws-sdk-go v1.48.6 // indirect
3029
github.com/bahlo/generic-list-go v0.2.0 // indirect
3130
github.com/beorn7/perks v1.0.1 // indirect
3231
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
32+
github.com/blang/semver/v4 v4.0.0 // indirect
3333
github.com/buger/jsonparser v1.1.1 // indirect
3434
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3535
github.com/chai2010/jsonv v1.1.3 // indirect
@@ -54,14 +54,14 @@ require (
5454
github.com/docker/go-units v0.5.0 // indirect
5555
github.com/dominikbraun/graph v0.23.0 // indirect
5656
github.com/elliotchance/orderedmap/v2 v2.2.0 // indirect
57-
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
57+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
5858
github.com/emicklei/proto v1.13.2 // indirect
5959
github.com/emirpasic/gods v1.18.1 // indirect
60-
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
60+
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
6161
github.com/fatih/color v1.17.0 // indirect
6262
github.com/felixge/httpsnoop v1.0.4 // indirect
6363
github.com/getkin/kin-openapi v0.125.0 // indirect
64-
github.com/go-errors/errors v1.4.2 // indirect
64+
github.com/go-errors/errors v1.5.1 // indirect
6565
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
6666
github.com/go-git/go-billy/v5 v5.5.0 // indirect
6767
github.com/go-git/go-git/v5 v5.12.0 // indirect
@@ -85,8 +85,8 @@ require (
8585
github.com/golang/protobuf v1.5.4 // indirect
8686
github.com/golang/snappy v0.0.4 // indirect
8787
github.com/google/btree v1.0.1 // indirect
88+
github.com/google/cel-go v0.17.8 // indirect
8889
github.com/google/gnostic-models v0.6.8 // indirect
89-
github.com/google/go-cmp v0.6.0 // indirect
9090
github.com/google/gofuzz v1.2.0 // indirect
9191
github.com/google/s2a-go v0.1.7 // indirect
9292
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
@@ -100,7 +100,7 @@ require (
100100
github.com/hashicorp/go-safetemp v1.0.0 // indirect
101101
github.com/hashicorp/go-version v1.7.0 // indirect
102102
github.com/iancoleman/strcase v0.3.0 // indirect
103-
github.com/imdario/mergo v0.3.13 // indirect
103+
github.com/imdario/mergo v0.3.16 // indirect
104104
github.com/inconshreveable/mousetrap v1.1.0 // indirect
105105
github.com/invopop/yaml v0.2.0 // indirect
106106
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -151,6 +151,7 @@ require (
151151
github.com/sirupsen/logrus v1.9.3 // indirect
152152
github.com/skeema/knownhosts v1.2.2 // indirect
153153
github.com/spf13/pflag v1.0.5 // indirect
154+
github.com/stoewer/go-strcase v1.2.0 // indirect
154155
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
155156
github.com/thoas/go-funk v0.9.3 // indirect
156157
github.com/ulikunitz/xz v0.5.12 // indirect
@@ -166,7 +167,7 @@ require (
166167
go.opentelemetry.io/otel/metric v1.24.0 // indirect
167168
go.opentelemetry.io/otel/trace v1.24.0 // indirect
168169
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
169-
go.uber.org/multierr v1.10.0 // indirect
170+
go.uber.org/multierr v1.11.0 // indirect
170171
golang.org/x/crypto v0.24.0 // indirect
171172
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
172173
golang.org/x/mod v0.18.0 // indirect
@@ -185,25 +186,30 @@ require (
185186
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
186187
google.golang.org/grpc v1.64.0 // indirect
187188
google.golang.org/protobuf v1.34.2 // indirect
189+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
188190
gopkg.in/inf.v0 v0.9.1 // indirect
189191
gopkg.in/warnings.v0 v0.1.2 // indirect
190192
gopkg.in/yaml.v2 v2.4.0 // indirect
191193
gopkg.in/yaml.v3 v3.0.1 // indirect
192-
k8s.io/api v0.28.3 // indirect
193-
k8s.io/apiextensions-apiserver v0.24.1 // indirect
194-
k8s.io/client-go v0.28.3 // indirect
195-
k8s.io/klog/v2 v2.100.1 // indirect
196-
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
197-
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
194+
k8s.io/api v0.30.2 // indirect
195+
k8s.io/apiextensions-apiserver v0.30.1 // indirect
196+
k8s.io/apimachinery v0.30.2 // indirect
197+
k8s.io/apiserver v0.30.1 // indirect
198+
k8s.io/client-go v0.30.2 // indirect
199+
k8s.io/component-base v0.30.1 // indirect
200+
k8s.io/klog/v2 v2.120.1 // indirect
201+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
202+
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
198203
kcl-lang.io/cli v0.9.1 // indirect
199204
kcl-lang.io/kcl-openapi v0.6.3 // indirect
200205
kcl-lang.io/kpm v0.9.0 // indirect
201206
kcl-lang.io/lib v0.9.1 // indirect
202207
oras.land/oras-go v1.2.5 // indirect
203208
oras.land/oras-go/v2 v2.5.0 // indirect
209+
sigs.k8s.io/controller-runtime v0.18.4 // indirect
204210
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
205-
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
206-
sigs.k8s.io/kustomize/kyaml v0.16.0 // indirect
207-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
211+
sigs.k8s.io/kustomize/api v0.17.1 // indirect
212+
sigs.k8s.io/kustomize/kyaml v0.17.0 // indirect
213+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
208214
sigs.k8s.io/yaml v1.4.0 // indirect
209215
)

0 commit comments

Comments
 (0)