Build error when k8s ingress is used
### Description:
When k8s ingress is enabled in the deployment-config.toml, it gives an build error when trying to resolve the key store path of the listener starting on 9096 port.

### Steps to reproduce:
Use the following deployment-config.toml file and issue the build command
Then following error happens

`[kubernetes]
  [kubernetes.kubernetesDeployment]
    enable = true
    #name = ''
    #labels = ''
    #replicas = ''
    #enableLiveness = ''
    #initialDelaySeconds = ''
    #periodSeconds = ''
    #livenessPort = ''
    imagePullPolicy = 'Always'
    baseImage = 'wso2/wso2micro-gw:3.0.1'
    image = 'petstore:3.0.0'
    buildImage = true
    push = true
    #env = ''
    #[kubernetes.kubernetesDeployment.copyFiles]
    #  enable = true
    #  [[kubernetes.kubernetesDeployment.copyFiles.files]]
    #    source = '/home/user/custom_truststore.p12'
    #    target = '/home/ballerina/runtime/bre/security'
    #    isBallerinaConf = false
    #  [[kubernetes.kubernetesDeployment.copyFiles.files]]
    #    source = '/home/user/keystore.p12'
    #    target = '/home/ballerina/runtime/bre/security'
    #    isBallerinaConf = false 
    #dockerHost = ''
    #dockerCertPath = '' 
    #singleYAML = ''
  [kubernetes.kubernetesService]
    enable = true
    #name = 'petstore_service'
    #labels = ''
    serviceType = 'LoadBalancer'
    #port = ''
  [kubernetes.kubernetesConfigMap]
    enable = true
    ballerinaConf = '/Users/rajithroshan/Documents/APIM/cli_restructure/wso2am-micro-gw-toolkit-3.0.2-SNAPSHOT/resources/conf/micro-gw.conf'
    #[[kubernetes.kubernetesConfigMap.configMaps]]
    #    name = ''
    #    mountPath = ''
    #    readOnly = false
    #    data = ['']
  [kubernetes.secureKubernetesIngress]
    enable = true
    name = 'pets_ingress'
    #labels = ''
    hostname = 'rajith.petstore.com'
    keyStorePath = '${ballerina.home}/bre/security/ballerinaKeystore.p12'
    keyStorePassword = '$env{Keystore_Password}'
    #annotations = ''
    path = '/'
    #targetPath = ''
    #ingressClass = ''`

### Affected Product Version:
3.0.1

### OS, DB, other environment details and versions:
- OS:mac
- Client:
- DB:
- Env (Docker/K8s):K8s

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-committers-->

#### Suggested Assignees:
<!--Only to be used by non-committers-->

diff --git a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/model/config/SecureKubernetesIngress.java b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/model/config/SecureKubernetesIngress.java
index b8f2c6023..2175ab50b 100644
--- a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/model/config/SecureKubernetesIngress.java
+++ b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/model/config/SecureKubernetesIngress.java
@@ -31,6 +31,8 @@ public class SecureKubernetesIngress {
     private String ingressClass;
     private boolean enableTLS = true;
     private boolean enable = false;
+    private String keyStorePath;
+    private String keyStorePassword;
 
     public String getName() {
         if (name == null) {
@@ -108,5 +110,21 @@ public class SecureKubernetesIngress {
     public void setEnable(boolean enable) {
         this.enable = enable;
     }
+
+    public String getKeyStorePath() {
+        return keyStorePath;
+    }
+
+    public void setKeyStorePath(String keyStorePath) {
+        this.keyStorePath = keyStorePath;
+    }
+
+    public String getKeyStorePassword() {
+        return keyStorePassword;
+    }
+
+    public void setKeyStorePassword(String keyStorePassword) {
+        this.keyStorePassword = keyStorePassword;
+    }
 }
 
diff --git a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/CodegenUtils.java b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/CodegenUtils.java
index 3f31a1b6f..f5bbbcbb5 100644
--- a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/CodegenUtils.java
+++ b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/CodegenUtils.java
@@ -22,6 +22,8 @@ import com.github.jknack.handlebars.Template;
 import com.github.jknack.handlebars.helper.StringHelpers;
 import com.github.jknack.handlebars.io.ClassPathTemplateLoader;
 import com.github.jknack.handlebars.io.FileTemplateLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.wso2.apimgt.gateway.cli.constants.GeneratorConstants;
 import org.wso2.apimgt.gateway.cli.model.template.GenSrcFile;
 
@@ -37,6 +39,9 @@ import java.util.UUID;
  */
 public class CodegenUtils {
 
+    private static final Logger logger = LoggerFactory.getLogger(CodegenUtils.class);
+    public static final String ENV = "$env{";
+
     /**
      * Writes a file with content to specified {@code filePath}.
      *
@@ -129,4 +134,29 @@ public class CodegenUtils {
         }
         return key;
     }
+
+    /**
+     * Resolve variable value from environment variable if $env{} is used. Else return the value.
+     *
+     * @param variable variable value
+     * @return Resolved variable
+     */
+    public static String resolveValue(String variable) {
+        if (variable != null && variable.contains(ENV)) {
+            //remove white spaces
+            variable = variable.replace(" ", "");
+            //extract variable name
+            final String envVariable = variable.substring(variable.lastIndexOf(ENV) + 5, variable.lastIndexOf("}"));
+            //resolve value
+
+            String value;
+            if ((value = System.getenv(envVariable)) != null) {
+                return value;
+            }
+            logger.warn("Environment variable for keystore password : \"" + envVariable
+                    + "\" is not set. Setting the value provided, starting with \"" + ENV + "\"");
+
+        }
+        return variable;
+    }
 }
diff --git a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/GatewayCmdUtils.java b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/GatewayCmdUtils.java
index c2159af31..5ab93b514 100644
--- a/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/GatewayCmdUtils.java
+++ b/components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/GatewayCmdUtils.java
@@ -857,9 +857,18 @@ public class GatewayCmdUtils {
     }
 
     public static void setContainerConfig(ContainerConfig containerConfig) {
+        overrideContainerConfigs(containerConfig);
         GatewayCmdUtils.containerConfig = containerConfig;
     }
 
+    private static void overrideContainerConfigs(ContainerConfig containerConfig) {
+        if (containerConfig != null && containerConfig.getKubernetes() != null
+                && containerConfig.getKubernetes().getSecureKubernetesIngress() != null) {
+            containerConfig.getKubernetes().getSecureKubernetesIngress().setKeyStorePassword(CodegenUtils
+                    .resolveValue(containerConfig.getKubernetes().getSecureKubernetesIngress().getKeyStorePassword()));
+        }
+    }
+
     public static void saveConfig(Config config, String configPath) {
         try {
             TOMLConfigParser.write(configPath, config);
diff --git a/components/micro-gateway-cli/src/main/resources/default-deployment-config.toml b/components/micro-gateway-cli/src/main/resources/default-deployment-config.toml
index 929e88e78..bcb789cbb 100644
--- a/components/micro-gateway-cli/src/main/resources/default-deployment-config.toml
+++ b/components/micro-gateway-cli/src/main/resources/default-deployment-config.toml
@@ -69,6 +69,8 @@
     #path = ''
     #targetPath = ''
     #ingressClass = ''
+    #keyStorePath = '${ballerina.home}/bre/security/ballerinaKeystore.p12'
+    #keyStorePassword = '$env{Keystore_Password}'
   [kubernetes.kubernetesHpa]
     enable = false
     #name = ''
diff --git a/components/micro-gateway-cli/src/main/resources/templates/listeners.mustache b/components/micro-gateway-cli/src/main/resources/templates/listeners.mustache
index 41b63f86a..e5c7767b3 100644
--- a/components/micro-gateway-cli/src/main/resources/templates/listeners.mustache
+++ b/components/micro-gateway-cli/src/main/resources/templates/listeners.mustache
@@ -60,13 +60,35 @@ listener gateway:APIGatewayListener apiListener = new(9090, serviceEndpointConfi
 {{>secureKubernetesIngress}}
 {{>kubernetesService}}
 listener http:Listener tokenListenerEndpoint = new (
-    {{#if containerConfig.kubernetes.kubernetesService.enable}}
+    {{#if containerConfig.kubernetes.secureKubernetesIngress.enable}}
         9096, config = {
-    {{else if containerConfig.kubernetes.secureKubernetesIngress.enable}}
+        secureSocket: {
+            keyStore: {
+                path:  {{#if containerConfig.kubernetes.secureKubernetesIngress.keyStorePath}}
+                    "{{containerConfig.kubernetes.secureKubernetesIngress.keyStorePath}}",
+                {{else}}
+                    "${ballerina.home}/bre/security/ballerinaKeystore.p12",
+                {{/if}}
+                password: {{#if containerConfig.kubernetes.secureKubernetesIngress.keyStorePassword}}
+                    "{{containerConfig.kubernetes.secureKubernetesIngress.keyStorePassword}}"
+                {{else}}
+                    "ballerina"
+                {{/if}}
+            }
+        }
+    {{else if containerConfig.kubernetes.kubernetesService.enable}}
         9096, config = {
+        host: gateway:getConfigValue(gateway:LISTENER_CONF_INSTANCE_ID, gateway:LISTENER_CONF_HOST, "localhost"),
+        secureSocket: {
+            keyStore: {
+                path: gateway:getConfigValue(gateway:LISTENER_CONF_INSTANCE_ID, gateway:LISTENER_CONF_KEY_STORE_PATH,
+                    "${ballerina.home}/bre/security/ballerinaKeystore.p12"),
+                password: gateway:getConfigValue(gateway:LISTENER_CONF_INSTANCE_ID,
+                    gateway:LISTENER_CONF_KEY_STORE_PASSWORD, "ballerina")
+            }
+        }
     {{else}}
         gateway:getConfigIntValue(gateway:LISTENER_CONF_INSTANCE_ID, gateway:TOKEN_LISTENER_PORT, 9096), config = {
-    {{/if}}
         host: gateway:getConfigValue(gateway:LISTENER_CONF_INSTANCE_ID, gateway:LISTENER_CONF_HOST, "localhost"),
         secureSocket: {
             keyStore: {
@@ -76,6 +98,7 @@ listener http:Listener tokenListenerEndpoint = new (
                     gateway:LISTENER_CONF_KEY_STORE_PASSWORD, "ballerina")
             }
         }
+    {{/if}}
     }
 );
 
['components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/CodegenUtils.java', 'components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/utils/GatewayCmdUtils.java', 'components/micro-gateway-cli/src/main/resources/default-deployment-config.toml', 'components/micro-gateway-cli/src/main/java/org/wso2/apimgt/gateway/cli/model/config/SecureKubernetesIngress.java', 'components/micro-gateway-cli/src/main/resources/templates/listeners.mustache']