Compare commits

...

3 Commits

Author SHA1 Message Date
grambbledook
2fe854046e fix alignment in manifest.cue 2026-01-06 09:38:18 +01:00
Denis Vodopianov
adfaeab33f Update apps/annotation/kinds/manifest.cue
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
2026-01-06 09:37:32 +01:00
grambbledook
3d72b400d0 disable annotations by default 2026-01-06 09:37:31 +01:00
6 changed files with 24 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ manifest: {
v0alpha1: {
kinds: [annotationv0alpha1]
served: false
routes: {
namespaced: {
"/tags": {

View File

@@ -25,6 +25,13 @@ type Annotation struct {
Status AnnotationStatus `json:"status" yaml:"status"`
}
func NewAnnotation() *Annotation {
return &Annotation{
Spec: *NewAnnotationSpec(),
Status: *NewAnnotationStatus(),
}
}
func (o *Annotation) GetSpec() any {
return o.Spec
}

View File

@@ -10,7 +10,7 @@ import (
// schema is unexported to prevent accidental overwrites
var (
schemaAnnotation = resource.NewSimpleSchema("annotation.grafana.app", "v0alpha1", &Annotation{}, &AnnotationList{}, resource.WithKind("Annotation"),
schemaAnnotation = resource.NewSimpleSchema("annotation.grafana.app", "v0alpha1", NewAnnotation(), &AnnotationList{}, resource.WithKind("Annotation"),
resource.WithPlural("annotations"), resource.WithScope(resource.NamespacedScope))
kindAnnotation = resource.Kind{
Schema: schemaAnnotation,

View File

@@ -32,7 +32,7 @@ var appManifestData = app.ManifestData{
Versions: []app.ManifestVersion{
{
Name: "v0alpha1",
Served: true,
Served: false,
Kinds: []app.ManifestVersionKind{
{
Kind: "Annotation",

View File

@@ -12,6 +12,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apiserver/pkg/authorization/authorizer"
"k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/rest"
restclient "k8s.io/client-go/rest"
@@ -115,6 +116,15 @@ func (a *AnnotationAppInstaller) GetLegacyStorage(requested schema.GroupVersionR
return a.legacy
}
// GetAuthorizer Returns a dummy authorizer
func (a *AnnotationAppInstaller) GetAuthorizer() authorizer.Authorizer {
return authorizer.AuthorizerFunc(
func(ctx context.Context, a authorizer.Attributes) (authorizer.Decision, string, error) {
return authorizer.DecisionAllow, "", nil
},
)
}
var (
_ rest.Scoper = (*legacyStorage)(nil)
_ rest.SingularNameProvider = (*legacyStorage)(nil)

View File

@@ -76,10 +76,6 @@ func ProvideAppInstallers(
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesLogsDrilldown) {
installers = append(installers, logsdrilldownAppInstaller)
}
//nolint:staticcheck
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesAnnotations) {
installers = append(installers, annotationAppInstaller)
}
//nolint:staticcheck // not yet migrated to OpenFeature
if features.IsEnabledGlobally(featuremgmt.FlagGrafanaAdvisor) {
installers = append(installers, advisorAppInstaller)
@@ -88,6 +84,10 @@ func ProvideAppInstallers(
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesAlertingHistorian) && alertingHistorianAppInstaller != nil {
installers = append(installers, alertingHistorianAppInstaller)
}
// Applications under active development should be disabled by default
// and explicitly enabled by specifying it in `runtime_config`
// under the `[grafana-apiserver]` section in settings.ini (see docs apps/example/README.md).
installers = append(installers, annotationAppInstaller)
return installers
}