Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate a module for the api package. #1856

Merged
merged 7 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
module github.com/grafana/grafana-operator/v5/api

go 1.23.6

require (
github.com/blang/semver v2.2.0+incompatible
github.com/grafana/grafana-openapi-client-go v0.0.0-20250108132429-8d7e1f158f65
github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
k8s.io/api v0.32.1
k8s.io/apiextensions-apiserver v0.32.1
k8s.io/apimachinery v0.32.1
k8s.io/client-go v0.32.1
sigs.k8s.io/controller-runtime v0.20.1
)

require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/errors v0.22.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/loads v0.22.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
github.com/go-openapi/strfmt v0.23.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-openapi/validate v0.24.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.7.0 // indirect
golang.org/x/tools v0.28.0 // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
196 changes: 196 additions & 0 deletions api/go.sum

Large diffs are not rendered by default.

220 changes: 181 additions & 39 deletions api/v1beta1/typeoverrides.go

Large diffs are not rendered by default.

82 changes: 76 additions & 6 deletions api/v1beta1/zz_generated.deepcopy.go

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

71 changes: 65 additions & 6 deletions config/crd/bases/grafana.integreatly.org_grafanas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8875,23 +8875,30 @@ spec:
kind is allowed. Use 'weight' field to emphasize one over others.
properties:
kind:
default: Service
description: The kind of target that the route is referring
to. Currently, only 'Service' is allowed
enum:
- Service
- ""
type: string
name:
description: name of the service/target that is being
referred to. e.g. name of the service
minLength: 1
type: string
weight:
default: 100
description: |-
weight as an integer between 0 and 256, default 100, that specifies the target's relative weight
against other target reference objects. 0 suppresses requests to this backend.
format: int32
maximum: 256
minimum: 0
type: integer
required:
- kind
- name
- weight
type: object
type: array
host:
Expand Down Expand Up @@ -8923,7 +8930,9 @@ spec:
certificate contents
type: string
certificate:
description: certificate provides certificate contents
description: |-
certificate provides certificate contents. This should be a single serving certificate, not a certificate
chain. Do not include a CA certificate.
type: string
destinationCACertificate:
description: |-
Expand All @@ -8933,47 +8942,97 @@ spec:
the short service name (service.namespace.svc), which allows infrastructure generated certificates to automatically
verify.
type: string
externalCertificate:
description: |-
externalCertificate provides certificate contents as a secret reference.
This should be a single serving certificate, not a certificate
chain. Do not include a CA certificate. The secret referenced should
be present in the same namespace as that of the Route.
Forbidden when `certificate` is set.
The router service account needs to be granted with read-only access to this secret,
please refer to openshift docs for additional details.
properties:
name:
description: |-
name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
insecureEdgeTerminationPolicy:
description: |-
insecureEdgeTerminationPolicy indicates the desired behavior for insecure connections to a route. While
each router may make its own decisions on which ports to expose, this is normally port 80.

* Allow - traffic is sent to the server on the insecure port (default)
* Disable - no traffic is allowed on the insecure port.
If a route does not specify insecureEdgeTerminationPolicy, then the default behavior is "None".

* Allow - traffic is sent to the server on the insecure port (edge/reencrypt terminations only).

* None - no traffic is allowed on the insecure port (default).

* Redirect - clients are redirected to the secure port.
enum:
- Allow
- None
- Redirect
- ""
type: string
key:
description: key provides key file contents
type: string
termination:
description: termination indicates termination type.
description: |-
termination indicates termination type.

* edge - TLS termination is done by the router and http is used to communicate with the backend (default)
* passthrough - Traffic is sent straight to the destination without the router providing TLS termination
* reencrypt - TLS termination is done by the router and https is used to communicate with the backend

Note: passthrough termination is incompatible with httpHeader actions
enum:
- edge
- reencrypt
- passthrough
type: string
required:
- termination
type: object
x-kubernetes-validations:
- message: 'cannot have both spec.tls.termination: passthrough
and spec.tls.insecureEdgeTerminationPolicy: Allow'
rule: 'has(self.termination) && has(self.insecureEdgeTerminationPolicy)
? !((self.termination==''passthrough'') && (self.insecureEdgeTerminationPolicy==''Allow''))
: true'
to:
description: |-
RouteTargetReference specifies the target that resolve into endpoints. Only the 'Service'
kind is allowed. Use 'weight' field to emphasize one over others.
properties:
kind:
default: Service
description: The kind of target that the route is referring
to. Currently, only 'Service' is allowed
enum:
- Service
- ""
type: string
name:
description: name of the service/target that is being
referred to. e.g. name of the service
minLength: 1
type: string
weight:
default: 100
description: |-
weight as an integer between 0 and 256, default 100, that specifies the target's relative weight
against other target reference objects. 0 suppresses requests to this backend.
format: int32
maximum: 256
minimum: 0
type: integer
required:
- kind
- name
- weight
type: object
wildcardPolicy:
description: WildcardPolicyType indicates the type of wildcard
Expand Down
2 changes: 1 addition & 1 deletion controllers/grafanamutetiming_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (r *GrafanaMuteTimingReconciler) removeFromInstance(ctx context.Context, in
return fmt.Errorf("building grafana client: %w", err)
}

_, err = cl.Provisioning.DeleteMuteTiming(muteTiming.Spec.Name) //nolint:errcheck
_, err = cl.Provisioning.DeleteMuteTiming(&provisioning.DeleteMuteTimingParams{Name: muteTiming.Spec.Name}) //nolint:errcheck
if err != nil {
return fmt.Errorf("deleting mute timing: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/grafananotificationtemplate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (r *GrafanaNotificationTemplateReconciler) removeFromInstance(ctx context.C
return fmt.Errorf("building grafana client: %w", err)
}

_, err = cl.Provisioning.DeleteTemplate(notificationTemplate.Spec.Name) //nolint:errcheck
_, err = cl.Provisioning.DeleteTemplate(&provisioning.DeleteTemplateParams{Name: notificationTemplate.Spec.Name}) //nolint:errcheck
if err != nil {
return fmt.Errorf("deleting notification template: %w", err)
}
Expand Down
Loading