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

pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 9728f7a  SUBMARINE-1161. Submarine-Operator add support to custom 
server and database image.
9728f7a is described below

commit 9728f7ab107d8f4f5ce5eff506143428c3ee86e4
Author: Kenchu123 <[email protected]>
AuthorDate: Mon Dec 20 18:05:19 2021 +0800

    SUBMARINE-1161. Submarine-Operator add support to custom server and 
database image.
    
    ### What is this PR for?
    <!-- A few sentences describing the overall goals of the pull request's 
commits.
    First time? Check out the contributing guide - 
https://submarine.apache.org/contribution/contributions.html
    -->
    
    This PR is for making operator support custom images for server and 
database.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    None.
    
    ### What is the Jira issue?
    <!-- * Open an issue on Jira 
https://issues.apache.org/jira/browse/SUBMARINE/
    * Put link here, and add [SUBMARINE-*Jira number*] in PR title, eg. 
`SUBMARINE-23. PR title`
    -->
    https://issues.apache.org/jira/browse/SUBMARINE-1161
    ### How should this be tested?
    <!--
    * First time? Setup Travis CI as described on 
https://submarine.apache.org/contribution/contributions.html#continuous-integration
    * Strongly recommended: add automated unit tests for any new or changed 
behavior
    * Outline any manual steps to test the PR here.
    -->
    None.
    ### Screenshots (if appropriate)
    None.
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: Kenchu123 <[email protected]>
    
    Signed-off-by: Kevin <[email protected]>
    
    Closes #851 from Kenchu123/SUBMARINE-1161 and squashes the following 
commits:
    
    fe6f9081 [Kenchu123] SUBMARINE-1161. Make operator support for custom 
server and database image
---
 submarine-cloud-v2/pkg/controller/submarine_database.go | 4 ++++
 submarine-cloud-v2/pkg/controller/submarine_server.go   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/submarine-cloud-v2/pkg/controller/submarine_database.go 
b/submarine-cloud-v2/pkg/controller/submarine_database.go
index af8857d..07433fb 100644
--- a/submarine-cloud-v2/pkg/controller/submarine_database.go
+++ b/submarine-cloud-v2/pkg/controller/submarine_database.go
@@ -43,6 +43,7 @@ func newSubmarineDatabasePersistentVolumeClaim(submarine 
*v1alpha1.Submarine) *c
 }
 
 func newSubmarineDatabaseDeployment(submarine *v1alpha1.Submarine) 
*appsv1.Deployment {
+       databaseImage := submarine.Spec.Database.Image
        databaseReplicas := *submarine.Spec.Database.Replicas
 
        deployment, err := ParseDeploymentYaml(databaseYamlPath)
@@ -52,6 +53,9 @@ func newSubmarineDatabaseDeployment(submarine 
*v1alpha1.Submarine) *appsv1.Deplo
        deployment.ObjectMeta.OwnerReferences = []metav1.OwnerReference{
                *metav1.NewControllerRef(submarine, 
v1alpha1.SchemeGroupVersion.WithKind("Submarine")),
        }
+       if databaseImage != "" {
+               deployment.Spec.Template.Spec.Containers[0].Image = 
databaseImage
+       }
        deployment.Spec.Replicas = &databaseReplicas
 
        return deployment
diff --git a/submarine-cloud-v2/pkg/controller/submarine_server.go 
b/submarine-cloud-v2/pkg/controller/submarine_server.go
index 9ee86ea..702acdf 100644
--- a/submarine-cloud-v2/pkg/controller/submarine_server.go
+++ b/submarine-cloud-v2/pkg/controller/submarine_server.go
@@ -55,6 +55,7 @@ func newSubmarineServerService(submarine *v1alpha1.Submarine) 
*corev1.Service {
 }
 
 func newSubmarineServerDeployment(submarine *v1alpha1.Submarine) 
*appsv1.Deployment {
+       serverImage := submarine.Spec.Server.Image
        serverReplicas := *submarine.Spec.Server.Replicas
 
        ownerReference := *metav1.NewControllerRef(submarine, 
v1alpha1.SchemeGroupVersion.WithKind("Submarine"))
@@ -92,6 +93,9 @@ func newSubmarineServerDeployment(submarine 
*v1alpha1.Submarine) *appsv1.Deploym
        deployment.ObjectMeta.OwnerReferences = []metav1.OwnerReference{
                ownerReference,
        }
+       if serverImage != "" {
+               deployment.Spec.Template.Spec.Containers[0].Image = serverImage
+       }
        deployment.Spec.Replicas = &serverReplicas
        deployment.Spec.Template.Spec.Containers[0].Env = 
append(deployment.Spec.Template.Spec.Containers[0].Env, operatorEnv...)
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to