Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Helm Chart Network Service and annotations #47

Merged
merged 10 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .github/workflows/lint-test.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions charts/tdw-server/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami/
version: 11.9.13
- name: common
repository: https://charts.bitnami.com/bitnami/
version: 2.24.0
digest: sha256:ebb431d33620262dddc5402877d6403aaaa1e20754a3d14c7c47d7e87660132d
generated: "2024-10-08T13:49:49.494172968Z"
11 changes: 8 additions & 3 deletions charts/tdw-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ name: trustdidweb-server-py
icon: https://identity.foundation/trustdidweb/tdw.jpg
description: An api server to register and serve trusted web dids.
type: application
version: 0.0.5
version: 0.0.6
appVersion: "0.0.5"

maintainers:
- name: PatStLouis
email: [email protected]
url: https://github.com/PatStLouis

dependencies:
- name: postgresql
version: 11.9.13
repository: https://charts.bitnami.com/bitnami/
condition: postgresql.enabled
- name: common
repository: "https://charts.bitnami.com/bitnami"
repository: https://charts.bitnami.com/bitnami/
tags:
- bitnami-common
version: 2.x.x
version: 2.x.x
Binary file added charts/tdw-server/charts/common-2.24.0.tgz
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions charts/tdw-server/templates/postgresql/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "global.postgresql.fullname" . }}
labels:
{{- include "postgresql.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "postgresql.selectorLabels" . | nindent 6 }}
ingress:
- ports:
- protocol: TCP
port: {{ .Values.postgresql.primary.service.ports.postgresql }}
from:
- podSelector:
matchLabels:
{{- include "server.selectorLabels" . | nindent 14 }}
policyTypes:
- Ingress
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ kind: Ingress
metadata:
name: {{ include "server.fullname" . }}
labels:
{{- toYaml .Values.server.labels | nindent 4 }}
PatStLouis marked this conversation as resolved.
Show resolved Hide resolved
{{- include "server.labels" . | nindent 4 }}
spec:
tls:
Expand Down
21 changes: 21 additions & 0 deletions charts/tdw-server/templates/server/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "server.fullname" . }}-ingress
labels:
{{- include "server.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "server.selectorLabels" . | nindent 6 }}
ingress:
- from:
- namespaceSelector:
matchLabels:
{{- toYaml .Values.networkPolicy.ingress.namespaceSelector | nindent 14 }}
- podSelector:
matchLabels:
{{- toYaml .Values.server.networkPolicy.ingress.podSelector | nindent 14 }}
policyTypes:
- Ingress
11 changes: 11 additions & 0 deletions charts/tdw-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@ ingressSuffix: ""

selectorLabels: {}

ingress:
labels: []
annotations: []

networkPolicy:
ingress:
namespaceSelector: []

server:
image:
repository: ghcr.io/decentralized-identity/trustdidweb-server-py
pullPolicy: IfNotPresent
pullSecrets: []

environment:
ENDORSER_MULTIKEY: ""

replicaCount: 1

podAnnotations: {}
Expand Down
8 changes: 2 additions & 6 deletions server/app/routers/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,17 @@ async def request_did(
raise HTTPException(status_code=400, detail="Missing request information.")


@router.post("/{namespace}/{identifier}")
@router.post("/")
async def register_did(
namespace: str,
identifier: str,
request_body: RegisterDID,
):
did_document = request_body.model_dump()["didDocument"]
did = f"{settings.DID_WEB_BASE}:{namespace}:{identifier}"
did = did_document["id"]

await identifier_available(did)

# Ensure correct endpoint is called
if did_document["id"] != did:
raise HTTPException(status_code=400, detail="Location mismatch.")

# Assert proof set
proof_set = did_document.pop("proof", None)
if len(proof_set) != 2:
Expand Down