Skip to content

Commit 5db5fe2

Browse files
committed
fixing some issues with k8s plan
1 parent 57b8395 commit 5db5fe2

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

k8s/hpcs-server-service.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Service definition for spire-oidc (expose the OIDC socket)
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: hpcs-server
6+
namespace: hpcs
7+
spec:
8+
clusterIP: None
9+
selector:
10+
app: hpcs-server
11+
ports:
12+
- name: https
13+
port: 10080
14+
targetPort: hpcs-server

k8s/hpcs-server-statefulset.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ spec:
2222
containers:
2323
- name: hpcs-server
2424
image: ghcr.io/cscfi/hpcs/server:k8s_plan
25+
ports:
26+
- containerPort: 10080
27+
name: hpcs-server
2528
command:
2629
- sleep
2730
args:

server/app.py

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
"hpcs-server-spiffeid"
5050
)
5151

52+
if configuration["spire-server"].get("socket-path"):
53+
spire_interactions.spire_server_socketpath = configuration["spire-server"].get(
54+
"socket-path"
55+
)
56+
5257
if configuration["spire-server"].get("pre-command"):
5358
spire_interactions.pre_command = configuration["spire-server"]["pre-command"]
5459
if configuration["spire-server"]["pre-command"] == '""':

server/lib/spire_interactions.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
jwt_workload_api = None
1212
hpcs_server_spiffeid = "spiffe://hpcs/hpcs-server/workload"
13+
spire_server_socketpath = "/tmp/spire-server/private/api.sock:"
1314

1415

1516
def token_generate(spiffeID: SpiffeId) -> subprocess.CompletedProcess:
@@ -23,11 +24,11 @@ def token_generate(spiffeID: SpiffeId) -> subprocess.CompletedProcess:
2324
"""
2425

2526
if pre_command != "":
26-
command = f"{pre_command} {spire_server_bin} token generate -spiffeID {str(spiffeID)}".split(
27+
command = f"{pre_command} {spire_server_bin} token generate -socketPath {spire_server_socketpath} -spiffeID {str(spiffeID)}".split(
2728
" "
2829
)
2930
else:
30-
command = f"{spire_server_bin} token generate -spiffeID {str(spiffeID)}".split(
31+
command = f"{spire_server_bin} token generate -socketPath {spire_server_socketpath} -spiffeID {str(spiffeID)}".split(
3132
" "
3233
)
3334

@@ -48,11 +49,11 @@ def entry_create(
4849
subprocess.CompletedProcess: result of the cli command to create the entry
4950
"""
5051
if pre_command != "":
51-
command = f"{pre_command} {spire_server_bin} entry create -parentID {str(parentID)} -spiffeID {str(spiffeID)}".split(
52+
command = f"{pre_command} {spire_server_bin} entry create -socketPath {spire_server_socketpath} -parentID {str(parentID)} -spiffeID {str(spiffeID)}".split(
5253
" "
5354
)
5455
else:
55-
command = f"{spire_server_bin} entry create -parentID {str(parentID)} -spiffeID {str(spiffeID)}".split(
56+
command = f"{spire_server_bin} entry create -socketPath {spire_server_socketpath} -parentID {str(parentID)} -spiffeID {str(spiffeID)}".split(
5657
" "
5758
)
5859

0 commit comments

Comments
 (0)