Skip to content

Commit

Permalink
- Testing Kubernetes secrets.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc3092 committed Nov 15, 2024
1 parent 2184640 commit ca0a496
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
1 change: 1 addition & 0 deletions proxies/pdl-proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ spec:
memory: 2048Mi
envFrom:
- secret: azure-trygdeetaten-testnav-pdl-proxy-trygdeetaten
- secret: testnav-pdl-proxy
ingresses:
- "https://testnav-pdl-proxy.dev-fss-pub.nais.io"
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
package no.nav.testnav.proxies.pdlproxy.config;

import lombok.extern.slf4j.Slf4j;
import no.nav.testnav.proxies.pdlproxy.CredentialsHolder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class CredentialsConfig {

@Value("${hendelse.lager.api.key}")
@Value("${app.hendelse.lager.api.key}")
private String hendelselagerApiKey;

@Value("${person.aktor.admin.api}")
@Value("${app.person.aktor.admin.api}")
private String aktoerAdminApiKey;

@Value("${elastic.username}")
@Value("${app.elastic.username}")
private String elasticUsername;

@Value("${elastic.password}")
@Value("${app.elastic.password}")
private String elasticPassword;

@Value("${hendelse.lager.api.key}")
private String oldHendelselagerApiKey;

@Value("${person.aktor.admin.api}")
private String oldAktoerAdminApiKey;

@Value("${elastic.username}")
private String oldElasticUsername;

@Value("${elastic.password}")
private String oldElasticPassword;

@Bean
CredentialsHolder credentialsHolder() {
log.info("Checking aktoerAdminApiKey: {}", (aktoerAdminApiKey.equals(oldAktoerAdminApiKey)));
log.info("Checking hendelselagerApiKey: {}", (hendelselagerApiKey.equals(oldHendelselagerApiKey)));
log.info("Checking elasticUsername: {}", (elasticUsername.equals(oldElasticUsername)));
log.info("Checking elasticPassword: {}", (elasticPassword.equals(oldElasticPassword)));
return new CredentialsHolder(hendelselagerApiKey, aktoerAdminApiKey, elasticUsername, elasticPassword);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"properties": [
{
"name": "app.hendelse.lager.api.key",
"type": "java.lang.String",
"description": "API key for hendelse-lager-api? Assigned by ?."
},
{
"name": "app.person.aktor.api.key",
"type": "java.lang.String",
"description": "API key for person-aktor-api? Assigned by ?."
},
{
"name": "app.elastic.username",
"type": "java.lang.String",
"description": "Elastic username."
},
{
"name": "app.elastic.password",
"type": "java.lang.String",
"description": "Elastic password."
}
] }
7 changes: 7 additions & 0 deletions proxies/pdl-proxy/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ spring:
vault:
enabled: false

app:
elastic:
username: ${ELASTIC_PASSWORD}
password: ${ELASTIC_USERNAME}
hendelse.lager.api.key: ${HENDELSE_LAGER_API_KEY}
person.aktor.api.key: ${PERSON_AKTOR_API_KEY}

sts:
token:
provider:
Expand Down

0 comments on commit ca0a496

Please sign in to comment.