Skip to content

Commit

Permalink
Make NiFi pod readiness and liveness checks configurable (konpyutaika…
Browse files Browse the repository at this point in the history
…#220)

* Make NiFi pod readiness and liveness checks configurable

* update changelog

* update user guide with new probe configs

* remove v1alpha1 changes
  • Loading branch information
mh013370 authored Mar 14, 2023
1 parent 3b6c9b5 commit 92743b0
Show file tree
Hide file tree
Showing 10 changed files with 389 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Added

- [PR #220](https://github.com/konpyutaika/nifikop/pull/220) - **[Operator/NifiCluster]** Made `Pod` readiness and liveness checks configurable.

### Changed

### Fixed Bugs
Expand Down
7 changes: 7 additions & 0 deletions api/v1/nificluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ type PodPolicy struct {
// Labels specifies additional labels to attach to the pods the operator creates
Labels map[string]string `json:"labels,omitempty"`
// A list of host aliases to include in every pod's /etc/hosts configuration in the scenario where DNS is not available.
// +optional
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
// Override the default readiness probe settings
// +optional
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
// Override the default liveness probe settings
// +optional
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
}

// rollingUpgradeConfig specifies the rolling upgrade config for the cluster
Expand Down
10 changes: 10 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

4 changes: 3 additions & 1 deletion api/v1alpha1/common_conversion.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package v1alpha1

import v1 "github.com/konpyutaika/nifikop/api/v1"
import (
v1 "github.com/konpyutaika/nifikop/api/v1"
)

// SecretRef
func getSecretRef(src v1.SecretReference) SecretReference {
Expand Down
12 changes: 8 additions & 4 deletions api/v1alpha1/nificluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1alpha1
import (
"fmt"

"github.com/konpyutaika/nifikop/api/v1"
v1 "github.com/konpyutaika/nifikop/api/v1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

Expand Down Expand Up @@ -100,9 +100,11 @@ func convertNifiClusterSecretRef(src SecretReference, dst *v1.NifiCluster) {

func convertNifiClusterPodPolicy(src PodPolicy, dst *v1.NifiCluster) {
dst.Spec.Pod = v1.PodPolicy{
HostAliases: src.HostAliases,
Annotations: src.Annotations,
Labels: src.Labels,
HostAliases: src.HostAliases,
Annotations: src.Annotations,
Labels: src.Labels,
ReadinessProbe: nil,
LivenessProbe: nil,
}
}

Expand Down Expand Up @@ -356,6 +358,7 @@ func convertInternalListeners(src []InternalListenerConfig) []v1.InternalListene
func convertSSLSecrets(src *SSLSecrets, dst *v1.ListenersConfig) {
if src == nil {
dst.SSLSecrets = nil
return
}
dst.SSLSecrets = &v1.SSLSecrets{
TLSSecretName: src.TLSSecretName,
Expand Down Expand Up @@ -793,6 +796,7 @@ func convertFromInternalListeners(src []v1.InternalListenerConfig) []InternalLis
func convertFromSSLSecrets(src *v1.SSLSecrets, dst *ListenersConfig) {
if src == nil {
dst.SSLSecrets = nil
return
}
dst.SSLSecrets = &SSLSecrets{
TLSSecretName: src.TLSSecretName,
Expand Down
156 changes: 156 additions & 0 deletions config/crd/bases/nifi.konpyutaika.com_nificlusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,162 @@ spec:
additionalProperties:
type: string
type: object
livenessProbe:
properties:
exec:
properties:
command:
items:
type: string
type: array
type: object
failureThreshold:
format: int32
type: integer
grpc:
properties:
port:
format: int32
type: integer
service:
type: string
required:
- port
type: object
httpGet:
properties:
host:
type: string
httpHeaders:
items:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
path:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
scheme:
type: string
required:
- port
type: object
initialDelaySeconds:
format: int32
type: integer
periodSeconds:
format: int32
type: integer
successThreshold:
format: int32
type: integer
tcpSocket:
properties:
host:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
required:
- port
type: object
terminationGracePeriodSeconds:
format: int64
type: integer
timeoutSeconds:
format: int32
type: integer
type: object
readinessProbe:
properties:
exec:
properties:
command:
items:
type: string
type: array
type: object
failureThreshold:
format: int32
type: integer
grpc:
properties:
port:
format: int32
type: integer
service:
type: string
required:
- port
type: object
httpGet:
properties:
host:
type: string
httpHeaders:
items:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
path:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
scheme:
type: string
required:
- port
type: object
initialDelaySeconds:
format: int32
type: integer
periodSeconds:
format: int32
type: integer
successThreshold:
format: int32
type: integer
tcpSocket:
properties:
host:
type: string
port:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
required:
- port
type: object
terminationGracePeriodSeconds:
format: int64
type: integer
timeoutSeconds:
format: int32
type: integer
type: object
type: object
propagateLabels:
type: boolean
Expand Down
Loading

0 comments on commit 92743b0

Please sign in to comment.