Skip to content

Commit

Permalink
k8s deploys changing separate env mappings from ConfigMap into envFro…
Browse files Browse the repository at this point in the history
…m->configMapRef
  • Loading branch information
jurabek committed Jan 2, 2024
1 parent 8963b74 commit 915e5cf
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 84 deletions.
6 changes: 3 additions & 3 deletions k8s-kustomize/services/basket-api/base/config.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
auth.authority=http://identity-api
redis.host=redis-data:6379
base.path=/basket
AUTH_AUTHORITY=http://identity-api
REDIS_HOST=redis-data:6379
BASE_PATH=/basket
46 changes: 14 additions & 32 deletions k8s-kustomize/services/basket-api/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,18 @@ spec:
app: basket-api
spec:
containers:
- image: basket-api # must much from ./kustomization.yaml -> images[0].name
imagePullPolicy: IfNotPresent
name: basket-api
ports:
- containerPort: 5200
env:
- name: AUTH_AUTHORITY
valueFrom:
configMapKeyRef:
- image: basket-api # must much from ./kustomization.yaml -> images[0].name
imagePullPolicy: IfNotPresent
name: basket-api
ports:
- containerPort: 5200
envFrom:
- configMapKeyRef:
name: basket-api
key: auth.authority
- name: AUTH_URL
valueFrom:
configMapKeyRef:
name: basket-api
key: auth.url
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: basket-api
key: redis.host
- name: BASE_PATH
valueFrom:
configMapKeyRef:
name: basket-api
key: base.path
resources:
requests:
memory: "32Mi"
cpu: "60m"
limits:
memory: "128Mi"
cpu: "100m"
resources:
requests:
memory: "32Mi"
cpu: "60m"
limits:
memory: "128Mi"
cpu: "100m"
2 changes: 1 addition & 1 deletion k8s-kustomize/services/basket-api/dev/config.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
auth.url=http://api-dev.restaurant.io/identity
AUTH_URL=http://api-dev.restaurant.io/identity
8 changes: 4 additions & 4 deletions k8s-kustomize/services/catalog-api/base/.env.secret
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
db.url=postgres://admin:Passw0rd!@catalog-pgsql-database:5432/catalog_database
db.name=catalog_database
db.password=Passw0rd!
db.username=admin
DATABASE_URL=postgres://admin:Passw0rd!@catalog-pgsql-database:5432/catalog_database
POSTGRES_DB=catalog_database
POSTGRES_PASSWORD=Passw0rd!
POSTGRES_USER=admin
6 changes: 3 additions & 3 deletions k8s-kustomize/services/catalog-api/base/config.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
auth.authority=http://identity-api
env=Development
base.path=/catalog
AUTH_AUTHORITY=http://identity-api
ENV=Development
BASE_URL=/catalog
31 changes: 6 additions & 25 deletions k8s-kustomize/services/catalog-api/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,17 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 8000
envFrom:
- configMapRef:
name: catalog-api
- secretRef:
name: catalog-api
env:
- name: ROCKET_PORT
value: "8000"
- name: ROCKET_ADDRESS
value: "0.0.0.0"
- name: ENV
valueFrom:
configMapKeyRef:
name: catalog-api
key: env
- name: BASE_URL
valueFrom:
configMapKeyRef:
name: catalog-api
key: base.path
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: catalog-api
key: db.url
- name: AUTH_URL
valueFrom:
configMapKeyRef:
name: catalog-api
key: auth.url
- name: AUTH_AUTHORITY
valueFrom:
configMapKeyRef:
name: catalog-api
key: auth.authority

readinessProbe:
httpGet:
path: /health/ready
Expand Down
18 changes: 3 additions & 15 deletions k8s-kustomize/services/catalog-api/base/menu-pgsql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,12 @@ spec:
containers:
- name: catalog-pgsql-database
image: postgres:alpine
envFrom:
- secretRef:
name: catalog-api
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: catalog-api
key: db.name
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: catalog-api
key: db.password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: catalog-api
key: db.username
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: order-database-data
Expand Down
2 changes: 1 addition & 1 deletion k8s-kustomize/services/catalog-api/dev/config.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
auth.url=http://api-dev.restaurant.io/identity
AUTH_URL=http://api-dev.restaurant.io/identity

0 comments on commit 915e5cf

Please sign in to comment.