From 81b988de17b08a5ffd20ebadd01553788bb9ede5 Mon Sep 17 00:00:00 2001 From: David Landry Date: Wed, 4 Sep 2024 15:37:21 -0400 Subject: [PATCH] chore(goff): try GO Feature Flag deployment --- apps/goff/base/build.yaml | 0 apps/goff/base/default-flags.yaml | 14 +++ apps/goff/base/deployment.yaml | 105 +++++++++++++++++++++ apps/goff/base/kustomization.yaml | 11 +++ apps/goff/base/relay-config.yaml | 13 +++ apps/goff/overlays/work/config.json | 11 +++ apps/goff/overlays/work/kustomization.yaml | 4 + 7 files changed, 158 insertions(+) create mode 100644 apps/goff/base/build.yaml create mode 100644 apps/goff/base/default-flags.yaml create mode 100644 apps/goff/base/deployment.yaml create mode 100644 apps/goff/base/kustomization.yaml create mode 100644 apps/goff/base/relay-config.yaml create mode 100644 apps/goff/overlays/work/config.json create mode 100644 apps/goff/overlays/work/kustomization.yaml diff --git a/apps/goff/base/build.yaml b/apps/goff/base/build.yaml new file mode 100644 index 0000000..e69de29 diff --git a/apps/goff/base/default-flags.yaml b/apps/goff/base/default-flags.yaml new file mode 100644 index 0000000..2d50f17 --- /dev/null +++ b/apps/goff/base/default-flags.yaml @@ -0,0 +1,14 @@ +my-first-flag: + variations: + Variation_1: true + Variation_2: false + trackEvents: false + targeting: + - name: Rule 1 + query: tenant eq 1 + variation: Variation_2 + - name: Rule 1 + query: lastname eq "Doe" + variation: Variation_1 + defaultRule: + variation: Variation_1 diff --git a/apps/goff/base/deployment.yaml b/apps/goff/base/deployment.yaml new file mode 100644 index 0000000..ed093ef --- /dev/null +++ b/apps/goff/base/deployment.yaml @@ -0,0 +1,105 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: goff + labels: + app: goff +spec: + selector: + app: goff + type: ClusterIP + ports: + - port: 8080 + targetPort: http + protocol: TCP + name: http +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: goff +spec: + strategy: + type: Recreate + selector: + matchLabels: + app: goff + revisionHistoryLimit: 1 + replicas: 1 + template: + metadata: + annotations: + labels: + app: goff + spec: + containers: + - name: goff + image: gofeatureflag/go-feature-flag:latest + command: ["go-feature-flag-relay-proxy", "--config", "/goff/config.yaml"] + volumeMounts: + - name: goff-relay-config + mountPath: /goff/config.yaml + - name: default-flags + mountPath: /goff/default-flags.yaml + ports: + - name: http + protocol: TCP + containerPort: 1031 + resources: + requests: + cpu: 150m + memory: 500Mi + limits: + cpu: 1000m + memory: 2000Mi + securityContext: + runAsUser: 1000 + startupProbe: + httpGet: + path: /health + port: http + failureThreshold: 60 + periodSeconds: 10 + terminationGracePeriodSeconds: 1200 + volumes: + - name: config + configMap: + name: goff-relay-config + - name: default-flags + configMap: + name: default-flags + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt-issuer + gethomepage.dev/enabled: "true" + gethomepage.dev/name: "goff" + gethomepage.dev/description: "GO Feature Flag" + gethomepage.dev/group: "Work" + nginx.ingress.kubernetes.io/proxy-body-size: "1g" + nginx.ingress.kubernetes.io/proxy-read-timeout: "600" + nginx.ingress.kubernetes.io/proxy-send-timeout: "600" + name: goff + labels: + name: goff +spec: + rules: + - host: work-goff.nc.landry.land + http: + paths: + - backend: + service: + name: goff + port: + number: http + path: / + pathType: Prefix + + tls: + - hosts: + - work-goff.nc.landry.land + secretName: goff-tls diff --git a/apps/goff/base/kustomization.yaml b/apps/goff/base/kustomization.yaml new file mode 100644 index 0000000..7ceb745 --- /dev/null +++ b/apps/goff/base/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - deployment.yaml +configMapGenerator: + - name: goff-relay-config + files: + - relay-config.yaml + - name: default-flags + files: + - default-flags.yaml diff --git a/apps/goff/base/relay-config.yaml b/apps/goff/base/relay-config.yaml new file mode 100644 index 0000000..be28286 --- /dev/null +++ b/apps/goff/base/relay-config.yaml @@ -0,0 +1,13 @@ +retrievers: + - kind: file + path: /goff/default-flags.yaml + +pollingInterval: 1000 +enablePollingjitter: true +enableSwagger: true +startWithRetrieverError: true + +authorizedKeys: + admin: + - "testingtesting123" + diff --git a/apps/goff/overlays/work/config.json b/apps/goff/overlays/work/config.json new file mode 100644 index 0000000..54605a7 --- /dev/null +++ b/apps/goff/overlays/work/config.json @@ -0,0 +1,11 @@ +{ + "appName": "goff", + "userGivenName": "goff", + "destNamespace": "work", + "destServer": "https://kubernetes.default.svc", + "srcPath": "apps/goff/overlays/work", + "srcRepoURL": "ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git", + "srcTargetRevision": "", + "labels": null, + "annotations": null +} diff --git a/apps/goff/overlays/work/kustomization.yaml b/apps/goff/overlays/work/kustomization.yaml new file mode 100644 index 0000000..2333422 --- /dev/null +++ b/apps/goff/overlays/work/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../base