This is an automated email from the ASF dual-hosted git repository.

gyfora pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new b36fdae9 [FLINK-32171] Add PostStart hook to flink k8s operator helm
b36fdae9 is described below

commit b36fdae98dc075255cb528e87d4960ef46fbfb32
Author: Xingcan Cui <[email protected]>
AuthorDate: Mon Jun 12 02:24:06 2023 -0400

    [FLINK-32171] Add PostStart hook to flink k8s operator helm
---
 docs/content/docs/custom-resource/overview.md      |   2 +
 docs/content/docs/operations/helm.md               | 105 +++++++++++----------
 .../templates/flink-operator.yaml                  |   5 +
 helm/flink-kubernetes-operator/values.yaml         |   3 +
 4 files changed, 63 insertions(+), 52 deletions(-)

diff --git a/docs/content/docs/custom-resource/overview.md 
b/docs/content/docs/custom-resource/overview.md
index 83cc17b9..01b098ad 100644
--- a/docs/content/docs/custom-resource/overview.md
+++ b/docs/content/docs/custom-resource/overview.md
@@ -210,6 +210,8 @@ ENV FLINK_PLUGINS_DIR=/opt/flink/plugins
 COPY flink-hadoop-fs-1.15-SNAPSHOT.jar $FLINK_PLUGINS_DIR/hadoop-fs/
 ```
 
+Alternatively, if you use helm to install flink-kubernetes-operator, it allows 
you to specify a postStart hook to download the required plugins.
+
 ### Limitations
 
 - Last-state upgradeMode is currently not supported for FlinkSessionJobs
diff --git a/docs/content/docs/operations/helm.md 
b/docs/content/docs/operations/helm.md
index 1505269c..bb70e793 100644
--- a/docs/content/docs/operations/helm.md
+++ b/docs/content/docs/operations/helm.md
@@ -57,58 +57,59 @@ helm install -f myvalues.yaml flink-kubernetes-operator 
helm/flink-kubernetes-op
 
 The configurable parameters of the Helm chart and which default values as 
detailed in the following table:
 
-| Parameters                                      | Description                
                                                                                
                                                     | Default Value            
                                                                                
                                                                                
                                                                                
              [...]
-|-------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
-| watchNamespaces                                 | List of kubernetes 
namespaces to watch for FlinkDeployment changes, empty means all namespaces.    
                                                             |                  
                                                                                
                                                                                
                                                                                
                      [...]
-| image.repository                                | The image repository of 
flink-kubernetes-operator.                                                      
                                                        | 
ghcr.io/apache/flink-kubernetes-operator                                        
                                                                                
                                                                                
                                       [...]
-| image.pullPolicy                                | The image pull policy of 
flink-kubernetes-operator.                                                      
                                                       | IfNotPresent           
                                                                                
                                                                                
                                                                                
                [...]
-| image.tag                                       | The image tag of 
flink-kubernetes-operator.                                                      
                                                               | latest         
                                                                                
                                                                                
                                                                                
                        [...]
-| image.digest                                    | The image tag of 
flink-kubernetes-operator. If set then it takes precedence and the image tag 
will be ignored.                                                  |             
                                                                                
                                                                                
                                                                                
                           [...]
-| replicas                                        | Operator replica count. 
Must be 1 unless leader election is configured.                                 
                                                        | 1                     
                                                                                
                                                                                
                                                                                
                 [...]
-| strategy.type                                   | Operator pod upgrade 
strategy. Must be Recreate unless leader election is configured.                
                                                           | Recreate           
                                                                                
                                                                                
                                                                                
                    [...]
-| rbac.create                                     | Whether to enable RBAC to 
create for said namespaces.                                                     
                                                      | true                    
                                                                                
                                                                                
                                                                                
               [...]
-| rbac.nodesRule.create                           | Whether to add RBAC rule 
to list nodes which is needed for rest-service exposed as NodePort type.        
                                                       | false                  
                                                                                
                                                                                
                                                                                
                [...]
-| operatorPod.annotations                         | Custom annotations to be 
added to the operator pod (but not the deployment).                             
                                                       |                        
                                                                                
                                                                                
                                                                                
                [...]
-| operatorPod.labels                              | Custom labels to be added 
to the operator pod (but not the deployment).                                   
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| operatorPod.env                                 | Custom env to be added to 
the operator pod.                                                               
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| operatorPod.dnsPolicy                           | DNS policy to be used by 
the operator pod.                                                               
                                                       |                        
                                                                                
                                                                                
                                                                                
                [...]
-| operatorPod.dnsConfig                           | DNS configuration to be 
used by the operator pod.                                                       
                                                        |                       
                                                                                
                                                                                
                                                                                
                 [...]
-| operatorPod.nodeSelector                        | Custom nodeSelector to be 
added to the operator pod.                                                      
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| operatorPod.topologySpreadConstraints           | Custom 
topologySpreadConstraints to be added to the operator pod.                      
                                                                         |      
                                                                                
                                                                                
                                                                                
                                  [...]
-| operatorPod.resources                           | Custom resources block to 
be added to the operator pod on main container.                                 
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| operatorPod.webhook.resources                   | Custom resources block to 
be added to the operator pod on flink-webhook container.                        
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| operatorPod.tolerations                         | Custom tolerations to be 
added to the operator pod.                                                      
                                                       |                        
                                                                                
                                                                                
                                                                                
                [...]
-| operatorServiceAccount.create                   | Whether to enable operator 
service account to create for flink-kubernetes-operator.                        
                                                     | true                     
                                                                                
                                                                                
                                                                                
              [...]
-| operatorServiceAccount.annotations              | The annotations of 
operator service account.                                                       
                                                             |                  
                                                                                
                                                                                
                                                                                
                      [...]
-| operatorServiceAccount.name                     | The name of operator 
service account.                                                                
                                                           | flink-operator     
                                                                                
                                                                                
                                                                                
                    [...]
-| jobServiceAccount.create                        | Whether to enable job 
service account to create for flink jobmanager/taskmanager pods.                
                                                          | true                
                                                                                
                                                                                
                                                                                
                   [...]
-| jobServiceAccount.annotations                   | The annotations of job 
service account.                                                                
                                                         | 
"helm.sh/resource-policy": keep                                                 
                                                                                
                                                                                
                                       [...]
-| jobServiceAccount.name                          | The name of job service 
account.                                                                        
                                                        | flink                 
                                                                                
                                                                                
                                                                                
                 [...]
-| operatorVolumeMounts.create                     | Whether to enable operator 
volume mounts to create for flink-kubernetes-operator.                          
                                                     | false                    
                                                                                
                                                                                
                                                                                
              [...]
-| operatorVolumeMounts.data                       | List of mount paths of 
operator volume mounts.                                                         
                                                         | - name: 
flink-artifacts<br/>&nbsp;&nbsp;mountPath: /opt/flink/artifacts                 
                                                                                
                                                                                
                               [...]
-| operatorVolumes.create                          | Whether to enable operator 
volumes to create for flink-kubernetes-operator.                                
                                                     | false                    
                                                                                
                                                                                
                                                                                
              [...]
-| operatorVolumes.data                            | The ConfigMap of operator 
volumes.                                                                        
                                                      | - name: 
flink-artifacts<br/>&nbsp;&nbsp;hostPath:<br/>&nbsp;&nbsp;&nbsp;&nbsp;path: 
/tmp/flink/artifacts<br/>&nbsp;&nbsp;&nbsp;&nbsp;type: DirectoryOrCreate        
                                                                                
                                   [...]
-| podSecurityContext                              | Defines privilege and 
access control settings for a pod or container for pod security context.        
                                                          | runAsUser: 
9999<br/>runAsGroup: 9999                                                       
                                                                                
                                                                                
                            [...]
-| operatorSecurityContext                         | Defines privilege and 
access control settings for a pod or container for operator security context.   
                                                          |                     
                                                                                
                                                                                
                                                                                
                   [...]
-| webhookSecurityContext                          | Defines privilege and 
access control settings for a pod or container for webhook security context.    
                                                          |                     
                                                                                
                                                                                
                                                                                
                   [...]
-| webhook.create                                  | Whether to enable 
validating and mutating webhooks for flink-kubernetes-operator.                 
                                                              | true            
                                                                                
                                                                                
                                                                                
                       [...]
-| webhook.mutator.create                          | Enable or disable mutating 
webhook, overrides `webhook.create`                                             
                                                     |                          
                                                                                
                                                                                
                                                                                
              [...]
-| webhook.validator.create                        | Enable or disable 
validating webhook, overrides `webhook.create`                                  
                                                              |                 
                                                                                
                                                                                
                                                                                
                       [...]
-| webhook.keystore                                | The ConfigMap of webhook 
key store.                                                                      
                                                       | useDefaultPassword: 
true                                                                            
                                                                                
                                                                                
                   [...]
-| defaultConfiguration.create                     | Whether to enable default 
configuration to create for flink-kubernetes-operator.                          
                                                      | true                    
                                                                                
                                                                                
                                                                                
               [...]
-| defaultConfiguration.append                     | Whether to append 
configuration files with configs.                                               
                                                              | true            
                                                                                
                                                                                
                                                                                
                       [...]
-| defaultConfiguration.flink-conf.yaml            | The default configuration 
of flink-conf.yaml.                                                             
                                                      | 
kubernetes.operator.metrics.reporter.slf4j.factory.class: 
org.apache.flink.metrics.slf4j.Slf4jReporterFactory<br/>kubernetes.operator.metrics.reporter.slf4j.interval:
 5 MINUTE<br/>kubernetes.operator.reconcile.interval: 15 
s<br/>kubernetes.operator.observer.progress-check.inter [...]
-| defaultConfiguration.log4j-operator.properties  | The default configuration 
of log4j-operator.properties.                                                   
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| defaultConfiguration.log4j-console.properties   | The default configuration 
of log4j-console.properties.                                                    
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| metrics.port                                    | The metrics port on the 
container for default configuration.                                            
                                                        |                       
                                                                                
                                                                                
                                                                                
                 [...]
-| imagePullSecrets                                | The image pull secrets of 
flink-kubernetes-operator.                                                      
                                                      |                         
                                                                                
                                                                                
                                                                                
               [...]
-| nameOverride                                    | Overrides the name with 
the specified name.                                                             
                                                        |                       
                                                                                
                                                                                
                                                                                
                 [...]
-| fullnameOverride                                | Overrides the fullname 
with the specified full name.                                                   
                                                         |                      
                                                                                
                                                                                
                                                                                
                  [...]
-| jvmArgs.webhook                                 | The JVM start up options 
for webhook.                                                                    
                                                       |                        
                                                                                
                                                                                
                                                                                
                [...]
-| jvmArgs.operator                                | The JVM start up options 
for operator.                                                                   
                                                       |                        
                                                                                
                                                                                
                                                                                
                [...]
-| operatorHealth.port                             | Operator health endpoint 
port to be used by the probes.                                                  
                                                       | 8085                   
                                                                                
                                                                                
                                                                                
                [...]
-| operatorHealth.livenessProbe                    | Liveness probe 
configuration for the operator using the health endpoint. Only time settings 
should be configured, endpoint is set automatically based on port.  |           
                                                                                
                                                                                
                                                                                
                             [...]
-| operatorHealth.startupProbe                     | Startup probe 
configuration for the operator using the health endpoint. Only time settings 
should be configured, endpoint is set automatically based on port.   |          
                                                                                
                                                                                
                                                                                
                              [...]
+| Parameters                                     | Description                 
                                                                                
                                                   | Default Value              
                                                                                
                                                                                
                                                                                
              [...]
+|------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
+| watchNamespaces                                | List of kubernetes 
namespaces to watch for FlinkDeployment changes, empty means all namespaces.    
                                                            |                   
                                                                                
                                                                                
                                                                                
                       [...]
+| image.repository                               | The image repository of 
flink-kubernetes-operator.                                                      
                                                       | 
ghcr.io/apache/flink-kubernetes-operator                                        
                                                                                
                                                                                
                                         [...]
+| image.pullPolicy                               | The image pull policy of 
flink-kubernetes-operator.                                                      
                                                      | IfNotPresent            
                                                                                
                                                                                
                                                                                
                 [...]
+| image.tag                                      | The image tag of 
flink-kubernetes-operator.                                                      
                                                              | latest          
                                                                                
                                                                                
                                                                                
                         [...]
+| image.digest                                   | The image tag of 
flink-kubernetes-operator. If set then it takes precedence and the image tag 
will be ignored.                                                 |              
                                                                                
                                                                                
                                                                                
                            [...]
+| replicas                                       | Operator replica count. 
Must be 1 unless leader election is configured.                                 
                                                       | 1                      
                                                                                
                                                                                
                                                                                
                  [...]
+| strategy.type                                  | Operator pod upgrade 
strategy. Must be Recreate unless leader election is configured.                
                                                          | Recreate            
                                                                                
                                                                                
                                                                                
                     [...]
+| rbac.create                                    | Whether to enable RBAC to 
create for said namespaces.                                                     
                                                     | true                     
                                                                                
                                                                                
                                                                                
                [...]
+| rbac.nodesRule.create                          | Whether to add RBAC rule to 
list nodes which is needed for rest-service exposed as NodePort type.           
                                                   | false                      
                                                                                
                                                                                
                                                                                
              [...]
+| operatorPod.annotations                        | Custom annotations to be 
added to the operator pod (but not the deployment).                             
                                                      |                         
                                                                                
                                                                                
                                                                                
                 [...]
+| operatorPod.labels                             | Custom labels to be added 
to the operator pod (but not the deployment).                                   
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| operatorPod.env                                | Custom env to be added to 
the operator pod.                                                               
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| operatorPod.dnsPolicy                          | DNS policy to be used by 
the operator pod.                                                               
                                                      |                         
                                                                                
                                                                                
                                                                                
                 [...]
+| operatorPod.dnsConfig                          | DNS configuration to be 
used by the operator pod.                                                       
                                                       |                        
                                                                                
                                                                                
                                                                                
                  [...]
+| operatorPod.nodeSelector                       | Custom nodeSelector to be 
added to the operator pod.                                                      
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| operatorPod.topologySpreadConstraints          | Custom 
topologySpreadConstraints to be added to the operator pod.                      
                                                                        |       
                                                                                
                                                                                
                                                                                
                                   [...]
+| operatorPod.resources                          | Custom resources block to 
be added to the operator pod on main container.                                 
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| operatorPod.webhook.resources                  | Custom resources block to 
be added to the operator pod on flink-webhook container.                        
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| operatorPod.tolerations                        | Custom tolerations to be 
added to the operator pod.                                                      
                                                      |                         
                                                                                
                                                                                
                                                                                
                 [...]
+| operatorServiceAccount.create                  | Whether to enable operator 
service account to create for flink-kubernetes-operator.                        
                                                    | true                      
                                                                                
                                                                                
                                                                                
               [...]
+| operatorServiceAccount.annotations             | The annotations of operator 
service account.                                                                
                                                   |                            
                                                                                
                                                                                
                                                                                
              [...]
+| operatorServiceAccount.name                    | The name of operator 
service account.                                                                
                                                          | flink-operator      
                                                                                
                                                                                
                                                                                
                     [...]
+| jobServiceAccount.create                       | Whether to enable job 
service account to create for flink jobmanager/taskmanager pods.                
                                                         | true                 
                                                                                
                                                                                
                                                                                
                    [...]
+| jobServiceAccount.annotations                  | The annotations of job 
service account.                                                                
                                                        | 
"helm.sh/resource-policy": keep                                                 
                                                                                
                                                                                
                                         [...]
+| jobServiceAccount.name                         | The name of job service 
account.                                                                        
                                                       | flink                  
                                                                                
                                                                                
                                                                                
                  [...]
+| operatorVolumeMounts.create                    | Whether to enable operator 
volume mounts to create for flink-kubernetes-operator.                          
                                                    | false                     
                                                                                
                                                                                
                                                                                
               [...]
+| operatorVolumeMounts.data                      | List of mount paths of 
operator volume mounts.                                                         
                                                        | - name: 
flink-artifacts<br/>&nbsp;&nbsp;mountPath: /opt/flink/artifacts                 
                                                                                
                                                                                
                                 [...]
+| operatorVolumes.create                         | Whether to enable operator 
volumes to create for flink-kubernetes-operator.                                
                                                    | false                     
                                                                                
                                                                                
                                                                                
               [...]
+| operatorVolumes.data                           | The ConfigMap of operator 
volumes.                                                                        
                                                     | - name: 
flink-artifacts<br/>&nbsp;&nbsp;hostPath:<br/>&nbsp;&nbsp;&nbsp;&nbsp;path: 
/tmp/flink/artifacts<br/>&nbsp;&nbsp;&nbsp;&nbsp;type: DirectoryOrCreate        
                                                                                
                                     [...]
+| podSecurityContext                             | Defines privilege and 
access control settings for a pod or container for pod security context.        
                                                         | runAsUser: 
9999<br/>runAsGroup: 9999                                                       
                                                                                
                                                                                
                              [...]
+| operatorSecurityContext                        | Defines privilege and 
access control settings for a pod or container for operator security context.   
                                                         |                      
                                                                                
                                                                                
                                                                                
                    [...]
+| webhookSecurityContext                         | Defines privilege and 
access control settings for a pod or container for webhook security context.    
                                                         |                      
                                                                                
                                                                                
                                                                                
                    [...]
+| webhook.create                                 | Whether to enable 
validating and mutating webhooks for flink-kubernetes-operator.                 
                                                             | true             
                                                                                
                                                                                
                                                                                
                        [...]
+| webhook.mutator.create                         | Enable or disable mutating 
webhook, overrides `webhook.create`                                             
                                                    |                           
                                                                                
                                                                                
                                                                                
               [...]
+| webhook.validator.create                       | Enable or disable 
validating webhook, overrides `webhook.create`                                  
                                                             |                  
                                                                                
                                                                                
                                                                                
                        [...]
+| webhook.keystore                               | The ConfigMap of webhook 
key store.                                                                      
                                                      | useDefaultPassword: 
true                                                                            
                                                                                
                                                                                
                     [...]
+| defaultConfiguration.create                    | Whether to enable default 
configuration to create for flink-kubernetes-operator.                          
                                                     | true                     
                                                                                
                                                                                
                                                                                
                [...]
+| defaultConfiguration.append                    | Whether to append 
configuration files with configs.                                               
                                                             | true             
                                                                                
                                                                                
                                                                                
                        [...]
+| defaultConfiguration.flink-conf.yaml           | The default configuration 
of flink-conf.yaml.                                                             
                                                     | 
kubernetes.operator.metrics.reporter.slf4j.factory.class: 
org.apache.flink.metrics.slf4j.Slf4jReporterFactory<br/>kubernetes.operator.metrics.reporter.slf4j.interval:
 5 MINUTE<br/>kubernetes.operator.reconcile.interval: 15 
s<br/>kubernetes.operator.observer.progress-check.interva [...]
+| defaultConfiguration.log4j-operator.properties | The default configuration 
of log4j-operator.properties.                                                   
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| defaultConfiguration.log4j-console.properties  | The default configuration 
of log4j-console.properties.                                                    
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| metrics.port                                   | The metrics port on the 
container for default configuration.                                            
                                                       |                        
                                                                                
                                                                                
                                                                                
                  [...]
+| imagePullSecrets                               | The image pull secrets of 
flink-kubernetes-operator.                                                      
                                                     |                          
                                                                                
                                                                                
                                                                                
                [...]
+| nameOverride                                   | Overrides the name with the 
specified name.                                                                 
                                                   |                            
                                                                                
                                                                                
                                                                                
              [...]
+| fullnameOverride                               | Overrides the fullname with 
the specified full name.                                                        
                                                   |                            
                                                                                
                                                                                
                                                                                
              [...]
+| jvmArgs.webhook                                | The JVM start up options 
for webhook.                                                                    
                                                      |                         
                                                                                
                                                                                
                                                                                
                 [...]
+| jvmArgs.operator                               | The JVM start up options 
for operator.                                                                   
                                                      |                         
                                                                                
                                                                                
                                                                                
                 [...]
+| operatorHealth.port                            | Operator health endpoint 
port to be used by the probes.                                                  
                                                      | 8085                    
                                                                                
                                                                                
                                                                                
                 [...]
+| operatorHealth.livenessProbe                   | Liveness probe 
configuration for the operator using the health endpoint. Only time settings 
should be configured, endpoint is set automatically based on port. |            
                                                                                
                                                                                
                                                                                
                              [...]
+| operatorHealth.startupProbe                    | Startup probe configuration 
for the operator using the health endpoint. Only time settings should be 
configured, endpoint is set automatically based on port.  |                     
                                                                                
                                                                                
                                                                                
                     [...]
+| postStart                                      | The postStart hook 
configuration for the main container.                                           
                                                            |                   
                                                                                
                                                                                
                                                                                
                       [...]
 
 For more information check the [Helm 
documentation](https://helm.sh/docs/helm/helm_install/).
 
diff --git a/helm/flink-kubernetes-operator/templates/flink-operator.yaml 
b/helm/flink-kubernetes-operator/templates/flink-operator.yaml
index ba77e999..792087b1 100644
--- a/helm/flink-kubernetes-operator/templates/flink-operator.yaml
+++ b/helm/flink-kubernetes-operator/templates/flink-operator.yaml
@@ -141,6 +141,11 @@ spec:
               path: /
               port: health-port
           {{- end }}
+          {{- if .Values.postStart }}
+          lifecycle:
+            postStart:
+              {{- toYaml .Values.postStart | nindent 14 }}
+          {{- end }}
         {{- if eq (include "flink-operator.webhook-enabled" .) "true" }}
         - name: flink-webhook
           image: {{ include "flink-operator.imagePath" . }}
diff --git a/helm/flink-kubernetes-operator/values.yaml 
b/helm/flink-kubernetes-operator/values.yaml
index 5bb79977..6a009dca 100644
--- a/helm/flink-kubernetes-operator/values.yaml
+++ b/helm/flink-kubernetes-operator/values.yaml
@@ -183,3 +183,6 @@ operatorHealth:
   startupProbe:
     failureThreshold: 30
     periodSeconds: 10
+
+# Set postStart hook of the main container
+postStart: {}

Reply via email to