Skip to content

Commit 9754bb7

Browse files
author
NETIZEN-11
committed
Fix Kubernetes dependencies and render status implementation
- Update k8s.io/apiextensions-apiserver from v0.34.1 to v0.35.0 - Add yaml tags to RenderStatus, PipelineStepResult, and ResultItem structs - Fix result classification logic to use severity instead of ExitCode - Fix YAML test input to use proper multiline format - Run go mod tidy to normalize dependencies All changes maintain Go formatting and project coding style.
1 parent 0cad1cb commit 9754bb7

5 files changed

Lines changed: 28 additions & 54 deletions

File tree

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
gopkg.in/yaml.v2 v2.4.0
2727
gotest.tools v2.2.0+incompatible
2828
k8s.io/api v0.35.0
29-
k8s.io/apiextensions-apiserver v0.34.1
29+
k8s.io/apiextensions-apiserver v0.35.0
3030
k8s.io/apimachinery v0.35.0
3131
k8s.io/cli-runtime v0.35.0
3232
k8s.io/client-go v0.35.0
@@ -75,7 +75,6 @@ require (
7575
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
7676
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
7777
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
78-
github.com/gogo/protobuf v1.3.2 // indirect
7978
github.com/google/btree v1.1.3 // indirect
8079
github.com/google/gnostic-models v0.7.0 // indirect
8180
github.com/google/uuid v1.6.0 // indirect

go.sum

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ github.com/go-openapi/swag/yamlutils v0.25.1 h1:mry5ez8joJwzvMbaTGLhw8pXUnhDK91o
8383
github.com/go-openapi/swag/yamlutils v0.25.1/go.mod h1:cm9ywbzncy3y6uPm/97ysW8+wZ09qsks+9RS8fLWKqg=
8484
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
8585
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
86-
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
87-
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
8886
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
8987
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
9088
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
@@ -108,8 +106,6 @@ github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbd
108106
github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60=
109107
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
110108
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
111-
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
112-
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
113109
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
114110
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
115111
github.com/kptdev/krm-functions-catalog/functions/go/apply-setters v0.2.4 h1:qB0Az/M+qo31s5RD3YXV0bUkTKZ3I19Kdji42cFSPHY=
@@ -212,8 +208,6 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
212208
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
213209
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
214210
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
215-
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
216-
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
217211
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
218212
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
219213
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
@@ -228,51 +222,26 @@ go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
228222
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
229223
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
230224
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
231-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
232-
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
233-
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
234-
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
235-
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
236225
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
237226
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
238-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
239-
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
240-
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
241-
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
242227
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
243228
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
244229
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
245230
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
246-
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
247-
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
248-
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
249231
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
250232
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
251-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
252-
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
253-
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
254233
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
255234
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
256235
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
257236
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
258237
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
259238
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
260-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
261-
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
262239
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
263240
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
264241
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
265242
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
266-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
267-
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
268-
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
269-
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
270243
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
271244
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
272-
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
273-
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
274-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
275-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
276245
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
277246
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
278247
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -295,8 +264,8 @@ gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
295264
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
296265
k8s.io/api v0.35.0 h1:iBAU5LTyBI9vw3L5glmat1njFK34srdLmktWwLTprlY=
297266
k8s.io/api v0.35.0/go.mod h1:AQ0SNTzm4ZAczM03QH42c7l3bih1TbAXYo0DkF8ktnA=
298-
k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI=
299-
k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc=
267+
k8s.io/apiextensions-apiserver v0.35.0 h1:3xHk2rTOdWXXJM+RDQZJvdx0yEOgC0FgQ1PlJatA5T4=
268+
k8s.io/apiextensions-apiserver v0.35.0/go.mod h1:E1Ahk9SADaLQ4qtzYFkwUqusXTcaV2uw3l14aqpL2LU=
300269
k8s.io/apimachinery v0.35.0 h1:Z2L3IHvPVv/MJ7xRxHEtk6GoJElaAqDCCU0S6ncYok8=
301270
k8s.io/apimachinery v0.35.0/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
302271
k8s.io/cli-runtime v0.35.0 h1:PEJtYS/Zr4p20PfZSLCbY6YvaoLrfByd6THQzPworUE=

internal/util/render/executor.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func createResultItem(resource *yaml.RNode, message, severity string) kptfilev1.
379379

380380
// extractResultsFromFnResults extracts and categorizes results from function execution.
381381
// It processes framework.Results and converts them to ResultItem instances,
382-
// separating successful results from error results based on exit codes.
382+
// separating successful results from error results based on severity.
383383
func extractResultsFromFnResults(fnResults *fnresult.ResultList) ([]kptfilev1.ResultItem, []kptfilev1.ResultItem) {
384384
var results []kptfilev1.ResultItem
385385
var errorResults []kptfilev1.ResultItem
@@ -405,10 +405,11 @@ func extractResultsFromFnResults(fnResults *fnresult.ResultList) ([]kptfilev1.Re
405405

406406
resultItem := createResultItem(nil, message, severity)
407407

408-
if item.ExitCode == 0 {
409-
results = append(results, resultItem)
410-
} else {
408+
// Classify based on severity instead of ExitCode
409+
if severity == "error" {
411410
errorResults = append(errorResults, resultItem)
411+
} else {
412+
results = append(results, resultItem)
412413
}
413414
}
414415
}

internal/util/render/executor_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,12 @@ func TestCreateResultItem(t *testing.T) {
812812
assert.Empty(t, result.Resource)
813813

814814
// Test with resource
815-
resource := yaml.MustParse(`apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: test`)
815+
resource := yaml.MustParse(`
816+
apiVersion: v1
817+
kind: ConfigMap
818+
metadata:
819+
name: test
820+
`)
816821
resultWithResource := createResultItem(resource, "resource processed", "info")
817822
assert.Equal(t, "resource processed", resultWithResource.Message)
818823
assert.Equal(t, "info", resultWithResource.Severity)

pkg/api/kptfile/v1/types.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -476,50 +476,50 @@ func ToCondition(value string) ConditionStatus {
476476
// RenderStatus contains detailed information about pipeline execution results
477477
type RenderStatus struct {
478478
// MutationSteps contains results from mutation pipeline functions
479-
MutationSteps []PipelineStepResult `json:"mutationSteps,omitempty"`
479+
MutationSteps []PipelineStepResult `yaml:"mutationSteps,omitempty" json:"mutationSteps,omitempty"`
480480

481481
// ValidationSteps contains results from validation pipeline functions
482-
ValidationSteps []PipelineStepResult `json:"validationSteps,omitempty"`
482+
ValidationSteps []PipelineStepResult `yaml:"validationSteps,omitempty" json:"validationSteps,omitempty"`
483483

484484
// ErrorSummary provides a consolidated summary of all errors
485-
ErrorSummary string `json:"errorSummary,omitempty"`
485+
ErrorSummary string `yaml:"errorSummary,omitempty" json:"errorSummary,omitempty"`
486486
}
487487

488488
// PipelineStepResult contains the result of executing a single pipeline step
489489
type PipelineStepResult struct {
490490
// Name is the name of the function step
491-
Name string `json:"name,omitempty"`
491+
Name string `yaml:"name,omitempty" json:"name,omitempty"`
492492

493493
// Image is the container image that was executed
494-
Image string `json:"image,omitempty"`
494+
Image string `yaml:"image,omitempty" json:"image,omitempty"`
495495

496496
// ExecPath is the executable path that was run
497-
ExecPath string `json:"execPath,omitempty"`
497+
ExecPath string `yaml:"execPath,omitempty" json:"execPath,omitempty"`
498498

499499
// ExecutionError captures execution failures like network errors, missing images, etc.
500-
ExecutionError string `json:"executionError,omitempty"`
500+
ExecutionError string `yaml:"executionError,omitempty" json:"executionError,omitempty"`
501501

502502
// Stderr contains the standard error output from the function execution
503-
Stderr string `json:"stderr,omitempty"`
503+
Stderr string `yaml:"stderr,omitempty" json:"stderr,omitempty"`
504504

505505
// ExitCode is the exit code returned by the function
506-
ExitCode int `json:"exitCode"`
506+
ExitCode int `yaml:"exitCode" json:"exitCode"`
507507

508508
// Results contains successful results from the function
509-
Results []ResultItem `json:"results,omitempty"`
509+
Results []ResultItem `yaml:"results,omitempty" json:"results,omitempty"`
510510

511511
// ErrorResults contains error results from the function
512-
ErrorResults []ResultItem `json:"errorResults,omitempty"`
512+
ErrorResults []ResultItem `yaml:"errorResults,omitempty" json:"errorResults,omitempty"`
513513
}
514514

515515
// ResultItem represents a single result item from a function execution
516516
type ResultItem struct {
517517
// Resource is the KRM resource that was processed (serialized as YAML string)
518-
Resource string `json:"resource,omitempty"`
518+
Resource string `yaml:"resource,omitempty" json:"resource,omitempty"`
519519

520520
// Message contains details about the result
521-
Message string `json:"message,omitempty"`
521+
Message string `yaml:"message,omitempty" json:"message,omitempty"`
522522

523523
// Severity indicates the severity level of the result (error, warning, info)
524-
Severity string `json:"severity,omitempty"`
524+
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
525525
}

0 commit comments

Comments
 (0)