Skip to content

Commit b473eec

Browse files
committed
scripts and project updated to ssl mode
1 parent 6e97ddd commit b473eec

File tree

8 files changed

+490
-207
lines changed

8 files changed

+490
-207
lines changed

Dockerfile.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM --platform=linux/arm64 alpine:latest
2+
3+
WORKDIR /app
4+
5+
# Copy the locally built binary
6+
COPY xdatabase-proxy .
7+
8+
# Expose the port
9+
EXPOSE 1881
10+
11+
# Run the binary
12+
CMD ["./xdatabase-proxy"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: xdatabase-proxy
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: xdatabase-proxy
10+
image: ghcr.io/hasirciogli/xdatabase-proxy-local-test:latest
11+
imagePullPolicy: Never
12+
env:
13+
- name: NAMESPACE
14+
value: test

kubernetes/overlays/test/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ resources:
77
- ../../base
88

99
patches:
10-
- path: test-image-patch.yaml
10+
- path: database-patch.yaml

kubernetes/overlays/test/test-image-patch.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ func main() {
5656
// Setup health check endpoints (!!!CURRENTLY NOT USED!!!)
5757
setupHealthChecks()
5858

59-
proxy, err := postgresql.NewPostgresProxy(1881, "local-test")
59+
proxy, err := postgresql.NewPostgresProxy("local-test")
6060
if err != nil {
6161
log.Fatalf("Failed to create PostgreSQL proxy: %v", err)
6262
}
6363

64-
go proxy.Start(1881)
64+
go proxy.Start(1881, "", "")
6565

6666
// Wait for termination signal
6767
sigChan := make(chan os.Signal, 1)

pkg/kubernetes/client.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,24 @@ func (k *K8sClient) WatchDatabaseServices(ctx context.Context, callback func([]S
275275

276276
return nil
277277
}
278+
279+
func (k *K8sClient) GetSecret(namespace string, name string) (*corev1.Secret, error) {
280+
return k.clientset.CoreV1().Secrets(namespace).Get(context.Background(), name, metav1.GetOptions{})
281+
}
282+
283+
func (k *K8sClient) UpsertSecret(namespace string, name string, data map[string][]byte) error {
284+
secret := &corev1.Secret{
285+
ObjectMeta: metav1.ObjectMeta{
286+
Name: name,
287+
Namespace: namespace,
288+
},
289+
Data: data,
290+
}
291+
292+
_, err := k.clientset.CoreV1().Secrets(namespace).Create(context.Background(), secret, metav1.CreateOptions{})
293+
if err != nil {
294+
return fmt.Errorf("failed to create secret: %v", err)
295+
}
296+
297+
return nil
298+
}

0 commit comments

Comments
 (0)