Skip to content

Commit

Permalink
Update playlists app schemas to work with app SDK v0.29.0 (grafana#98974
Browse files Browse the repository at this point in the history
)

* Update playlists app schemas to work with app SDK v0.29.0

What

* Added the manifest for the playlists app
* Updated playlist kind definition to match the new format
* Re-generated the files
* Changed Makefile to not use post-processing flag

Why

To make sure the codegen works with the latest version of the app SDK.

Signed-off-by: Igor Suleymanov <[email protected]>

* Update app SDK to v0.30.0

* Skip generating custom resource definitions

Signed-off-by: Igor Suleymanov <[email protected]>

* Fix SDK not generating the manifest Go file

Signed-off-by: Igor Suleymanov <[email protected]>

---------

Signed-off-by: Igor Suleymanov <[email protected]>
Co-authored-by: Todd Treece <[email protected]>
  • Loading branch information
radiohead and toddtreece authored Jan 17, 2025
1 parent 1d7d658 commit bc6b7a4
Show file tree
Hide file tree
Showing 24 changed files with 185 additions and 216 deletions.
2 changes: 1 addition & 1 deletion apps/alerting/notifications/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/grafana/grafana => ../../..

require (
github.com/grafana/grafana v0.0.0-00010101000000-000000000000
github.com/grafana/grafana-app-sdk v0.29.0
github.com/grafana/grafana-app-sdk v0.30.0
k8s.io/apimachinery v0.32.0
k8s.io/apiserver v0.32.0
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f
Expand Down
4 changes: 2 additions & 2 deletions apps/alerting/notifications/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/grafana-app-sdk v0.29.0 h1:LMSm/+0LOBPd13fe1bs/4sKJmuLiixYUX9T0oqDqp4I=
github.com/grafana/grafana-app-sdk v0.29.0/go.mod h1:XLt308EmK6kvqPlzjUyXxbwZKEk2vur/eiypUNDay5I=
github.com/grafana/grafana-app-sdk v0.30.0 h1:Hqn2pETu2mQ4RpWkZYEQfu01P7xd1Z1Gj+HX/8aB0tw=
github.com/grafana/grafana-app-sdk v0.30.0/go.mod h1:jhfqNIovb+Mes2vdMf9iMCWQkp1GTNtyNuExONtiNuk=
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20240821155123-6891eb1d35da h1:2E3c/I3ayAy4Z1GwIPqXNZcpUccRapE1aBXA1ho4g7o=
github.com/grafana/grafana/pkg/apimachinery v0.0.0-20240821155123-6891eb1d35da/go.mod h1:p09fvU5ujNL/Ig8HB7g4f+S0zyYbQq3x/f0jA4ujVOM=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
Expand Down
3 changes: 1 addition & 2 deletions apps/investigation/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/grafana/grafana/apps/investigation
go 1.23.4

require (
github.com/grafana/grafana-app-sdk v0.29.0
github.com/grafana/grafana-app-sdk v0.30.0
k8s.io/apimachinery v0.32.0
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f
Expand Down Expand Up @@ -68,7 +68,6 @@ require (
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.29.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
Expand Down
4 changes: 2 additions & 2 deletions apps/investigation/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/Z
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/grafana-app-sdk v0.29.0 h1:LMSm/+0LOBPd13fe1bs/4sKJmuLiixYUX9T0oqDqp4I=
github.com/grafana/grafana-app-sdk v0.29.0/go.mod h1:XLt308EmK6kvqPlzjUyXxbwZKEk2vur/eiypUNDay5I=
github.com/grafana/grafana-app-sdk v0.30.0 h1:Hqn2pETu2mQ4RpWkZYEQfu01P7xd1Z1Gj+HX/8aB0tw=
github.com/grafana/grafana-app-sdk v0.30.0/go.mod h1:jhfqNIovb+Mes2vdMf9iMCWQkp1GTNtyNuExONtiNuk=
github.com/grafana/grafana-app-sdk/logging v0.29.0 h1:mgbXaAf33aFwqwGVeaX30l8rkeAJH0iACgX5Rn6YkN4=
github.com/grafana/grafana-app-sdk/logging v0.29.0/go.mod h1:xy6ZyVXl50Z3DBDLybvBPphbykPhuVNed/VNmen9DQM=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=
Expand Down
7 changes: 6 additions & 1 deletion apps/playlist/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.PHONY: generate
generate:
@grafana-app-sdk generate -g ./pkg/apis --kindgrouping=group --postprocess --crdencoding none
@grafana-app-sdk generate -g ./pkg/apis --grouping=group --postprocess
# HACK: Clean up generated CRD files.
# TODO: The SDK currently omits generating the manifest Go file with `--defencoding=none`,
# which we would normally use here to skip generating the CRD files.
# This needs to be addressed.
@rm -rf definitions
3 changes: 1 addition & 2 deletions apps/playlist/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/grafana/grafana/apps/playlist
go 1.23.4

require (
github.com/grafana/grafana-app-sdk v0.29.0
github.com/grafana/grafana-app-sdk v0.30.0
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
k8s.io/klog/v2 v2.130.1
Expand Down Expand Up @@ -69,7 +69,6 @@ require (
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.29.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
Expand Down
4 changes: 2 additions & 2 deletions apps/playlist/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/Z
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/grafana-app-sdk v0.29.0 h1:LMSm/+0LOBPd13fe1bs/4sKJmuLiixYUX9T0oqDqp4I=
github.com/grafana/grafana-app-sdk v0.29.0/go.mod h1:XLt308EmK6kvqPlzjUyXxbwZKEk2vur/eiypUNDay5I=
github.com/grafana/grafana-app-sdk v0.30.0 h1:Hqn2pETu2mQ4RpWkZYEQfu01P7xd1Z1Gj+HX/8aB0tw=
github.com/grafana/grafana-app-sdk v0.30.0/go.mod h1:jhfqNIovb+Mes2vdMf9iMCWQkp1GTNtyNuExONtiNuk=
github.com/grafana/grafana-app-sdk/logging v0.29.0 h1:mgbXaAf33aFwqwGVeaX30l8rkeAJH0iACgX5Rn6YkN4=
github.com/grafana/grafana-app-sdk/logging v0.29.0/go.mod h1:xy6ZyVXl50Z3DBDLybvBPphbykPhuVNed/VNmen9DQM=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=
Expand Down
3 changes: 3 additions & 0 deletions apps/playlist/kinds/cue.mod/module.cue
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
module: "github.com/grafana/grafana/apps/playlist/kinds"
language: {
version: "v0.9.0"
}
9 changes: 9 additions & 0 deletions apps/playlist/kinds/manifest.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package playlist

manifest: {
appName: "playlist"
groupOverride: "playlist.grafana.app"
kinds: [
playlist,
]
}
37 changes: 21 additions & 16 deletions apps/playlist/kinds/playlist.cue
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package core
package playlist

externalName: {
kind: "Playlist"
group: "playlist"
apiResource: {
groupOverride: "playlist.grafana.app"
mutation: operations: ["create","update"]
validation: operations: ["create","update"]
}
codegen: {
frontend: false
backend: true
}
playlist: {
kind: "Playlist"
pluralName: "Playlists"
current: "v0alpha1"
current: "v0alpha1"
versions: {
"v0alpha1": {
codegen: {
frontend: false
backend: true
}
validation: {
operations: [
"CREATE",
"UPDATE",
]
}
mutation: {
operations: [
"CREATE",
"UPDATE",
]
}
schema: {
#Item: {
// type of the item.
Expand All @@ -29,9 +35,8 @@ externalName: {
// - dashboard_by_uid: The value is the dashboard UID
value: string
}

spec: {
title: string
title: string
interval: string
items: [...#Item]
}
Expand Down
18 changes: 18 additions & 0 deletions apps/playlist/pkg/apis/playlist/v0alpha1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v0alpha1

import "k8s.io/apimachinery/pkg/runtime/schema"

const (
// Group is the API group used by all kinds in this package
Group = "playlist.grafana.app"
// Version is the API version used by all kinds in this package
Version = "v0alpha1"
)

var (
// GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package
GroupVersion = schema.GroupVersion{
Group: Group,
Version: Version,
}
)
30 changes: 13 additions & 17 deletions apps/playlist/pkg/apis/playlist/v0alpha1/playlist_metadata_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions apps/playlist/pkg/apis/playlist/v0alpha1/playlist_object_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions apps/playlist/pkg/apis/playlist/v0alpha1/playlist_spec_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 24 additions & 50 deletions apps/playlist/pkg/apis/playlist/v0alpha1/playlist_status_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc6b7a4

Please sign in to comment.