Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
[Feature/Operator] Enable prometheus scrapping endpoint (#88)
Browse files Browse the repository at this point in the history
* manage configmap and secret for override

* add reference and update samples

* fix changelog

* enable prometheus reporting task

* append changelog

* update doc and generated code

* clean
  • Loading branch information
erdrix authored Mar 29, 2021
1 parent e739910 commit 4bbb240
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 16 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
### Added

- [PR #86](https://github.com/Orange-OpenSource/nifikop/pull/86) - **[Operator/Debugging]** Add events and improve HTTP calls error message
- [PR #87](https://github.com/Orange-OpenSource/nifikop/pull/87) - **[Operator/Configuration]** Allow to override the `.properties` files using a config map and/or a secret.
- [PR #87](https://github.com/Orange-OpenSource/nifikop/pull/87) - **[Operator/Configuration]** Allow to replace the `logback.xml` and `bootstrap_notification_service.xml` files using a config map or a secret.
- [PR #88](https://github.com/Orange-OpenSource/nifikop/pull/88) - **[Operator/Monitoring]** By choosing `prometheus` as type for an internal service in a NiFiCluster resource, the operator automatically creates the associated `reporting task`.


### Changed

- [PR #85](https://github.com/Orange-OpenSource/nifikop/pull/85) - **[Operator/Dependencies]** Upgrade cert-manager & operator sdk dependencies
- [PR #87](https://github.com/Orange-OpenSource/nifikop/pull/87) - **[Operator/Configuration]** The node configuration files are no more stored in a configmap, but in a secret.


### Deprecated

- [PR #85](https://github.com/Orange-OpenSource/nifikop/pull/85) - **[Operator/Finalizers]** The finalizer name format suggested by [Kubernetes docs](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#finalizers) is <qualified-group>/<finalizer-name>, while the format previously documented by Operator SDK docs was <finalizer-name>.<qualified-group>. If your operator uses any finalizers with names matching the incorrect format, change them to match the official format. For example, finalizer.nifiusergroups.nifi.orange.com should be changed to nifiusergroups.nifi.orange.com/finalizer.
- [PR #87](https://github.com/Orange-OpenSource/nifikop/pull/87) - **[Operator/Configuration]** Since the v0.5.0 the operator doesn't catch certain resource changes, due to bad copy of resource, this issue avoid rolling upgrage trigger when some configuration changes.


### Removed

Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ type UserState string
// ConfigmapReference states a reference to a data into a configmap
type ConfigmapReference struct {
// Name of the configmap that we want to refer.
Name string `json:"name"`
Name string `json:"name"`
// Namespace where is located the secret that we want to refer.
Namespace string `json:"namespace,omitempty"`
// The key of the value,in data content, that we want use.
Data string `json:"data"`
Data string `json:"data"`
}

// SecretConfigReference states a reference to a data into a secret
type SecretConfigReference struct {
// Name of the configmap that we want to refer.
Name string `json:"name"`
Name string `json:"name"`
// Namespace where is located the secret that we want to refer.
Namespace string `json:"namespace,omitempty"`
// The key of the value,in data content, that we want use.
Data string `json:"data"`
Data string `json:"data"`
}

// ClusterReference states a reference to a cluster for dataflow/registryclient/user
Expand Down
34 changes: 28 additions & 6 deletions api/v1alpha1/nificluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
)

const (
ClusterListenerType = "cluster"
HttpListenerType = "http"
HttpsListenerType = "https"
S2sListenerType = "s2s"
MetricsPort = 9020
ClusterListenerType = "cluster"
HttpListenerType = "http"
HttpsListenerType = "https"
S2sListenerType = "s2s"
prometheusListenerType = "prometheus"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand Down Expand Up @@ -320,7 +320,7 @@ type SSLSecrets struct {

// InternalListenerConfig defines the internal listener config for Nifi
type InternalListenerConfig struct {
// +kubebuilder:validation:Enum={"cluster", "http", "https", "s2s"}
// +kubebuilder:validation:Enum={"cluster", "http", "https", "s2s", "prometheus"}
// (Optional field) Type allow to specify if we are in a specific nifi listener
// it's allowing to define some required information such as Cluster Port,
// Http Port, Https Port or S2S port
Expand Down Expand Up @@ -443,6 +443,15 @@ type NifiClusterStatus struct {
RollingUpgrade RollingUpgradeStatus `json:"rollingUpgradeStatus,omitempty"`
// RootProcessGroupId contains the uuid of the root process group for this cluster
RootProcessGroupId string `json:"rootProcessGroupId,omitempty"`
// PrometheusReportingTask contains the status of the prometheus reporting task managed by the operator
PrometheusReportingTask PrometheusReportingTaskStatus `json:"prometheusReportingTask,omitempty"`
}

type PrometheusReportingTaskStatus struct {
// The nifi reporting task's id
Id string `json:"id"`
// The last nifi reporting task revision version catched
Version int64 `json:"version"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -620,3 +629,16 @@ func (nProperties NifiProperties) GetAuthorizer() string {
}
return "managed-authorizer"
}

//
func (nSpec *NifiClusterSpec) GetMetricPort() *int {

for _, iListener := range nSpec.ListenersConfig.InternalListeners {
if iListener.Type == prometheusListenerType {
val := int(iListener.ContainerPort)
return &val
}
}

return nil
}
16 changes: 16 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 4bbb240

Please sign in to comment.