Skip to content

Commit

Permalink
Adding environment field to the helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
pubudu538 committed Oct 6, 2023
1 parent c0f43f4 commit 639c108
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,5 @@ since new lines in different OSs differ (Linux: \n, Windows: \r\n) */
public static final String DEFAULT_CON_FACTORY_JNDI_NAME = "TopicConnectionFactory";

// multi-env constants
public static final String DEFAULT_ENVIRONMENT_TOKEN_ISSUER = "*";
public static final String DEFAULT_ENVIRONMENT = "Default";
public static final String DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER = "*";
}
Original file line number Diff line number Diff line change
Expand Up @@ -439,23 +439,14 @@ public JWTValidator getJWTValidatorByIssuer(String issuer, String organization,

if (orgBaseJWTValidators != null) {

String mapKey;
if (environment.equals(Constants.DEFAULT_ENVIRONMENT)) {
mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer);
} else {
mapKey = getMapKey(environment, issuer);
}

String mapKey = getMapKey(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER, issuer);
JWTValidator jwtValidator = orgBaseJWTValidators.get(mapKey);
if (jwtValidator != null) {
return jwtValidator;
}

// Fall back to the default environment if the validator is not found
if (!environment.equals(Constants.DEFAULT_ENVIRONMENT)) {
mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer);
return orgBaseJWTValidators.get(mapKey);
}
mapKey = getMapKey(environment, issuer);
return orgBaseJWTValidators.get(mapKey);
}

return null;
Expand All @@ -471,7 +462,7 @@ private List<String> getEnvironments(JWTIssuer jwtIssuer) {
environmentsList.add(jwtIssuer.getEnvironments(i));
}
} else {
environmentsList.add(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER);
environmentsList.add(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER);
}
return environmentsList;
}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ A Helm chart for APK components
| wso2.apk.idp.signing.secretName | string | `""` | IDP jwt signing certificate secret name |
| wso2.apk.idp.signing.fileName | string | `""` | IDP jwt signing certificate file name |
| wso2.apk.dp.enabled | bool | `true` | Enable the deployment of the Data Plane |
| wso2.apk.dp.environment | string | `Default` | Environment of the Data Plane |
| wso2.apk.dp.gateway.listener.hostname | string | `"gw.wso2.com"` | Gateway Listener Hostname |
| wso2.apk.dp.gateway.listener.secretName | string | `""` | Gateway Listener Certificate Secret Name |
| wso2.apk.dp.gateway.autoscaling.enabled | bool | `false` | Enable autoscaling for Gateway |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ metadata:
data:
config.toml: |
[commoncontroller]
{{- if .Values.wso2.apk.dp.environment }}
environment = "{{ .Values.wso2.apk.dp.environment }}"
{{- end }}
[commoncontroller.server]
label = "ratelimiter"
{{ if and .Values.wso2.apk.dp.commonController.configs .Values.wso2.apk.dp.commonController.configs.apiNamespaces }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ metadata:
data:
config.toml: |
[adapter]
{{- if .Values.wso2.apk.dp.environment }}
environment = "{{ .Values.wso2.apk.dp.environment }}"
{{- end }}
{{ if and .Values.wso2.apk.dp.adapter.configs .Values.wso2.apk.dp.adapter.configs.apiNamespaces }}
[adapter.operator]
namespaces = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.adapter.configs.apiNamespaces}}]
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/values.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ wso2:
dp:
# -- Enable the deployment of the Data Plane
enabled: true
# -- Environment Name of the Data Plane
environment: "Development"
gateway:
listener:
# -- Gateway Listener Hostname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void waitForNextMinuteStrictly() throws InterruptedException {
LocalDateTime now = LocalDateTime.now();
LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0);
long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS);
Thread.sleep((secondsToWait+2) * 1000);
Thread.sleep((secondsToWait+1) * 1000);
logger.info("Current time: " + LocalDateTime.now());
}

Expand Down

0 comments on commit 639c108

Please sign in to comment.