Skip to content

Commit 7ae20c6

Browse files
committed
changing directory and file names for config
1 parent 6555216 commit 7ae20c6

File tree

10 files changed

+26
-27
lines changed

10 files changed

+26
-27
lines changed

deployment/templates/configmap-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{- if .Values.development }}
22
apiVersion: v1
33
data:
4-
config.yml: |
4+
lodestar-runtime-config.yaml: |
55
---
66
basic_information:
77
project_name:
@@ -74,5 +74,5 @@ data:
7474
env_grace_period_max: 180
7575
kind: ConfigMap
7676
metadata:
77-
name: config-cm
77+
name: lodestar-runtime-cm
7878
{{- end }}

deployment/templates/deploymentconfig.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ spec:
4646
- name: hook-cm-volume
4747
mountPath: {{ .Values.config.hookFile.path }}/{{ .Values.config.hookFile.name }}
4848
subPath: {{ .Values.config.hookFile.name }}
49-
- name: config-cm-volume
50-
mountPath: {{ .Values.config.configFile.path }}/{{ .Values.config.configFile.name }}
51-
subPath: {{ .Values.config.configFile.name }}
49+
- name: lodestar-runtime-cm-volume
50+
mountPath: {{ .Values.config.runtimeConfigFile.path }}/{{ .Values.config.runtimeConfigFile.name }}
51+
subPath: {{ .Values.config.runtimeConfigFile.name }}
5252
dnsPolicy: ClusterFirst
5353
restartPolicy: Always
5454
schedulerName: default-scheduler
@@ -58,9 +58,9 @@ spec:
5858
- name: hook-cm-volume
5959
configMap:
6060
name: hook-cm
61-
- name: config-cm-volume
61+
- name: lodestar-runtime-cm-volume
6262
configMap:
63-
name: config-cm
63+
name: lodestar-runtime-cm
6464
test: false
6565
triggers:
6666
- type: ConfigChange

deployment/templates/gitlab-secret.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: omp-gitlab-configuration
66
type: Opaque
77
stringData:
8-
CONFIG_FILE: "{{ .Values.configFile }}"
98
CONFIG_REPOSITORY_ID: "{{ .Values.configRepositoryId }}"
109
DEPLOY_KEY: "{{ .Values.deployKey }}"
1110
GITLAB_API_URL: "{{ .Values.gitLabApiUrl }}"

deployment/values-dev.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ git:
1313
uri: https://github.com/rht-labs/open-management-portal-git-api.git
1414
ref: master
1515

16-
configFile: false
1716
configRepositoryId: false
1817
deployKey: false
1918
gitLabApiUrl: false
@@ -22,7 +21,7 @@ engagementsRepositoryId: false
2221

2322
config:
2423
hookFile:
25-
path: /schema
24+
path: /runtime
2625
name: webhooks.yaml
2726
hooks:
2827
- name: hook1
@@ -31,7 +30,7 @@ config:
3130
- name: hook2
3231
baseUrl: http://localhost/hook2
3332
token: anunoby
34-
configFile:
35-
path: /schema
36-
name: config.yml
33+
runtimeConfigFile:
34+
path: /runtime
35+
name: lodestar-runtime-config.yaml
3736

src/main/java/com/redhat/labs/omp/service/ConfigService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ void onStart(@Observes StartupEvent event) {
5454
String content = readFile(configFile);
5555
if (null != content) {
5656
configuration = File.builder().filePath(configFile).content(content).build();
57+
LOGGER.debug("Loaded Runtine Config from File, {}", configFile);
5758
}
58-
LOGGER.debug("Config File {}", configuration);
59+
5960
}
6061

6162
public File getConfigFile() {

src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ gitlab.deploy.key=${DEPLOY_KEY:0}
2626

2727
# config
2828
config.repository.id=${CONFIG_REPOSITORY_ID:1}
29-
config.file=${CONFIG_FILE:/schema/config.yml}
30-
webhook.file=${WEBHOOK_FILE:/schema/webhooks.yaml}
29+
config.file=${CONFIG_FILE:/runtime/lodestar-runtime-config.yaml}
30+
webhook.file=${WEBHOOK_FILE:/runtime/webhooks.yaml}
3131
webhook.default.token=${WEBHOOK_DEFAULT_TOKEN:tolkien}
3232
config.gitlab.ref=${CONFIG_GITLAB_REF:master}
3333
commit.page.size=100

src/test/java/com/redhat/labs/omp/mocks/MockGitLabService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public File getFile(String projectId, String filePath, String ref) {
157157

158158
}
159159

160-
if ("schema/webhooks.yaml".equalsIgnoreCase(filePath)) {
160+
if ("runtime/webhooks.yaml".equalsIgnoreCase(filePath)) {
161161
String content = ResourceLoader.load("webhooks.yaml");
162162
content = new String(EncodingUtils.base64Encode(content.getBytes()), StandardCharsets.UTF_8);
163163
return File.builder().filePath(filePath).content(content).build();
@@ -186,8 +186,8 @@ public File getFile(String projectId, String filePath, String ref) {
186186
throw new WebApplicationException(500);
187187
}
188188

189-
if("schema/config.yml".equals(filePath)) {
190-
String content = ResourceLoader.load("config.yml");
189+
if("runtime/lodestar-runtime-config.yaml".equals(filePath)) {
190+
String content = ResourceLoader.load("lodestar-runtime-config.yaml");
191191
content = new String(EncodingUtils.base64Encode(content.getBytes()), StandardCharsets.UTF_8);
192192
return File.builder().filePath(filePath).content(content).build();
193193
}

src/test/java/com/redhat/labs/omp/resource/ConfigResourceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ConfigResourceTest {
1515
void testGetConfigFileSuccess() {
1616

1717
given().when().contentType(ContentType.JSON).get("/api/v1/config").then().statusCode(200).body(is(
18-
"{\"content\":\"---\\nproviders:\\n- label: AWS\\n value: ec2\\n regions:\\n - label: US East 1 (N. Virginia)\\n value: us-east-1\\n - label: US East 2 (Ohio)\\n value: us-east-2\\nopenshift:\\n versions:\\n - label: v4.1\\n value: 4.1.31\\n - label: v4.2\\n value: 4.2.16\\n - label: v4.3\\n value: 4.3.0\\n persistent-storage:\\n - label: None\\n value: none\\n - label: 50GB\\n value: 50G\\n - label: 100GB\\n value: 100G\\n - label: 250GB\\n value: 250G\\n - label: 500GB\\n value: 500G\\n cluster-size:\\n - label: Small\\n value: small\\nuser-management:\\n rbac:\\n roles:\\n - label: Developer \\n value: developer\\n - label: Observer \\n value: observer\\n - label: Admin \\n value: admin\\n\",\"encoding\":\"base64\",\"file_path\":\"schema/config.yml\"}"));
18+
"{\"content\":\"---\\nproviders:\\n- label: AWS\\n value: ec2\\n regions:\\n - label: US East 1 (N. Virginia)\\n value: us-east-1\\n - label: US East 2 (Ohio)\\n value: us-east-2\\nopenshift:\\n versions:\\n - label: v4.1\\n value: 4.1.31\\n - label: v4.2\\n value: 4.2.16\\n - label: v4.3\\n value: 4.3.0\\n persistent-storage:\\n - label: None\\n value: none\\n - label: 50GB\\n value: 50G\\n - label: 100GB\\n value: 100G\\n - label: 250GB\\n value: 250G\\n - label: 500GB\\n value: 500G\\n cluster-size:\\n - label: Small\\n value: small\\nuser-management:\\n rbac:\\n roles:\\n - label: Developer \\n value: developer\\n - label: Observer \\n value: observer\\n - label: Admin \\n value: admin\\n\",\"encoding\":\"base64\",\"file_path\":\"runtime/lodestar-runtime-config.yaml\"}"));
1919

2020
}
2121

src/test/java/com/redhat/labs/omp/service/ConfigServiceTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ class ConfigServiceTest {
2121

2222
@Test void testGetConfigFilePreLoaded() {
2323
ConfigService service = new ConfigService();
24-
service.configFile = "src/test/resources/config.yml";
24+
service.configFile = "src/test/resources/lodestar-runtime-config.yaml";
2525
service.webHooksFile = "src/test/resources/webhooks.yaml";
2626
service.marshaller = new JsonMarshaller();
2727

2828
service.onStart(new StartupEvent());
2929
File config = service.getConfigFile();
3030

3131
assertNotNull(config);
32-
assertEquals("src/test/resources/config.yml", config.getFilePath());
33-
assertEquals(ResourceLoader.load("config.yml"), config.getContent());
32+
assertEquals("src/test/resources/lodestar-runtime-config.yaml", config.getFilePath());
33+
assertEquals(ResourceLoader.load("lodestar-runtime-config.yaml"), config.getContent());
3434

3535
}
3636

3737
@Test void testGetConfigFileFromGitLab() {
3838
ConfigService service = new ConfigService();
39-
service.configFile = "schema/config.yml";
39+
service.configFile = "runtime/lodestar-runtime-config.yaml";
4040
service.webHooksFile = "src/test/resources/webhooks.yaml";
4141
service.marshaller = new JsonMarshaller();
4242

@@ -48,8 +48,8 @@ class ConfigServiceTest {
4848
File config = service.getConfigFile();
4949

5050
assertNotNull(config);
51-
assertEquals("schema/config.yml", config.getFilePath());
52-
assertEquals(ResourceLoader.load("config.yml"), config.getContent());
51+
assertEquals("runtime/lodestar-runtime-config.yaml", config.getFilePath());
52+
assertEquals(ResourceLoader.load("lodestar-runtime-config.yaml"), config.getContent());
5353

5454
}
5555

@@ -86,7 +86,7 @@ class ConfigServiceTest {
8686
@Test void testGetHookConfigLabNotEmpty() {
8787
ConfigService service = new ConfigService();
8888
service.configFile = "src/test/resources/config.yml";
89-
service.webHooksFile = "/schema/webhooks.yaml";
89+
service.webHooksFile = "/runtime/webhooks.yaml";
9090
service.marshaller = new JsonMarshaller();
9191

9292
FileService fileService = new FileService();
File renamed without changes.

0 commit comments

Comments
 (0)