Skip to content

Commit

Permalink
enhance spec according to helm chart values
Browse files Browse the repository at this point in the history
  • Loading branch information
cbarbian-sap committed Jul 23, 2023
1 parent 170c886 commit 52625fb
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 51 deletions.
15 changes: 15 additions & 0 deletions api/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"

monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"

"github.com/sap/component-operator-runtime/pkg/component"
componentoperatorruntimetypes "github.com/sap/component-operator-runtime/pkg/types"
)
Expand All @@ -22,6 +24,19 @@ type ProjectOperatorSpec struct {
// +optional
Image component.ImageSpec `json:"image"`
component.KubernetesProperties `json:",inline"`
NamespacePrefix string `json:"namespacePrefix,omitempty"`
AdminClusterRole string `json:"adminClusterRole,omitempty"`
ViewerClusterRole string `json:"viewerClusterRole,omitempty"`
EnableClusterView bool `json:"enableClusterView,omitempty"`
Monitoring *MonitoringSpec `json:"monitoring,omitempty"`
}

// MonitoringSpec describes observability related properties of the Project.
type MonitoringSpec struct {
// Whether related resources shall be deployed (requires prometheus-operator).
Enabled bool `json:"enabled,omitempty"`
// Prometheus (record or alert) rules.
Rules []monitoringv1.Rule `json:"rules,omitempty"`
}

// ProjectOperatorStatus defines the observed state of ProjectOperator.
Expand Down
28 changes: 28 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

67 changes: 67 additions & 0 deletions crds/operator.kyma-project.io_projectoperators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ spec:
spec:
description: ProjectOperatorSpec defines the desired state of ProjectOperator.
properties:
adminClusterRole:
type: string
affinity:
description: Affinity is a group of affinity scheduling rules.
properties:
Expand Down Expand Up @@ -870,6 +872,8 @@ spec:
type: array
type: object
type: object
enableClusterView:
type: boolean
image:
description: ImageSpec defines the used OCI image
properties:
Expand All @@ -889,10 +893,71 @@ spec:
minLength: 1
type: string
type: object
monitoring:
description: MonitoringSpec describes observability related properties
of the Project.
properties:
enabled:
description: Whether related resources shall be deployed (requires
prometheus-operator).
type: boolean
rules:
description: Prometheus (record or alert) rules.
items:
description: 'Rule describes an alerting or recording rule See
Prometheus documentation: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)
or [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules)
rule'
properties:
alert:
description: Name of the alert. Must be a valid label value.
Only one of `record` and `alert` must be set.
type: string
annotations:
additionalProperties:
type: string
description: Annotations to add to each alert. Only valid
for alerting rules.
type: object
expr:
anyOf:
- type: integer
- type: string
description: PromQL expression to evaluate.
x-kubernetes-int-or-string: true
for:
description: Alerts are considered firing once they have
been returned for this long.
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
keep_firing_for:
description: KeepFiringFor defines how long an alert will
continue firing after the condition that triggered it
has cleared.
minLength: 1
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
labels:
additionalProperties:
type: string
description: Labels to add or overwrite.
type: object
record:
description: Name of the time series to output to. Must
be a valid metric name. Only one of `record` and `alert`
must be set.
type: string
required:
- expr
type: object
type: array
type: object
name:
type: string
namespace:
type: string
namespacePrefix:
type: string
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -1502,6 +1567,8 @@ spec:
- whenUnsatisfiable
type: object
type: array
viewerClusterRole:
type: string
type: object
status:
default:
Expand Down
21 changes: 11 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.19

require (
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/sap/component-operator-runtime v0.1.4
k8s.io/apiextensions-apiserver v0.27.3
k8s.io/apimachinery v0.27.3
Expand All @@ -19,20 +20,20 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
Expand Down Expand Up @@ -64,10 +65,10 @@ require (
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -77,9 +78,9 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.3 // indirect
k8s.io/component-base v0.27.3 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/cli-utils v0.34.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.4 // indirect
Expand Down
Loading

0 comments on commit 52625fb

Please sign in to comment.