Skip to content

Commit

Permalink
feat: add gvk to both definitions status, upgrade deps (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasepe authored Apr 9, 2024
1 parent a0ca2ff commit 8eef9fb
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 255 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.idea/**/vcs.xml

## VSCode
.vscode/
#.vscode/

## File-based project format:
*.iws
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"go.buildFlags": [
"-tags=unit,integration"
],
"go.testTags": "unit,integration",
}
17 changes: 11 additions & 6 deletions apis/compositiondefinitions/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ type CompositionDefinitionSpec struct {
type CompositionDefinitionStatus struct {
rtv1.ManagedStatus `json:",inline"`

// Resource: the generated custom resource
// APIVersion: the generated custom resource API version
// +optional
Resource string `json:"resource,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`

// Kind: the generated custom resource Kind
// +optional
Kind string `json:"kind,omitempty"`

// PackageURL: .tgz or oci chart direct url
// +optional
Expand All @@ -53,11 +57,12 @@ type CompositionDefinitionStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced,categories={krateo,definition,core}
//+kubebuilder:printcolumn:name="RESOURCE",type="string",JSONPath=".status.resource"
//+kubebuilder:resource:scope=Namespaced,categories={krateo,defs,core}
//+kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
//+kubebuilder:printcolumn:name="PACKAGE URL",type="string",JSONPath=".status.packageUrl"
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",priority=10
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
//+kubebuilder:printcolumn:name="API VERSION",type="string",JSONPath=".status.apiVersion",priority=10
//+kubebuilder:printcolumn:name="KIND",type="string",JSONPath=".status.kind",priority=10
//+kubebuilder:printcolumn:name="PACKAGE URL",type="string",JSONPath=".status.packageUrl",priority=10

// CompositionDefinition is a definition type with a spec and a status.
type CompositionDefinition struct {
Expand Down
15 changes: 10 additions & 5 deletions apis/schemadefinitions/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ type SchemaDefinitionSpec struct {
type SchemaDefinitionStatus struct {
rtv1.ManagedStatus `json:",inline"`

// Resource: the generated custom resource
// APIVersion: the generated custom resource API version
// +optional
Resource string `json:"resource,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`

// Kind: the generated custom resource Kind
// +optional
Kind string `json:"kind,omitempty"`

// Digest: schema digest
// +optional
Expand All @@ -43,10 +47,11 @@ type SchemaDefinitionStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Namespaced,categories={krateo,definition,core}
//+kubebuilder:printcolumn:name="RESOURCE",type="string",JSONPath=".status.resource"
//+kubebuilder:resource:scope=Namespaced,categories={krateo,defs,core}
//+kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",priority=10
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
//+kubebuilder:printcolumn:name="API VERSION",type="string",JSONPath=".status.apiVersion",priority=10
//+kubebuilder:printcolumn:name="KIND",type="string",JSONPath=".status.kind",priority=10

// SchemaDefinition is a definition type with a spec and a status.
type SchemaDefinition struct {
Expand Down
30 changes: 19 additions & 11 deletions crds/core.krateo.io_compositiondefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
names:
categories:
- krateo
- definition
- defs
- core
kind: CompositionDefinition
listKind: CompositionDefinitionList
Expand All @@ -19,19 +19,24 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.resource
name: RESOURCE
type: string
- jsonPath: .status.conditions[?(@.type=='Ready')].status
name: READY
type: string
- jsonPath: .status.packageUrl
name: PACKAGE URL
type: string
- jsonPath: .metadata.creationTimestamp
name: AGE
priority: 10
type: date
- jsonPath: .status.apiVersion
name: API VERSION
priority: 10
type: string
- jsonPath: .status.kind
name: KIND
priority: 10
type: string
- jsonPath: .status.packageUrl
name: PACKAGE URL
priority: 10
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -98,6 +103,9 @@ spec:
status:
description: CompositionDefinitionStatus is the status of a CompositionDefinition.
properties:
apiVersion:
description: 'APIVersion: the generated custom resource API version'
type: string
conditions:
description: Conditions of the resource.
items:
Expand Down Expand Up @@ -134,12 +142,12 @@ spec:
- type
type: object
type: array
kind:
description: 'Kind: the generated custom resource Kind'
type: string
packageUrl:
description: 'PackageURL: .tgz or oci chart direct url'
type: string
resource:
description: 'Resource: the generated custom resource'
type: string
type: object
type: object
served: true
Expand Down
21 changes: 14 additions & 7 deletions crds/core.krateo.io_schemadefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
names:
categories:
- krateo
- definition
- defs
- core
kind: SchemaDefinition
listKind: SchemaDefinitionList
Expand All @@ -19,16 +19,20 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.resource
name: RESOURCE
type: string
- jsonPath: .status.conditions[?(@.type=='Ready')].status
name: READY
type: string
- jsonPath: .metadata.creationTimestamp
name: AGE
priority: 10
type: date
- jsonPath: .status.apiVersion
name: API VERSION
priority: 10
type: string
- jsonPath: .status.kind
name: KIND
priority: 10
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -87,6 +91,9 @@ spec:
status:
description: SchemaDefinitionStatus is the status of a Definition.
properties:
apiVersion:
description: 'APIVersion: the generated custom resource API version'
type: string
conditions:
description: Conditions of the resource.
items:
Expand Down Expand Up @@ -126,8 +133,8 @@ spec:
digest:
description: 'Digest: schema digest'
type: string
resource:
description: 'Resource: the generated custom resource'
kind:
description: 'Kind: the generated custom resource Kind'
type: string
type: object
type: object
Expand Down
95 changes: 47 additions & 48 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ require (
github.com/pkg/errors v0.9.1
github.com/stoewer/go-strcase v1.3.0
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.14.0
k8s.io/api v0.29.1
k8s.io/apiextensions-apiserver v0.29.1
k8s.io/apimachinery v0.29.2
k8s.io/client-go v0.29.1
k8s.io/gengo v0.0.0-20240129211411-f967bbeff4b4
sigs.k8s.io/controller-runtime v0.17.0
helm.sh/helm/v3 v3.14.3
k8s.io/api v0.29.3
k8s.io/apiextensions-apiserver v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/gengo v0.0.0-20240404160639-a0386bf69313
sigs.k8s.io/controller-runtime v0.17.3
sigs.k8s.io/controller-tools v0.14.0
sigs.k8s.io/yaml v1.4.0
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
Expand All @@ -44,21 +44,21 @@ require (
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/dave/jennifer v1.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/cli v25.0.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v25.0.1+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/cli v24.0.6+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
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.11.2 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand All @@ -69,33 +69,33 @@ require (
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.5 // indirect
github.com/klauspost/compress v1.16.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.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand All @@ -105,33 +105,33 @@ require (
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
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc6 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.6 // indirect
github.com/rubenv/sql-migrate v1.6.1 // indirect
github.com/rubenv/sql-migrate v1.5.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.starlark.net v0.0.0-20240123142251-f86470692795 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
Expand All @@ -147,22 +147,21 @@ require (
golang.org/x/tools v0.17.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/evanphx/json-patch.v5 v5.9.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.29.1 // indirect
k8s.io/cli-runtime v0.29.1 // indirect
k8s.io/component-base v0.29.1 // indirect
k8s.io/apiserver v0.29.3 // indirect
k8s.io/cli-runtime v0.29.0 // indirect
k8s.io/component-base v0.29.3 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240126223410-2919ad4fcfec // indirect
k8s.io/kubectl v0.29.1 // indirect
k8s.io/kubectl v0.29.0 // indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
oras.land/oras-go v1.2.5 // indirect
oras.land/oras-go v1.2.4 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.16.0 // indirect
sigs.k8s.io/kustomize/kyaml v0.16.0 // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Loading

0 comments on commit 8eef9fb

Please sign in to comment.