Browse Source

init helm chart for configservice, adminservice and portal

Jason Song 4 years ago
parent
commit
885e461cba
34 changed files with 1295 additions and 184 deletions
  1. 21 16
      apollo-adminservice/pom.xml
  2. 5 10
      apollo-adminservice/src/main/docker/Dockerfile
  3. 37 32
      apollo-adminservice/src/main/scripts/startup.sh
  4. 21 16
      apollo-configservice/pom.xml
  5. 5 10
      apollo-configservice/src/main/docker/Dockerfile
  6. 1 1
      apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceApplication.java
  7. 34 0
      apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/KubernetesHomePageController.java
  8. 37 32
      apollo-configservice/src/main/scripts/startup.sh
  9. 47 0
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/metaservice/controller/KubernetesHomePageControllerTest.java
  10. 21 16
      apollo-portal/pom.xml
  11. 5 16
      apollo-portal/src/main/docker/Dockerfile
  12. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java
  13. 6 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
  14. 37 32
      apollo-portal/src/main/scripts/startup.sh
  15. 187 0
      scripts/helm/README.md
  16. 23 0
      scripts/helm/apollo-portal/.helmignore
  17. 12 0
      scripts/helm/apollo-portal/Chart.yaml
  18. 21 0
      scripts/helm/apollo-portal/templates/NOTES.txt
  19. 51 0
      scripts/helm/apollo-portal/templates/_helpers.tpl
  20. 102 0
      scripts/helm/apollo-portal/templates/deployment-portal.yaml
  21. 41 0
      scripts/helm/apollo-portal/templates/ingress-portal.yaml
  22. 16 0
      scripts/helm/apollo-portal/templates/service-portal.yaml
  23. 31 0
      scripts/helm/apollo-portal/templates/service-portaldb.yaml
  24. 60 0
      scripts/helm/apollo-portal/values.yaml
  25. 23 0
      scripts/helm/apollo-service/.helmignore
  26. 12 0
      scripts/helm/apollo-service/Chart.yaml
  27. 18 0
      scripts/helm/apollo-service/templates/NOTES.txt
  28. 99 0
      scripts/helm/apollo-service/templates/_helpers.tpl
  29. 90 0
      scripts/helm/apollo-service/templates/deployment-adminservice.yaml
  30. 92 0
      scripts/helm/apollo-service/templates/deployment-configservice.yaml
  31. 15 0
      scripts/helm/apollo-service/templates/service-adminservice.yaml
  32. 31 0
      scripts/helm/apollo-service/templates/service-configdb.yaml
  33. 15 0
      scripts/helm/apollo-service/templates/service-configservice.yaml
  34. 78 0
      scripts/helm/apollo-service/values.yaml

+ 21 - 16
apollo-adminservice/pom.xml

@@ -98,22 +98,6 @@
 					<executable>true</executable>
 				</configuration>
 			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-				<version>0.4.13</version>
-				<configuration>
-					<imageName>${project.artifactId}</imageName>
-					<dockerDirectory>src/main/docker</dockerDirectory>
-					<resources>
-						<resource>
-							<targetPath>/</targetPath>
-							<directory>${project.build.directory}</directory>
-							<include>*.zip</include>
-						</resource>
-					</resources>
-				</configuration>
-			</plugin>
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>
 				<executions>
@@ -132,6 +116,27 @@
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>com.spotify</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+				<version>1.2.2</version>
+				<configuration>
+					<imageName>apolloconfig/${project.artifactId}</imageName>
+					<imageTags>
+						<imageTag>${project.version}</imageTag>
+						<imageTag>latest</imageTag>
+					</imageTags>
+					<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+					<serverId>docker-hub</serverId>
+					<resources>
+						<resource>
+							<targetPath>/</targetPath>
+							<directory>${project.build.directory}</directory>
+							<include>*.zip</include>
+						</resource>
+					</resources>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 </project>

+ 5 - 10
apollo-adminservice/src/main/docker/Dockerfile

@@ -1,17 +1,14 @@
 # Dockerfile for apollo-adminservice
-# 1. Copy apollo-adminservice-${VERSION}-github.zip to current directory
-# 2. Build with: docker build -t apollo-adminservice .
-# 3. Run with: docker run -p 8090:8090 -e DS_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e DS_USERNAME=FillInCorrectUser -e DS_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-adminservice apollo-adminservice
+# 1. ./scripts/build.sh
+# 2. Build with: mvn docker:build -pl apollo-adminservice
+# 3. Run with: docker run -p 8090:8090 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-adminservice apolloconfig/apollo-adminservice
 
 FROM openjdk:8-jre-alpine
 MAINTAINER ameizi <sxyx2008@163.com>
 
+ENV APOLLO_RUN_MODE "Docker"
 ENV VERSION 1.7.0-SNAPSHOT
 ENV SERVER_PORT 8090
-# DataSource Info
-ENV DS_URL ""
-ENV DS_USERNAME ""
-ENV DS_PASSWORD ""
 
 RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
     && echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
@@ -24,9 +21,7 @@ ADD apollo-adminservice-${VERSION}-github.zip /apollo-adminservice/apollo-admins
 
 RUN unzip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip -d /apollo-adminservice \
     && rm -rf /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip \
-    && sed -i '$d' /apollo-adminservice/scripts/startup.sh \
-    && chmod +x /apollo-adminservice/scripts/startup.sh \
-    && echo "tail -f /dev/null" >> /apollo-adminservice/scripts/startup.sh
+    && chmod +x /apollo-adminservice/scripts/startup.sh 
 
 EXPOSE $SERVER_PORT
 

+ 37 - 32
apollo-adminservice/src/main/scripts/startup.sh

@@ -116,46 +116,51 @@ if [[ ! -f PATH_TO_JAR && -d current ]]; then
     done
 fi
 
-if [[ -f $SERVICE_NAME".jar" ]]; then
-  rm -rf $SERVICE_NAME".jar"
-fi
+# For Docker environment, start in foreground mode
+if [[ -n "$APOLLO_RUN_MODE" ]] && [[ "$APOLLO_RUN_MODE" == "Docker" ]]; then
+    $javaexe -Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $PATH_TO_JAR
+else
+    if [[ -f $SERVICE_NAME".jar" ]]; then
+      rm -rf $SERVICE_NAME".jar"
+    fi
 
-printf "$(date) ==== Starting ==== \n"
+    printf "$(date) ==== Starting ==== \n"
 
-ln $PATH_TO_JAR $SERVICE_NAME".jar"
-chmod a+x $SERVICE_NAME".jar"
-./$SERVICE_NAME".jar" start
+    ln $PATH_TO_JAR $SERVICE_NAME".jar"
+    chmod a+x $SERVICE_NAME".jar"
+    ./$SERVICE_NAME".jar" start
 
-rc=$?;
+    rc=$?;
 
-if [[ $rc != 0 ]];
-then
-    echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
-    exit $rc;
-fi
+    if [[ $rc != 0 ]];
+    then
+        echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+        exit $rc;
+    fi
 
-declare -i counter=0
-declare -i max_counter=48 # 48*5=240s
-declare -i total_time=0
+    declare -i counter=0
+    declare -i max_counter=48 # 48*5=240s
+    declare -i total_time=0
 
-printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
-do
-    printf "."
-    counter+=1
-    sleep 5
+    printf "Waiting for server startup"
+    until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
+    do
+        printf "."
+        counter+=1
+        sleep 5
 
-    checkPidAlive
-done
+        checkPidAlive
+    done
 
-total_time=counter*5
+    total_time=counter*5
 
-if [[ (( counter -ge max_counter )) ]];
-then
-    printf "\n$(date) Server failed to start in $total_time seconds!\n"
-    exit 1;
-fi
+    if [[ (( counter -ge max_counter )) ]];
+    then
+        printf "\n$(date) Server failed to start in $total_time seconds!\n"
+        exit 1;
+    fi
 
-printf "\n$(date) Server started in $total_time seconds!\n"
+    printf "\n$(date) Server started in $total_time seconds!\n"
 
-exit 0;
+    exit 0;
+fi

+ 21 - 16
apollo-configservice/pom.xml

@@ -104,22 +104,6 @@
 					<executable>true</executable>
 				</configuration>
 			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-				<version>0.4.13</version>
-				<configuration>
-					<imageName>${project.artifactId}</imageName>
-					<dockerDirectory>src/main/docker</dockerDirectory>
-					<resources>
-						<resource>
-							<targetPath>/</targetPath>
-							<directory>${project.build.directory}</directory>
-							<include>*.zip</include>
-						</resource>
-					</resources>
-				</configuration>
-			</plugin>
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>
 				<executions>
@@ -138,6 +122,27 @@
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>com.spotify</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+				<version>1.2.2</version>
+				<configuration>
+					<imageName>apolloconfig/${project.artifactId}</imageName>
+					<imageTags>
+						<imageTag>${project.version}</imageTag>
+						<imageTag>latest</imageTag>
+					</imageTags>
+					<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+					<serverId>docker-hub</serverId>
+					<resources>
+						<resource>
+							<targetPath>/</targetPath>
+							<directory>${project.build.directory}</directory>
+							<include>*.zip</include>
+						</resource>
+					</resources>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 </project>

+ 5 - 10
apollo-configservice/src/main/docker/Dockerfile

@@ -1,17 +1,14 @@
 # Dockerfile for apollo-configservice
-# 1. Copy apollo-configservice-${VERSION}-github.zip to current directory
-# 2. Build with: docker build -t apollo-configservice .
-# 3. Run with: docker run -p 8080:8080 -e DS_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e DS_USERNAME=FillInCorrectUser -e DS_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-configservice apollo-configservice
+# 1. ./scripts/build.sh
+# 2. Build with: mvn docker:build -pl apollo-configservice
+# 3. Run with: docker run -p 8080:8080 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -d -v /tmp/logs:/opt/logs --name apollo-configservice apolloconfig/apollo-configservice
 
 FROM openjdk:8-jre-alpine
 MAINTAINER ameizi <sxyx2008@163.com>
 
+ENV APOLLO_RUN_MODE "Docker"
 ENV VERSION 1.7.0-SNAPSHOT
 ENV SERVER_PORT 8080
-# DataSource Info
-ENV DS_URL ""
-ENV DS_USERNAME ""
-ENV DS_PASSWORD ""
 
 RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
     && echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
@@ -24,9 +21,7 @@ ADD apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-conf
 
 RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \
     && rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \
-    && sed -i '$d' /apollo-configservice/scripts/startup.sh \
-    && chmod +x /apollo-configservice/scripts/startup.sh \
-    && echo "tail -f /dev/null" >> /apollo-configservice/scripts/startup.sh
+    && chmod +x /apollo-configservice/scripts/startup.sh
 
 EXPOSE $SERVER_PORT
 

+ 1 - 1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceApplication.java

@@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  */
 
 @EnableAspectJAutoProxy
-@EnableAutoConfiguration // (exclude = EurekaClientConfigBean.class)
+@EnableAutoConfiguration
 @Configuration
 @EnableTransactionManagement
 @PropertySource(value = {"classpath:configservice.properties"})

+ 34 - 0
apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/controller/KubernetesHomePageController.java

@@ -0,0 +1,34 @@
+package com.ctrip.framework.apollo.metaservice.controller;
+
+import com.ctrip.framework.apollo.core.ServiceNameConsts;
+import com.ctrip.framework.apollo.core.dto.ServiceDTO;
+import com.ctrip.framework.apollo.metaservice.service.DiscoveryService;
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.springframework.context.annotation.Profile;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * For kubernetes discovery service, there is no eureka home page, so we need to add a default one
+ */
+@Profile({"kubernetes"})
+@RestController
+public class KubernetesHomePageController {
+  private final DiscoveryService discoveryService;
+
+  public KubernetesHomePageController(DiscoveryService discoveryService) {
+    this.discoveryService = discoveryService;
+  }
+
+  @GetMapping("/")
+  public List<ServiceDTO> listAllServices() {
+    List<ServiceDTO> allServices = Lists.newLinkedList();
+    allServices
+        .addAll(discoveryService.getServiceInstances(ServiceNameConsts.APOLLO_CONFIGSERVICE));
+    allServices.addAll(discoveryService.getServiceInstances(ServiceNameConsts.APOLLO_ADMINSERVICE));
+
+    return allServices;
+  }
+}

+ 37 - 32
apollo-configservice/src/main/scripts/startup.sh

@@ -116,46 +116,51 @@ if [[ ! -f PATH_TO_JAR && -d current ]]; then
     done
 fi
 
-if [[ -f $SERVICE_NAME".jar" ]]; then
-  rm -rf $SERVICE_NAME".jar"
-fi
+# For Docker environment, start in foreground mode
+if [[ -n "$APOLLO_RUN_MODE" ]] && [[ "$APOLLO_RUN_MODE" == "Docker" ]]; then
+    $javaexe -Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $PATH_TO_JAR
+else
+    if [[ -f $SERVICE_NAME".jar" ]]; then
+        rm -rf $SERVICE_NAME".jar"
+    fi
 
-printf "$(date) ==== Starting ==== \n"
+    printf "$(date) ==== Starting ==== \n"
 
-ln $PATH_TO_JAR $SERVICE_NAME".jar"
-chmod a+x $SERVICE_NAME".jar"
-./$SERVICE_NAME".jar" start
+    ln $PATH_TO_JAR $SERVICE_NAME".jar"
+    chmod a+x $SERVICE_NAME".jar"
+    ./$SERVICE_NAME".jar" start
 
-rc=$?;
+    rc=$?;
 
-if [[ $rc != 0 ]];
-then
-    echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
-    exit $rc;
-fi
+    if [[ $rc != 0 ]];
+    then
+        echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+        exit $rc;
+    fi
 
-declare -i counter=0
-declare -i max_counter=48 # 48*5=240s
-declare -i total_time=0
+    declare -i counter=0
+    declare -i max_counter=48 # 48*5=240s
+    declare -i total_time=0
 
-printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
-do
-    printf "."
-    counter+=1
-    sleep 5
+    printf "Waiting for server startup"
+    until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
+    do
+        printf "."
+        counter+=1
+        sleep 5
 
-    checkPidAlive
-done
+        checkPidAlive
+    done
 
-total_time=counter*5
+    total_time=counter*5
 
-if [[ (( counter -ge max_counter )) ]];
-then
-    printf "\n$(date) Server failed to start in $total_time seconds!\n"
-    exit 1;
-fi
+    if [[ (( counter -ge max_counter )) ]];
+    then
+        printf "\n$(date) Server failed to start in $total_time seconds!\n"
+        exit 1;
+    fi
 
-printf "\n$(date) Server started in $total_time seconds!\n"
+    printf "\n$(date) Server started in $total_time seconds!\n"
 
-exit 0;
+    exit 0;
+fi

+ 47 - 0
apollo-configservice/src/test/java/com/ctrip/framework/apollo/metaservice/controller/KubernetesHomePageControllerTest.java

@@ -0,0 +1,47 @@
+package com.ctrip.framework.apollo.metaservice.controller;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import com.ctrip.framework.apollo.core.ServiceNameConsts;
+import com.ctrip.framework.apollo.core.dto.ServiceDTO;
+import com.ctrip.framework.apollo.metaservice.service.DiscoveryService;
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class KubernetesHomePageControllerTest {
+
+  @Mock
+  private DiscoveryService discoveryService;
+
+  private KubernetesHomePageController homePageController;
+
+  @Before
+  public void setUp() throws Exception {
+    homePageController = new KubernetesHomePageController(discoveryService);
+  }
+
+  @Test
+  public void testListAllServices() {
+    ServiceDTO someServiceDto = mock(ServiceDTO.class);
+    ServiceDTO anotherServiceDto = mock(ServiceDTO.class);
+
+    when(discoveryService.getServiceInstances(ServiceNameConsts.APOLLO_CONFIGSERVICE)).thenReturn(
+        Lists.newArrayList(someServiceDto));
+    when(discoveryService.getServiceInstances(ServiceNameConsts.APOLLO_ADMINSERVICE)).thenReturn(
+        Lists.newArrayList(anotherServiceDto));
+
+    List<ServiceDTO> allServices = homePageController.listAllServices();
+
+    assertEquals(2, allServices.size());
+    assertSame(someServiceDto, allServices.get(0));
+    assertSame(anotherServiceDto, allServices.get(1));
+  }
+}

+ 21 - 16
apollo-portal/pom.xml

@@ -75,22 +75,6 @@
 					<executable>true</executable>
 				</configuration>
 			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-				<version>0.4.13</version>
-				<configuration>
-					<imageName>${project.artifactId}</imageName>
-					<dockerDirectory>src/main/docker</dockerDirectory>
-					<resources>
-						<resource>
-							<targetPath>/</targetPath>
-							<directory>${project.build.directory}</directory>
-							<include>*.zip</include>
-						</resource>
-					</resources>
-				</configuration>
-			</plugin>
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>
 				<executions>
@@ -109,6 +93,27 @@
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>com.spotify</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+				<version>1.2.2</version>
+				<configuration>
+					<imageName>apolloconfig/${project.artifactId}</imageName>
+					<imageTags>
+						<imageTag>${project.version}</imageTag>
+						<imageTag>latest</imageTag>
+					</imageTags>
+					<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+					<serverId>docker-hub</serverId>
+					<resources>
+						<resource>
+							<targetPath>/</targetPath>
+							<directory>${project.build.directory}</directory>
+							<include>*.zip</include>
+						</resource>
+					</resources>
+				</configuration>
+			</plugin>
 			<plugin>
 				<groupId>com.google.code.maven-replacer-plugin</groupId>
 				<artifactId>replacer</artifactId>

+ 5 - 16
apollo-portal/src/main/docker/Dockerfile

@@ -1,23 +1,14 @@
 # Dockerfile for apollo-portal
-# 1. Copy apollo-portal-${VERSION}-github.zip to current directory
-# 2. Build with: docker build -t apollo-portal .
-# 3. Run with: docker run -p 8070:8070 -e DS_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloPortalDB?characterEncoding=utf8" -e DS_USERNAME=FillInCorrectUser -e DS_PASSWORD=FillInCorrectPassword -e DEV_META=http://fill-in-dev-meta-server:8080 -e PRO_META=http://fill-in-pro-meta-server:8080 -d -v /tmp/logs:/opt/logs --name apollo-portal apollo-portal
+# 1. ./scripts/build.sh
+# 2. Build with: mvn docker:build -pl apollo-adminservice
+# 3. Run with: docker run -p 8070:8070 -e SPRING_DATASOURCE_URL="jdbc:mysql://fill-in-the-correct-server:3306/ApolloPortalDB?characterEncoding=utf8" -e SPRING_DATASOURCE_USERNAME=FillInCorrectUser -e SPRING_DATASOURCE_PASSWORD=FillInCorrectPassword -e APOLLO_PORTAL_ENVS=dev,pro -e DEV_META=http://fill-in-dev-meta-server:8080 -e PRO_META=http://fill-in-pro-meta-server:8080 -d -v /tmp/logs:/opt/logs --name apollo-portal apolloconfig/apollo-portal
 
 FROM openjdk:8-jre-alpine
 MAINTAINER ameizi <sxyx2008@163.com>
 
+ENV APOLLO_RUN_MODE "Docker"
 ENV VERSION 1.7.0-SNAPSHOT
 ENV SERVER_PORT 8070
-# DataSource Info 
-ENV DS_URL ""
-ENV DS_USERNAME ""
-ENV DS_PASSWORD ""
-# Environmental variable declaration (meta server url, different environments should have different meta server addresses)
-ENV DEV_META ""
-ENV FAT_META ""
-ENV UAT_META ""
-ENV LPT_META ""
-ENV PRO_META ""
 
 RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
     && echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
@@ -30,9 +21,7 @@ ADD apollo-portal-${VERSION}-github.zip /apollo-portal/apollo-portal-${VERSION}-
 
 RUN unzip /apollo-portal/apollo-portal-${VERSION}-github.zip -d /apollo-portal \
     && rm -rf /apollo-portal/apollo-portal-${VERSION}-github.zip \
-    && sed -i '$d' /apollo-portal/scripts/startup.sh \
-    && chmod +x /apollo-portal/scripts/startup.sh \
-    && echo "tail -f /dev/null" >> /apollo-portal/scripts/startup.sh
+    && chmod +x /apollo-portal/scripts/startup.sh
 
 EXPOSE $SERVER_PORT
 

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java

@@ -75,7 +75,7 @@ public class PortalConfig extends RefreshableConfig {
       // try to parse
       map = gson.fromJson(jsonContent, META_SERVERS);
     } catch (Exception e) {
-      logger.error("wrong format with key: {}", key);
+      logger.error("Wrong format for: {}", key, e);
     }
     return map;
   }

+ 6 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java

@@ -57,6 +57,10 @@ import java.util.Map;
 @Configuration
 public class AuthConfiguration {
 
+  private static final String[] BY_PASS_URLS = {"/prometheus/**", "/metrics/**", "/openapi/**",
+      "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**", "/prefix-path",
+      "/health"};
+
   /**
    * spring.profiles.active = ctrip
    */
@@ -271,7 +275,7 @@ public class AuthConfiguration {
       http.csrf().disable();
       http.headers().frameOptions().sameOrigin();
       http.authorizeRequests()
-          .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**", "/prefix-path").permitAll()
+          .antMatchers(BY_PASS_URLS).permitAll()
           .antMatchers("/**").hasAnyRole(USER_ROLE);
       http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
           .httpBasic();
@@ -403,7 +407,7 @@ public class AuthConfiguration {
       http.csrf().disable();
       http.headers().frameOptions().sameOrigin();
       http.authorizeRequests()
-          .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**", "/prefix-path").permitAll()
+          .antMatchers(BY_PASS_URLS).permitAll()
           .antMatchers("/**").authenticated();
       http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
               .httpBasic();

+ 37 - 32
apollo-portal/src/main/scripts/startup.sh

@@ -116,46 +116,51 @@ if [[ ! -f PATH_TO_JAR && -d current ]]; then
     done
 fi
 
-if [[ -f $SERVICE_NAME".jar" ]]; then
-  rm -rf $SERVICE_NAME".jar"
-fi
+# For Docker environment, start in foreground mode
+if [[ -n "$APOLLO_RUN_MODE" ]] && [[ "$APOLLO_RUN_MODE" == "Docker" ]]; then
+    $javaexe -Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $PATH_TO_JAR
+else
+    if [[ -f $SERVICE_NAME".jar" ]]; then
+      rm -rf $SERVICE_NAME".jar"
+    fi
 
-printf "$(date) ==== Starting ==== \n"
+    printf "$(date) ==== Starting ==== \n"
 
-ln $PATH_TO_JAR $SERVICE_NAME".jar"
-chmod a+x $SERVICE_NAME".jar"
-./$SERVICE_NAME".jar" start
+    ln $PATH_TO_JAR $SERVICE_NAME".jar"
+    chmod a+x $SERVICE_NAME".jar"
+    ./$SERVICE_NAME".jar" start
 
-rc=$?;
+    rc=$?;
 
-if [[ $rc != 0 ]];
-then
-    echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
-    exit $rc;
-fi
+    if [[ $rc != 0 ]];
+    then
+        echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+        exit $rc;
+    fi
 
-declare -i counter=0
-declare -i max_counter=48 # 48*5=240s
-declare -i total_time=0
+    declare -i counter=0
+    declare -i max_counter=48 # 48*5=240s
+    declare -i total_time=0
 
-printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
-do
-    printf "."
-    counter+=1
-    sleep 5
+    printf "Waiting for server startup"
+    until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
+    do
+        printf "."
+        counter+=1
+        sleep 5
 
-    checkPidAlive
-done
+        checkPidAlive
+    done
 
-total_time=counter*5
+    total_time=counter*5
 
-if [[ (( counter -ge max_counter )) ]];
-then
-    printf "\n$(date) Server failed to start in $total_time seconds!\n"
-    exit 1;
-fi
+    if [[ (( counter -ge max_counter )) ]];
+    then
+        printf "\n$(date) Server failed to start in $total_time seconds!\n"
+        exit 1;
+    fi
 
-printf "\n$(date) Server started in $total_time seconds!\n"
+    printf "\n$(date) Server started in $total_time seconds!\n"
 
-exit 0;
+    exit 0;
+fi

+ 187 - 0
scripts/helm/README.md

@@ -0,0 +1,187 @@
+# Apollo Helm Chart
+
+[Apollo](https://github.com/ctripcorp/apollo) is a reliable configuration management system.
+
+## 1. Introduction
+
+The apollo-service and apollo-portal charts create deployments for apollo-configservice, apollo-adminservice and apollo-portal, which utilize the kubernetes native service discovery.
+
+## 2. Prerequisites
+
+- Kubernetes 1.10+
+- Helm 3
+
+## 3. Add Apollo Helm Chart Repository
+
+```bash
+$ helm repo add apollo http://ctripcorp.github.io/apollo/charts
+$ helm search repo apollo
+```
+
+## 4. Deployments of apollo-configservice and apollo-adminservice
+
+### 4.1 Installation
+
+apollo-configservice and apollo-adminservice should be installed per environment, so it is suggested to indicate environment in the release name, e.g. `apollo-service-dev`
+
+```bash
+$ helm install apollo-service-dev \
+    --set configdb.host=1.2.3.4 \
+    --set configdb.userName=apollo \
+    --set configdb.password=apollo \
+    --set configdb.service.enabled=true \
+    --set configService.replicaCount=1 \
+    --set adminService.replicaCount=1 \
+    apollo/apollo-service
+```
+
+Or customize it with values.yaml
+
+```bash
+$ helm install apollo-service-dev -f values.yaml apollo/apollo-service 
+```
+
+### 4.2 Uninstallation
+
+To uninstall/delete the `apollo-service-dev` deployment:
+
+```bash
+$ helm uninstall apollo-service-dev
+```
+
+### 4.3 Configuration
+
+The following table lists the configurable parameters of the apollo-service chart and their default values.
+
+| Parameter            | Description                                 | Default             |
+|----------------------|---------------------------------------------|---------------------|
+| `configdb.host` | The host for apollo config db | `nil` |
+| `configdb.port` | The port for apollo config db | `3306` |
+| `configdb.dbName` | The database name for apollo config db | `ApolloConfigDB` |
+| `configdb.userName` | The user name for apollo config db | `nil` |
+| `configdb.password` | The password for apollo config db | `nil` |
+| `configdb.connectionStringProperties` | The connection string properties for apollo config db | `characterEncoding=utf8` |
+| `configdb.service.enabled` | Whether to create a Kubernetes Service for `configdb.host` or not. Set it to `true` if `configdb.host` is an endpoint outside of the kubernetes cluster | `false` |
+| `configdb.service.fullNameOverride` | Override the service name for apollo config db | `nil` |
+| `configdb.service.port` | The port for the service of apollo config db | `3306` |
+| `configdb.service.type` | The service type of apollo config db: `ClusterIP` or `ExternalName` | `ClusterIP` |
+| `configService.fullNameOverride` | Override the deployment name for apollo-configservice | `nil` |
+| `configService.replicaCount` | Replica count of apollo-configservice | `2` |
+| `configService.containerPort` | Container port of apollo-configservice | `8080` |
+| `configService.image.repository` | Image repository of apollo-configservice | `apolloconfig/apollo-configservice` |
+| `configService.image.pullPolicy`                | Image pull policy of apollo-configservice | `IfNotPresent` |
+| `configService.imagePullSecrets`                | Image pull secrets of apollo-configservice | `[]` |
+| `configService.service.fullNameOverride` | Override the service name for apollo-configservice | `nil` |
+| `configService.service.port` | The port for the service of apollo-configservice | `8080` |
+| `configService.service.targetPort` | The target port for the service of apollo-configservice | `8080` |
+| `configService.service.type` | The service type of apollo-configservice                     | `ClusterIP` |
+| `configService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` |
+| `configService.liveness.periodSeconds` | The period seconds of liveness probe | `10` |
+| `configService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` |
+| `configService.readiness.periodSeconds` | The period seconds of readiness probe | `5` |
+| `configService.config.configServiceUrlOverride` | Override `apollo.config-service.url`: config service url to be accessed by apollo-client | `nil` |
+| `configService.config.adminServiceUrlOverride` | Override `apollo.admin-service.url`: admin service url to be accessed by apollo-portal | `nil` |
+| `configService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` |
+| `configService.strategy` | The deployment strategy of apollo-configservice | `{}` |
+| `configService.resources` | The resources definition of apollo-configservice | `{}` |
+| `configService.nodeSelector` | The node selector definition of apollo-configservice | `{}` |
+| `configService.tolerations` | The tolerations definition of apollo-configservice | `[]` |
+| `configService.affinity` | The affinity definition of apollo-configservice | `{}` |
+| `adminService.fullNameOverride` | Override the deployment name for apollo-adminservice | `nil` |
+| `adminService.replicaCount` | Replica count of apollo-adminservice | `2` |
+| `adminService.containerPort` | Container port of apollo-adminservice | `8090` |
+| `adminService.image.repository` | Image repository of apollo-adminservice | `apolloconfig/apollo-adminservice` |
+| `adminService.image.pullPolicy`                | Image pull policy of apollo-adminservice | `IfNotPresent` |
+| `adminService.imagePullSecrets`                | Image pull secrets of apollo-adminservice | `[]` |
+| `adminService.service.fullNameOverride` | Override the service name for apollo-adminservice | `nil` |
+| `adminService.service.port` | The port for the service of apollo-adminservice | `8090` |
+| `adminService.service.targetPort` | The target port for the service of apollo-adminservice | `8090` |
+| `adminService.service.type` | The service type of apollo-adminservice                     | `ClusterIP` |
+| `adminService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` |
+| `adminService.liveness.periodSeconds` | The period seconds of liveness probe | `10` |
+| `adminService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` |
+| `adminService.readiness.periodSeconds` | The period seconds of readiness probe | `5` |
+| `adminService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` |
+| `adminService.strategy` | The deployment strategy of apollo-adminservice | `{}` |
+| `adminService.resources` | The resources definition of apollo-adminservice | `{}` |
+| `adminService.nodeSelector` | The node selector definition of apollo-adminservice | `{}` |
+| `adminService.tolerations` | The tolerations definition of apollo-adminservice | `[]` |
+| `adminService.affinity` | The affinity definition of apollo-adminservice | `{}` |
+
+## 5. Deployments of apollo-portal
+
+### 5.1 Installation
+
+To install the apollo-portal chart with the release name `apollo-portal`:
+
+```bash
+$ helm install apollo-portal \
+    --set portaldb.host=1.2.3.4 \
+    --set portaldb.userName=apollo \
+    --set portaldb.password=apollo \
+    --set portaldb.service.enabled=true \
+    --set config.envs="dev\,pro" \
+    --set config.metaServers.dev=http://apollo-service-dev-apollo-configservice:8080 \
+    --set config.metaServers.pro=http://apollo-service-pro-apollo-configservice:8080 \
+    --set replicaCount=1 \
+    apollo/apollo-portal
+```
+
+Or customize it with values.yaml
+
+```bash
+$ helm install apollo-portal -f values.yaml apollo/apollo-portal 
+```
+
+### 5.2 Uninstallation
+
+To uninstall/delete the `apollo-portal` deployment:
+
+```bash
+$ helm uninstall apollo-portal
+```
+
+### 5.3 Configuration
+
+The following table lists the configurable parameters of the apollo-portal chart and their default values.
+
+| Parameter            | Description                                 | Default               |
+|----------------------|---------------------------------------------|-----------------------|
+| `fullNameOverride` | Override the deployment name for apollo-portal | `nil` |
+| `replicaCount` | Replica count of apollo-portal | `2` |
+| `containerPort` | Container port of apollo-portal | `8070` |
+| `image.repository` | Image repository of apollo-portal | `apolloconfig/apollo-portal` |
+| `image.pullPolicy`                | Image pull policy of apollo-portal | `IfNotPresent` |
+| `imagePullSecrets`                | Image pull secrets of apollo-portal | `[]` |
+| `service.fullNameOverride` | Override the service name for apollo-portal | `nil` |
+| `service.port` | The port for the service of apollo-portal | `8070` |
+| `service.targetPort` | The target port for the service of apollo-portal | `8070` |
+| `service.type` | The service type of apollo-portal                     | `ClusterIP` |
+| `service.sessionAffinity` | The session affinity for the service of apollo-portal | `ClientIP` |
+| `ingress.enabled` | Whether to enable the ingress or not | `false` |
+| `ingress.annotations` | The annotations of the ingress | `{}` |
+| `ingress.hosts.host` | The host of the ingress | `nil` |
+| `ingress.hosts.paths` | The paths of the ingress | `[]` |
+| `ingress.tls` | The tls definition of the ingress | `[]` |
+| `liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` |
+| `liveness.periodSeconds` | The period seconds of liveness probe | `10` |
+| `readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` |
+| `readiness.periodSeconds` | The period seconds of readiness probe | `5` |
+| `env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` |
+| `strategy` | The deployment strategy of apollo-portal | `{}` |
+| `resources` | The resources definition of apollo-portal | `{}` |
+| `nodeSelector` | The node selector definition of apollo-portal | `{}` |
+| `tolerations` | The tolerations definition of apollo-portal | `[]` |
+| `affinity` | The affinity definition of apollo-portal | `{}` |
+| `config.envs` | specify the env names, e.g. dev,pro | `nil` |
+| `config.metaServers` | specify the meta servers, e.g.<br />`dev: http://apollo-configservice-dev:8080`<br />`pro: http://apollo-configservice-pro:8080` | `{}` |
+| `portaldb.host` | The host for apollo portal db | `nil`                              |
+| `portaldb.port` | The port for apollo portal db | `3306` |
+| `portaldb.dbName` | The database name for apollo portal db | `ApolloPortalDB`                                     |
+| `portaldb.userName` | The user name for apollo portal db | `nil` |
+| `portaldb.password` | The password for apollo portal db | `nil` |
+| `portaldb.connectionStringProperties` | The connection string properties for apollo portal db | `characterEncoding=utf8` |
+| `portaldb.service.enabled` | Whether to create a Kubernetes Service for `portaldb.host` or not. Set it to `true` if `portaldb.host` is an endpoint outside of the kubernetes cluster | `false` |
+| `portaldb.service.fullNameOverride` | Override the service name for apollo portal db | `nil` |
+| `portaldb.service.port` | The port for the service of apollo portal db | `3306` |
+| `portaldb.service.type` | The service type of apollo portal db: `ClusterIP` or `ExternalName` | `ClusterIP` |

+ 23 - 0
scripts/helm/apollo-portal/.helmignore

@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/

+ 12 - 0
scripts/helm/apollo-portal/Chart.yaml

@@ -0,0 +1,12 @@
+apiVersion: v2
+name: apollo-portal
+description: A Helm chart for Apollo Portal
+type: application
+version: 0.1.0
+appVersion: 1.7.0-SNAPSHOT
+home: https://github.com/ctripcorp/apollo
+icon: https://raw.githubusercontent.com/ctripcorp/apollo/master/apollo-portal/src/main/resources/static/img/logo-simple.png
+maintainers:
+- name: nobodyiam
+  email: nobodyiam@gmail.com
+  url: https://github.com/nobodyiam

+ 21 - 0
scripts/helm/apollo-portal/templates/NOTES.txt

@@ -0,0 +1,21 @@
+Get apollo portal url by running these commands:
+{{- if .Values.ingress.enabled }}
+{{- range $host := .Values.ingress.hosts }}
+  {{- range .paths }}
+  http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
+  {{- end }}
+{{- end }}
+{{- else if contains "NodePort" .Values.service.type }}
+  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "apollo.portal.fullName" . }})
+  export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
+  echo http://$NODE_IP:$NODE_PORT
+{{- else if contains "LoadBalancer" .Values.service.type }}
+     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
+           You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "apollo.portal.fullName" . }}'
+  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "apollo.portal.serviceName" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
+  echo http://$SERVICE_IP:{{ .Values.service.port }}
+{{- else if contains "ClusterIP" .Values.service.type }}
+  export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "apollo.portal.fullName" . }}" -o jsonpath="{.items[0].metadata.name}")
+  echo "Visit http://127.0.0.1:8070 to use your application"
+  kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8070:8070
+{{- end }}

+ 51 - 0
scripts/helm/apollo-portal/templates/_helpers.tpl

@@ -0,0 +1,51 @@
+{{/* vim: set filetype=mustache: */}}
+
+{{/*
+Full name for apollo-portal
+*/}}
+{{- define "apollo.portal.fullName" -}}
+{{- if .Values.fullNameOverride -}}
+{{- .Values.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- if contains .Values.name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name .Values.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Common labels
+*/}}
+{{- define "apollo.portal.labels" -}}
+{{- if .Chart.AppVersion -}}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+{{- end -}}
+
+{{/*
+Service name for portal
+*/}}
+{{- define "apollo.portal.serviceName" -}}
+{{- if .Values.service.fullNameOverride -}}
+{{- .Values.service.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{ include "apollo.portal.fullName" .}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Service name for portaldb
+*/}}
+{{- define "apollo.portaldb.serviceName" -}}
+{{- if .Values.portaldb.service.enabled -}}
+{{- if .Values.portaldb.service.fullNameOverride -}}
+{{- .Values.portaldb.service.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name .Values.portaldb.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- else -}}
+{{- .Values.portaldb.host -}}
+{{- end -}}
+{{- end -}}

+ 102 - 0
scripts/helm/apollo-portal/templates/deployment-portal.yaml

@@ -0,0 +1,102 @@
+---
+# configmap for apollo-portal
+kind: ConfigMap
+apiVersion: v1
+metadata:
+  {{- $portalFullName := include "apollo.portal.fullName" . }}
+  name: {{ $portalFullName }}
+data:
+  application-github.properties: |
+    spring.datasource.url = jdbc:mysql://{{include "apollo.portaldb.serviceName" .}}:{{ .Values.portaldb.service.port }}/{{ .Values.portaldb.dbName }}{{ if .Values.portaldb.connectionStringProperties }}?{{ .Values.portaldb.connectionStringProperties }}{{ end }}
+    spring.datasource.username = {{ required "portaldb.userName is required!" .Values.portaldb.userName }}
+    spring.datasource.password = {{ required "portaldb.password is required!" .Values.portaldb.password }}
+    {{- if .Values.config.envs }}
+    apollo.portal.envs = {{ .Values.config.envs }}
+    {{- end }}
+  apollo-env.properties: |
+    {{- range $env, $address := .Values.config.metaServers }}
+    {{ $env }}.meta = {{ $address }}
+    {{- end }}
+
+---
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: {{ $portalFullName }}
+  labels:
+    {{- include "apollo.portal.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ $portalFullName }}
+  {{- with .Values.strategy }}
+  strategy:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        app: {{ $portalFullName }}
+    spec:
+      {{- with .Values.imagePullSecrets }}
+        imagePullSecrets:
+          {{- toYaml . | nindent 8 }}
+      {{- end }}
+      volumes:
+        - name: configmap-{{ $portalFullName }}
+          configMap:
+            name: {{ $portalFullName }}
+            items:
+              - key: application-github.properties
+                path: application-github.properties
+              - key: apollo-env.properties
+                path: apollo-env.properties
+            defaultMode: 420
+      containers:
+        - name: {{ .Values.name }}
+          image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          ports:
+            - name: http
+              containerPort: {{ .Values.containerPort }}
+              protocol: TCP
+          {{- with .Values.env }}
+          env:
+          {{- range $key, $value := . }}
+            - name: {{ $key }}
+              value: {{ $value }}
+          {{- end }}
+          {{- end }}
+          volumeMounts:
+            - name: configmap-{{ $portalFullName }}
+              mountPath: /apollo-portal/config/application-github.properties
+              subPath: application-github.properties
+            - name: configmap-{{ $portalFullName }}
+              mountPath: /apollo-portal/config/apollo-env.properties
+              subPath: apollo-env.properties
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.containerPort }}
+            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.liveness.periodSeconds }}
+          readinessProbe:
+            httpGet:
+              path: /health
+              port: {{ .Values.containerPort }}
+            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.readiness.periodSeconds }}
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+    {{- with .Values.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}

+ 41 - 0
scripts/helm/apollo-portal/templates/ingress-portal.yaml

@@ -0,0 +1,41 @@
+{{- if .Values.ingress.enabled -}}
+{{- $fullName := include "apollo.portal.fullName" . -}}
+{{- $svcPort := .Values.service.port -}}
+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta1
+{{- else -}}
+apiVersion: extensions/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+  name: {{ $fullName }}
+  labels:
+    {{- include "apollo.portal.labels" . | nindent 4 }}
+  {{- with .Values.ingress.annotations }}
+  annotations:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+spec:
+{{- if .Values.ingress.tls }}
+  tls:
+  {{- range .Values.ingress.tls }}
+    - hosts:
+      {{- range .hosts }}
+        - {{ . | quote }}
+      {{- end }}
+      secretName: {{ .secretName }}
+  {{- end }}
+{{- end }}
+  rules:
+  {{- range .Values.ingress.hosts }}
+    - host: {{ .host | quote }}
+      http:
+        paths:
+        {{- range .paths }}
+          - path: {{ . }}
+            backend:
+              serviceName: {{ $fullName }}
+              servicePort: {{ $svcPort }}
+        {{- end }}
+  {{- end }}
+{{- end }}

+ 16 - 0
scripts/helm/apollo-portal/templates/service-portal.yaml

@@ -0,0 +1,16 @@
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ include "apollo.portal.serviceName" . }}
+  labels:
+    {{- include "apollo.portal.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.type }}
+  ports:
+    - name: http
+      protocol: TCP
+      port: {{ .Values.service.port }}
+      targetPort: {{ .Values.service.targetPort }}
+  selector:
+    app: {{ include "apollo.portal.fullName" . }}
+  sessionAffinity: {{ .Values.service.sessionAffinity }}

+ 31 - 0
scripts/helm/apollo-portal/templates/service-portaldb.yaml

@@ -0,0 +1,31 @@
+{{- if .Values.portaldb.service.enabled -}}
+---
+# service definition for mysql
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{include "apollo.portaldb.serviceName" .}}
+  labels:
+    {{- include "apollo.portal.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.portaldb.service.type }}
+{{- if eq .Values.portaldb.service.type "ExternalName" }}
+  externalName: {{ required "portaldb.host is required!" .Values.portaldb.host }}
+{{- else }}
+  ports:
+    - protocol: TCP
+      port: {{ .Values.portaldb.service.port }}
+      targetPort: {{ .Values.portaldb.port }}
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+  name: {{include "apollo.portaldb.serviceName" .}}
+subsets:
+  - addresses:
+      - ip: {{ required "portaldb.host is required!" .Values.portaldb.host }}
+    ports:
+      - protocol: TCP
+        port: {{ .Values.portaldb.port }}
+{{- end }}
+{{- end }}

+ 60 - 0
scripts/helm/apollo-portal/values.yaml

@@ -0,0 +1,60 @@
+name: apollo-portal
+fullNameOverride: ""
+replicaCount: 2
+containerPort: 8070
+image:
+  repository: apolloconfig/apollo-portal
+  pullPolicy: IfNotPresent
+imagePullSecrets: []
+service:
+  fullNameOverride: ""
+  port: 8070
+  targetPort: 8070
+  type: ClusterIP
+  sessionAffinity: ClientIP
+ingress:
+  enabled: false
+  annotations: {}
+  hosts:
+    - host: ""
+      paths: []
+  tls: []
+liveness:
+  initialDelaySeconds: 100
+  periodSeconds: 10
+readiness:
+  initialDelaySeconds: 30
+  periodSeconds: 5
+# environment variables passed to the container, e.g. JAVA_OPTS
+env: {}
+strategy: {}
+resources: {}
+nodeSelector: {}
+tolerations: []
+affinity: {}
+
+config:
+  # specify the env names, e.g. dev,pro
+  envs: ""
+  # specify the meta servers, e.g.
+  # dev: http://apollo-configservice-dev:8080
+  # pro: http://apollo-configservice-pro:8080
+  metaServers: {}
+
+portaldb:
+  name: apollo-portaldb
+  # apolloportaldb host
+  host:
+  port: 3306
+  dbName: ApolloPortalDB
+  # apolloportaldb user name
+  userName:
+  # apolloportaldb password
+  password:
+  connectionStringProperties: characterEncoding=utf8
+  service:
+    # whether to create a Service for this host or not
+    enabled: false
+    fullNameOverride: ""
+    port: 3306
+    type: ClusterIP

+ 23 - 0
scripts/helm/apollo-service/.helmignore

@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/

+ 12 - 0
scripts/helm/apollo-service/Chart.yaml

@@ -0,0 +1,12 @@
+apiVersion: v2
+name: apollo-service
+description: A Helm chart for Apollo Config Service and Apollo Admin Service
+type: application
+version: 0.1.0
+appVersion: 1.7.0-SNAPSHOT
+home: https://github.com/ctripcorp/apollo
+icon: https://raw.githubusercontent.com/ctripcorp/apollo/master/apollo-portal/src/main/resources/static/img/logo-simple.png
+maintainers:
+- name: nobodyiam
+  email: nobodyiam@gmail.com
+  url: https://github.com/nobodyiam

+ 18 - 0
scripts/helm/apollo-service/templates/NOTES.txt

@@ -0,0 +1,18 @@
+Get meta service url for current release by running these commands:
+{{- if contains "NodePort" .Values.configService.service.type }}
+  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "apollo.configService.fullName" . }})
+  export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
+  echo http://$NODE_IP:$NODE_PORT
+{{- else if contains "LoadBalancer" .Values.configService.service.type }}
+     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
+           You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "apollo.configService.fullName" . }}'
+  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "apollo.configService.serviceName" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
+  echo http://$SERVICE_IP:{{ .Values.service.port }}
+{{- else if contains "ClusterIP" .Values.configService.service.type }}
+  echo http://{{ include "apollo.configService.serviceName" .}}.{{ .Release.Namespace }}:{{ .Values.configService.service.port }}
+
+For local test use:
+  export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "apollo.configService.fullName" . }}" -o jsonpath="{.items[0].metadata.name}")
+  echo http://127.0.0.1:8080
+  kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:8080
+{{- end }}

+ 99 - 0
scripts/helm/apollo-service/templates/_helpers.tpl

@@ -0,0 +1,99 @@
+{{/* vim: set filetype=mustache: */}}
+
+{{/*
+Common labels
+*/}}
+{{- define "apollo.service.labels" -}}
+{{- if .Chart.AppVersion -}}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+{{- end -}}
+
+{{/*
+Service name for configdb
+*/}}
+{{- define "apollo.configdb.serviceName" -}}
+{{- if .Values.configdb.service.enabled -}}
+{{- if .Values.configdb.service.fullNameOverride -}}
+{{- .Values.configdb.service.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name .Values.configdb.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- else -}}
+{{- .Values.configdb.host -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Full name for config service
+*/}}
+{{- define "apollo.configService.fullName" -}}
+{{- if .Values.configService.fullNameOverride -}}
+{{- .Values.configService.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- if contains .Values.configService.name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name .Values.configService.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Service name for config service
+*/}}
+{{- define "apollo.configService.serviceName" -}}
+{{- if .Values.configService.service.fullNameOverride -}}
+{{- .Values.configService.service.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{ include "apollo.configService.fullName" .}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Config service url to be accessed by apollo-client
+*/}}
+{{- define "apollo.configService.serviceUrl" -}}
+{{- if .Values.configService.config.configServiceUrlOverride -}}
+{{ .Values.configService.config.configServiceUrlOverride }}
+{{- else -}}
+http://{{ include "apollo.configService.serviceName" .}}.{{ .Release.Namespace }}:{{ .Values.configService.service.port }}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Full name for admin service
+*/}}
+{{- define "apollo.adminService.fullName" -}}
+{{- if .Values.adminService.fullNameOverride -}}
+{{- .Values.adminService.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- if contains .Values.adminService.name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name .Values.adminService.name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Service name for admin service
+*/}}
+{{- define "apollo.adminService.serviceName" -}}
+{{- if .Values.adminService.service.fullNameOverride -}}
+{{- .Values.adminService.service.fullNameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{ include "apollo.adminService.fullName" .}}
+{{- end -}}
+{{- end -}}
+
+{{/*
+Admin service url to be accessed by apollo-portal
+*/}}
+{{- define "apollo.adminService.serviceUrl" -}}
+{{- if .Values.configService.config.adminServiceUrlOverride -}}
+{{ .Values.configService.config.adminServiceUrlOverride -}}
+{{- else -}}
+http://{{ include "apollo.adminService.serviceName" .}}.{{ .Release.Namespace }}:{{ .Values.adminService.service.port }}
+{{- end -}}
+{{- end -}}

+ 90 - 0
scripts/helm/apollo-service/templates/deployment-adminservice.yaml

@@ -0,0 +1,90 @@
+---
+# configmap for apollo-adminservice
+kind: ConfigMap
+apiVersion: v1
+metadata:
+  {{- $adminServiceFullName := include "apollo.adminService.fullName" . }}
+  name: {{ $adminServiceFullName }}
+data:
+  application-github.properties: |
+    spring.datasource.url = jdbc:mysql://{{include "apollo.configdb.serviceName" .}}:{{ .Values.configdb.service.port }}/{{ .Values.configdb.dbName }}{{ if .Values.configdb.connectionStringProperties }}?{{ .Values.configdb.connectionStringProperties }}{{ end }}
+    spring.datasource.username = {{ required "configdb.userName is required!" .Values.configdb.userName }}
+    spring.datasource.password = {{ required "configdb.password is required!" .Values.configdb.password }}
+
+---
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: {{ $adminServiceFullName }}
+  labels:
+    {{- include "apollo.service.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.adminService.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ $adminServiceFullName }}
+  {{- with .Values.adminService.strategy }}
+  strategy:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        app: {{ $adminServiceFullName }}
+    spec:
+      {{- with .Values.adminService.imagePullSecrets }}
+        imagePullSecrets:
+          {{- toYaml . | nindent 8 }}
+      {{- end }}
+      volumes:
+        - name: volume-configmap-{{ $adminServiceFullName }}
+          configMap:
+            name: {{ $adminServiceFullName }}
+            items:
+              - key: application-github.properties
+                path: application-github.properties
+            defaultMode: 420
+      containers:
+        - name: {{ .Values.adminService.name }}
+          image: "{{ .Values.adminService.image.repository }}:{{ .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.adminService.image.pullPolicy }}
+          ports:
+            - name: http
+              containerPort: {{ .Values.adminService.containerPort }}
+              protocol: TCP
+          env:
+            - name: SPRING_PROFILES_ACTIVE
+              value: 'github,kubernetes'
+          {{- range $key, $value := .Values.adminService.env }}
+            - name: {{ $key }}
+              value: {{ $value }}
+          {{- end }}
+          volumeMounts:
+            - name: volume-configmap-{{ $adminServiceFullName }}
+              mountPath: /apollo-adminservice/config/application-github.properties
+              subPath: application-github.properties
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.adminService.containerPort }}
+            initialDelaySeconds: {{ .Values.adminService.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.adminService.liveness.periodSeconds }}
+          readinessProbe:
+            httpGet:
+              path: /health
+              port: {{ .Values.adminService.containerPort }}
+            initialDelaySeconds: {{ .Values.adminService.readiness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.adminService.readiness.periodSeconds }}
+          resources:
+            {{- toYaml .Values.adminService.resources | nindent 12 }}
+    {{- with .Values.adminService.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.adminService.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.adminService.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}

+ 92 - 0
scripts/helm/apollo-service/templates/deployment-configservice.yaml

@@ -0,0 +1,92 @@
+---
+# configmap for apollo-configservice
+kind: ConfigMap
+apiVersion: v1
+metadata:
+  {{- $configServiceFullName := include "apollo.configService.fullName" . }}
+  name: {{ $configServiceFullName }}
+data:
+  application-github.properties: |
+    spring.datasource.url = jdbc:mysql://{{include "apollo.configdb.serviceName" .}}:{{ .Values.configdb.service.port }}/{{ .Values.configdb.dbName }}{{ if .Values.configdb.connectionStringProperties }}?{{ .Values.configdb.connectionStringProperties }}{{ end }}
+    spring.datasource.username = {{ required "configdb.userName is required!" .Values.configdb.userName }}
+    spring.datasource.password = {{ required "configdb.password is required!" .Values.configdb.password }}
+    apollo.config-service.url = {{ include "apollo.configService.serviceUrl" .}}
+    apollo.admin-service.url = {{ include "apollo.adminService.serviceUrl" .}}
+
+---
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: {{ $configServiceFullName }}
+  labels:
+    {{- include "apollo.service.labels" . | nindent 4 }}
+spec:
+  replicas: {{ .Values.configService.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ $configServiceFullName }}
+  {{- with .Values.configService.strategy }}
+  strategy:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+  template:
+    metadata:
+      labels:
+        app: {{ $configServiceFullName }}
+    spec:
+      {{- with .Values.configService.imagePullSecrets }}
+        imagePullSecrets:
+          {{- toYaml . | nindent 8 }}
+      {{- end }}
+      volumes:
+        - name: volume-configmap-{{ $configServiceFullName }}
+          configMap:
+            name: {{ $configServiceFullName }}
+            items:
+              - key: application-github.properties
+                path: application-github.properties
+            defaultMode: 420
+      containers:
+        - name: {{ .Values.configService.name }}
+          image: "{{ .Values.configService.image.repository }}:{{ .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.configService.image.pullPolicy }}
+          ports:
+            - name: http
+              containerPort: {{ .Values.configService.containerPort }}
+              protocol: TCP
+          env:
+            - name: SPRING_PROFILES_ACTIVE
+              value: 'github,kubernetes'
+          {{- range $key, $value := .Values.configService.env }}
+            - name: {{ $key }}
+              value: {{ $value }}
+          {{- end }}
+          volumeMounts:
+            - name: volume-configmap-{{ $configServiceFullName }}
+              mountPath: /apollo-configservice/config/application-github.properties
+              subPath: application-github.properties
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.configService.containerPort }}
+            initialDelaySeconds: {{ .Values.configService.liveness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.configService.liveness.periodSeconds }}
+          readinessProbe:
+            httpGet:
+              path: /health
+              port: {{ .Values.configService.containerPort }}
+            initialDelaySeconds: {{ .Values.configService.readiness.initialDelaySeconds }}
+            periodSeconds: {{ .Values.configService.readiness.periodSeconds }}
+          resources:
+            {{- toYaml .Values.configService.resources | nindent 12 }}
+    {{- with .Values.configService.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.configService.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.configService.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}

+ 15 - 0
scripts/helm/apollo-service/templates/service-adminservice.yaml

@@ -0,0 +1,15 @@
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ include "apollo.adminService.serviceName" . }}
+  labels:
+    {{- include "apollo.service.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.adminService.service.type }}
+  ports:
+    - name: http
+      protocol: TCP
+      port: {{ .Values.adminService.service.port }}
+      targetPort: {{ .Values.adminService.service.targetPort }}
+  selector:
+    app: {{ include "apollo.adminService.fullName" . }}

+ 31 - 0
scripts/helm/apollo-service/templates/service-configdb.yaml

@@ -0,0 +1,31 @@
+{{- if .Values.configdb.service.enabled -}}
+---
+# service definition for mysql
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{include "apollo.configdb.serviceName" .}}
+  labels:
+    {{- include "apollo.service.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.configdb.service.type }}
+{{- if eq .Values.configdb.service.type "ExternalName" }}
+  externalName: {{ required "configdb.host is required!" .Values.configdb.host }}
+{{- else }}
+  ports:
+    - protocol: TCP
+      port: {{ .Values.configdb.service.port }}
+      targetPort: {{ .Values.configdb.port }}
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+  name: {{include "apollo.configdb.serviceName" .}}
+subsets:
+  - addresses:
+      - ip: {{ required "configdb.host is required!" .Values.configdb.host }}
+    ports:
+      - protocol: TCP
+        port: {{ .Values.configdb.port }}
+{{- end }}
+{{- end }}

+ 15 - 0
scripts/helm/apollo-service/templates/service-configservice.yaml

@@ -0,0 +1,15 @@
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ include "apollo.configService.serviceName" . }}
+  labels:
+    {{- include "apollo.service.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.configService.service.type }}
+  ports:
+    - name: http
+      protocol: TCP
+      port: {{ .Values.configService.service.port }}
+      targetPort: {{ .Values.configService.service.targetPort }}
+  selector:
+    app: {{ include "apollo.configService.fullName" . }}

+ 78 - 0
scripts/helm/apollo-service/values.yaml

@@ -0,0 +1,78 @@
+configdb:
+  name: apollo-configdb
+  # apolloconfigdb host
+  host: ""
+  port: 3306
+  dbName: ApolloConfigDB
+  # apolloconfigdb user name
+  userName: ""
+  # apolloconfigdb password
+  password: ""
+  connectionStringProperties: characterEncoding=utf8
+  service:
+    # whether to create a Service for this host or not
+    enabled: false
+    fullNameOverride: ""
+    port: 3306
+    type: ClusterIP
+
+configService:
+  name: apollo-configservice
+  fullNameOverride: ""
+  replicaCount: 2
+  containerPort: 8080
+  image:
+    repository: apolloconfig/apollo-configservice
+    pullPolicy: IfNotPresent
+  imagePullSecrets: []
+  service:
+    fullNameOverride: ""
+    port: 8080
+    targetPort: 8080
+    type: ClusterIP
+  liveness:
+    initialDelaySeconds: 100
+    periodSeconds: 10
+  readiness:
+    initialDelaySeconds: 30
+    periodSeconds: 5
+  config:
+    # override apollo.config-service.url: config service url to be accessed by apollo-client 
+    configServiceUrlOverride: ""
+    # override apollo.admin-service.url: admin service url to be accessed by apollo-portal 
+    adminServiceUrlOverride: ""
+  # environment variables passed to the container, e.g. JAVA_OPTS
+  env: {}
+  strategy: {}
+  resources: {}
+  nodeSelector: {}
+  tolerations: []
+  affinity: {}
+
+adminService:
+  name: apollo-adminservice
+  fullNameOverride: ""
+  replicaCount: 2
+  containerPort: 8090
+  image:
+    repository: apolloconfig/apollo-adminservice
+    pullPolicy: IfNotPresent
+  imagePullSecrets: []
+  service:
+    fullNameOverride: ""
+    port: 8090
+    targetPort: 8090
+    type: ClusterIP
+  liveness:
+    initialDelaySeconds: 100
+    periodSeconds: 10
+  readiness:
+    initialDelaySeconds: 30
+    periodSeconds: 5
+  # environment variables passed to the container, e.g. JAVA_OPTS
+  env: {}
+  strategy: {}
+  resources: {}
+  nodeSelector: {}
+  tolerations: []
+  affinity: {}