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

kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-operator.git

commit 31edf45cbd2944fe835f0acb66d5397a8144a386
Author: nobolity <[email protected]>
AuthorDate: Fri May 27 15:34:03 2022 +0800

    fix(operator): update the application.yaml througt sed
---
 api/v1alpha1/dsworker_types.go                       |  8 ++++++++
 api/v1alpha1/zz_generated.deepcopy.go                | 20 ++++++++++++++++++++
 .../ds.apache.dolphinscheduler.dev_dsworkers.yaml    |  8 ++++++++
 controllers/worker_reconcile.go                      | 16 ++++++----------
 4 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/api/v1alpha1/dsworker_types.go b/api/v1alpha1/dsworker_types.go
index d64db8f..df90268 100644
--- a/api/v1alpha1/dsworker_types.go
+++ b/api/v1alpha1/dsworker_types.go
@@ -68,6 +68,9 @@ type DSWorkerSpec struct {
 
        //LibPvcName define the address of lib pvc,the position is /opt/soft
        LibPvcName string `json:"lib_pvc_name,omitempty"`
+
+       //AlertConfig is the config of alertService
+       AlertConfig *AlertConfig `json:"alert_config,omitempty"`
 }
 
 // DSWorkerStatus defines the observed state of DSWorker
@@ -123,3 +126,8 @@ func (c *DSWorker) IsPodPVEnabled() bool {
        }
        return false
 }
+
+type AlertConfig struct {
+       ServiceUrl string `json:"service_url,omitempty"`
+       Port       string `json:"port,omitempty"`
+}
diff --git a/api/v1alpha1/zz_generated.deepcopy.go 
b/api/v1alpha1/zz_generated.deepcopy.go
index 6c0f493..bd6e45c 100644
--- a/api/v1alpha1/zz_generated.deepcopy.go
+++ b/api/v1alpha1/zz_generated.deepcopy.go
@@ -26,6 +26,21 @@ import (
        runtime "k8s.io/apimachinery/pkg/runtime"
 )
 
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
+func (in *AlertConfig) DeepCopyInto(out *AlertConfig) {
+       *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new AlertConfig.
+func (in *AlertConfig) DeepCopy() *AlertConfig {
+       if in == nil {
+               return nil
+       }
+       out := new(AlertConfig)
+       in.DeepCopyInto(out)
+       return out
+}
+
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *DSMaster) DeepCopyInto(out *DSMaster) {
        *out = *in
@@ -203,6 +218,11 @@ func (in *DSWorkerSpec) DeepCopyInto(out *DSWorkerSpec) {
                *out = new(PodPolicy)
                (*in).DeepCopyInto(*out)
        }
+       if in.AlertConfig != nil {
+               in, out := &in.AlertConfig, &out.AlertConfig
+               *out = new(AlertConfig)
+               **out = **in
+       }
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new DSWorkerSpec.
diff --git a/config/crd/bases/ds.apache.dolphinscheduler.dev_dsworkers.yaml 
b/config/crd/bases/ds.apache.dolphinscheduler.dev_dsworkers.yaml
index e10149e..a7dfb80 100644
--- a/config/crd/bases/ds.apache.dolphinscheduler.dev_dsworkers.yaml
+++ b/config/crd/bases/ds.apache.dolphinscheduler.dev_dsworkers.yaml
@@ -35,6 +35,14 @@ spec:
           spec:
             description: DSWorkerSpec defines the desired state of DSWorker
             properties:
+              alert_config:
+                description: AlertConfig is the config of alertService
+                properties:
+                  port:
+                    type: string
+                  service_url:
+                    type: string
+                type: object
               datasource:
                 description: Datasource is the config of database
                 properties:
diff --git a/controllers/worker_reconcile.go b/controllers/worker_reconcile.go
index b13c422..8ffe129 100644
--- a/controllers/worker_reconcile.go
+++ b/controllers/worker_reconcile.go
@@ -107,16 +107,6 @@ func newDSWorkerPod(cr *dsv1alpha1.DSWorker) *corev1.Pod {
                        },
                },
                Spec: corev1.PodSpec{
-                       Volumes: []corev1.Volume{
-                               {
-                                       Name: dsWorkerConfig,
-                                       VolumeSource: corev1.VolumeSource{
-                                               ConfigMap: 
&corev1.ConfigMapVolumeSource{
-                                                       LocalObjectReference: 
corev1.LocalObjectReference{Name: dsWorkerConfig},
-                                               },
-                                       },
-                               },
-                       },
                        Hostname:  podName,
                        Subdomain: dsv1alpha1.DsServiceLabelValue,
                        Containers: []corev1.Container{
@@ -144,6 +134,12 @@ func newDSWorkerPod(cr *dsv1alpha1.DSWorker) *corev1.Pod {
                                                        Value: 
cr.Spec.Datasource.Password,
                                                },
                                        },
+                                       Command: []string{
+                                               "/bin/sh", "-c",
+                                       },
+                                       Args: []string{"sed -i 
's/alert-listen-host: localhost/alert-listen-host: 
$(DS_ALERT_SERVICE_SERVICE_HOST)/g' conf/application.yaml ;" +
+                                               " sed -i 
's/50052/$(DS_ALERT_SERVICE_SERVICE_PORT)/g' conf/application.yaml ; " +
+                                               "./bin/start.sh"},
                                },
                        },
                },

Reply via email to