Compare commits

...
Author SHA1 Message Date
grambbledook 2fe854046e fix alignment in manifest.cue 2026-01-06 09:38:18 +01:00
Denis VodopianovandDave Henderson 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
+1
View File
@@ -10,6 +10,7 @@ manifest: {
v0alpha1: { v0alpha1: {
kinds: [annotationv0alpha1] kinds: [annotationv0alpha1]
served: false
routes: { routes: {
namespaced: { namespaced: {
"/tags": { "/tags": {
@@ -25,6 +25,13 @@ type Annotation struct {
Status AnnotationStatus `json:"status" yaml:"status"` Status AnnotationStatus `json:"status" yaml:"status"`
} }
func NewAnnotation() *Annotation {
return &Annotation{
Spec: *NewAnnotationSpec(),
Status: *NewAnnotationStatus(),
}
}
func (o *Annotation) GetSpec() any { func (o *Annotation) GetSpec() any {
return o.Spec return o.Spec
} }
@@ -10,7 +10,7 @@ import (
// schema is unexported to prevent accidental overwrites // schema is unexported to prevent accidental overwrites
var ( 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)) resource.WithPlural("annotations"), resource.WithScope(resource.NamespacedScope))
kindAnnotation = resource.Kind{ kindAnnotation = resource.Kind{
Schema: schemaAnnotation, Schema: schemaAnnotation,
+1 -1
View File
@@ -32,7 +32,7 @@ var appManifestData = app.ManifestData{
Versions: []app.ManifestVersion{ Versions: []app.ManifestVersion{
{ {
Name: "v0alpha1", Name: "v0alpha1",
Served: true, Served: false,
Kinds: []app.ManifestVersionKind{ Kinds: []app.ManifestVersionKind{
{ {
Kind: "Annotation", Kind: "Annotation",
+10
View File
@@ -12,6 +12,7 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/selection"
"k8s.io/apiserver/pkg/authorization/authorizer"
"k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/registry/rest"
restclient "k8s.io/client-go/rest" restclient "k8s.io/client-go/rest"
@@ -115,6 +116,15 @@ func (a *AnnotationAppInstaller) GetLegacyStorage(requested schema.GroupVersionR
return a.legacy 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 ( var (
_ rest.Scoper = (*legacyStorage)(nil) _ rest.Scoper = (*legacyStorage)(nil)
_ rest.SingularNameProvider = (*legacyStorage)(nil) _ rest.SingularNameProvider = (*legacyStorage)(nil)
+4 -4
View File
@@ -76,10 +76,6 @@ func ProvideAppInstallers(
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesLogsDrilldown) { if features.IsEnabledGlobally(featuremgmt.FlagKubernetesLogsDrilldown) {
installers = append(installers, logsdrilldownAppInstaller) installers = append(installers, logsdrilldownAppInstaller)
} }
//nolint:staticcheck
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesAnnotations) {
installers = append(installers, annotationAppInstaller)
}
//nolint:staticcheck // not yet migrated to OpenFeature //nolint:staticcheck // not yet migrated to OpenFeature
if features.IsEnabledGlobally(featuremgmt.FlagGrafanaAdvisor) { if features.IsEnabledGlobally(featuremgmt.FlagGrafanaAdvisor) {
installers = append(installers, advisorAppInstaller) installers = append(installers, advisorAppInstaller)
@@ -88,6 +84,10 @@ func ProvideAppInstallers(
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesAlertingHistorian) && alertingHistorianAppInstaller != nil { if features.IsEnabledGlobally(featuremgmt.FlagKubernetesAlertingHistorian) && alertingHistorianAppInstaller != nil {
installers = append(installers, alertingHistorianAppInstaller) 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 return installers
} }