diff --git a/apps/annotation/kinds/manifest.cue b/apps/annotation/kinds/manifest.cue index 3404f8853c6..78c76a794fe 100644 --- a/apps/annotation/kinds/manifest.cue +++ b/apps/annotation/kinds/manifest.cue @@ -10,6 +10,7 @@ manifest: { v0alpha1: { kinds: [annotationv0alpha1] + served: false routes: { namespaced: { "/tags": { diff --git a/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_object_gen.go b/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_object_gen.go index db99bcffa08..d6ed331fee2 100644 --- a/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_object_gen.go +++ b/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_object_gen.go @@ -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 } diff --git a/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_schema_gen.go b/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_schema_gen.go index 3127e6a8954..3dd588ef864 100644 --- a/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_schema_gen.go +++ b/apps/annotation/pkg/apis/annotation/v0alpha1/annotation_schema_gen.go @@ -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, diff --git a/apps/annotation/pkg/apis/annotation_manifest.go b/apps/annotation/pkg/apis/annotation_manifest.go index 004529ee84d..36b9fe18024 100644 --- a/apps/annotation/pkg/apis/annotation_manifest.go +++ b/apps/annotation/pkg/apis/annotation_manifest.go @@ -32,7 +32,7 @@ var appManifestData = app.ManifestData{ Versions: []app.ManifestVersion{ { Name: "v0alpha1", - Served: true, + Served: false, Kinds: []app.ManifestVersionKind{ { Kind: "Annotation", diff --git a/pkg/registry/apps/annotation/register.go b/pkg/registry/apps/annotation/register.go index 9d733eb3dcb..281a764d722 100644 --- a/pkg/registry/apps/annotation/register.go +++ b/pkg/registry/apps/annotation/register.go @@ -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) diff --git a/pkg/registry/apps/apps.go b/pkg/registry/apps/apps.go index a1ec8aafd65..7e37d6536ce 100644 --- a/pkg/registry/apps/apps.go +++ b/pkg/registry/apps/apps.go @@ -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 }