Skip to content

Commit

Permalink
[FEAT] add version monitoring parameters to cap-operator-manager (#85)
Browse files Browse the repository at this point in the history
* [FIX] manager missing permission for `captenantoutputs`

* [FEAT] add version monitoring parameters to cap-operator-manager

* remove `volumes` from `subscriptionServer`
  • Loading branch information
skrishnan-sap authored Sep 27, 2024
1 parent ca9669f commit 7466a68
Show file tree
Hide file tree
Showing 11 changed files with 2,065 additions and 70 deletions.
19 changes: 0 additions & 19 deletions .project

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate ClusterRole & CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./..." output:crd:artifacts:config=config/crd
$(CONTROLLER_GEN) rbac:roleName=cap-operator-manager-role crd paths="./..." output:crd:artifacts:config=config/crd

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down Expand Up @@ -88,8 +88,8 @@ LISTER_GEN ?= $(LOCALBIN)/lister-gen
SETUP_ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
CONTROLLER_TOOLS_VERSION ?= v0.13.0
CODE_GENERATOR_VERSION ?= v0.28.1
CONTROLLER_TOOLS_VERSION ?= v0.16.3
CODE_GENERATOR_VERSION ?= v0.31.1
SETUP_ENVTEST_VERSION ?= latest

.PHONY: controller-gen
Expand Down
34 changes: 30 additions & 4 deletions api/v1alpha1/capoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import (

"github.com/sap/component-operator-runtime/pkg/component"
runtimetypes "github.com/sap/component-operator-runtime/pkg/types"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="State",type=string,JSONPath=".status.state"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=".status.state"

// CAPOperator is the Schema for the CAPOperators API
type CAPOperator struct {
Expand All @@ -36,20 +37,45 @@ type CAPOperatorStatus struct {

// CAPOperatorSpec defines the desired state of CAPOperator
type CAPOperatorSpec struct {
// SubscriptionServer info
// SubscriptionServer specification
SubscriptionServer SubscriptionServer `json:"subscriptionServer"`
// +kubebuilder:validation:Pattern=^[a-z0-9-.]*$
// Public ingress URL for the cluster Load Balancer
DNSTarget string `json:"dnsTarget,omitempty"`
// +kubebuilder:validation:MinItems=1
// Labels used to identify the istio ingress-gateway component and its corresponding namespace. Usually {"app":"istio-ingressgateway","istio":"ingressgateway"}
IngressGatewayLabels []NameValue `json:"ingressGatewayLabels,omitempty"`
// Controller specification
Controller Controller `json:"controller,omitempty"`
}

type SubscriptionServer struct {
Subdomain string `json:"subDomain"`
}

type Controller struct {
VersionMonitoring *VersionMonitoring `json:"versionMonitoring,omitempty"`
// Optionally specify list of additional volumes for the controller pod(s)
Volumes []corev1.Volume `json:"volumes,omitempty"`
// Optionally specify list of additional volumeMounts for the controller container(s)
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

type VersionMonitoring struct {
// URL of the Prometheus server from which metrics related to managed application versions can be queried
PrometheusAddress string `json:"prometheusAddress,omitempty"`
// The duration (example 2h) after which versions are evaluated for deletion; based on specified workload metrics
MetricsEvaluationInterval Duration `json:"metricsEvaluationInterval,omitempty"`
// The duration (example 10m) to wait before retrying to acquire Prometheus client and verify connection, after a failed attempt
PromClientAcquireRetryDelay Duration `json:"promClientAcquireRetryDelay,omitempty"`
}

// Duration is a valid time duration that can be parsed by Prometheus
// Supported units: y, w, d, h, m, s, ms
// Examples: `30s`, `1m`, `1h20m15s`, `15d`
// +kubebuilder:validation:Pattern:="^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$"
type Duration string

// Generic Name/Value configuration
type NameValue struct {
Name string `json:"name"`
Expand Down
51 changes: 51 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.

Loading

0 comments on commit 7466a68

Please sign in to comment.