diff --git a/apps/prod/kustomization.yaml b/apps/prod/kustomization.yaml index 7eac9a86c..29164b12d 100644 --- a/apps/prod/kustomization.yaml +++ b/apps/prod/kustomization.yaml @@ -6,6 +6,7 @@ resources: - ../base/flux - ../base/nvidia-dcgm - ../base/posthog + - posthog - context-server - premium-context-server - model-server diff --git a/apps/prod/posthog/ingress-nginx.yaml b/apps/prod/posthog/ingress-nginx.yaml new file mode 100644 index 000000000..42b2dfbbd --- /dev/null +++ b/apps/prod/posthog/ingress-nginx.yaml @@ -0,0 +1,688 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + name: posthog-ingress-nginx +--- +apiVersion: v1 +automountServiceAccountToken: true +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx + namespace: posthog-ingress-nginx +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission + namespace: posthog-ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx + namespace: posthog-ingress-nginx +rules: +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get +- apiGroups: + - "" + resources: + - configmaps + - pods + - secrets + - endpoints + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update +- apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch +- apiGroups: + - coordination.k8s.io + resourceNames: + - posthog-ingress-nginx-leader + resources: + - leases + verbs: + - get + - update +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission + namespace: posthog-ingress-nginx +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx +rules: +- apiGroups: + - "" + resources: + - configmaps + - endpoints + - nodes + - pods + - secrets + - namespaces + verbs: + - list + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - list + - watch +- apiGroups: + - "" + resources: + - nodes + verbs: + - get +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list + - watch +- apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update +- apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission +rules: +- apiGroups: + - admissionregistration.k8s.io + resources: + - validatingwebhookconfigurations + verbs: + - get + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx + namespace: posthog-ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: posthog-ingress-nginx +subjects: +- kind: ServiceAccount + name: posthog-ingress-nginx + namespace: posthog-ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission + namespace: posthog-ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: posthog-ingress-nginx-admission +subjects: +- kind: ServiceAccount + name: posthog-ingress-nginx-admission + namespace: posthog-ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: posthog-ingress-nginx +subjects: +- kind: ServiceAccount + name: posthog-ingress-nginx + namespace: posthog-ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: posthog-ingress-nginx-admission +subjects: +- kind: ServiceAccount + name: posthog-ingress-nginx-admission + namespace: posthog-ingress-nginx +--- +apiVersion: v1 +data: + hide-headers: "l5d-dst-override" + allow-snippet-annotations: "true" + enable-opentracing: "true" + opentracing-trust-incoming-span: "false" + jaeger-propagation-format: "zipkin" + zipkin-collector-host: jaeger-collector.jaeger.svc.cluster.local + zipkin-collector-port: "9411" + zipkin-sample-rate: "0.0001" +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-controller + namespace: posthog-ingress-nginx +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-controller + namespace: posthog-ingress-nginx +spec: + externalTrafficPolicy: Local + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - appProtocol: http + name: http + port: 80 + protocol: TCP + targetPort: http + - appProtocol: https + name: https + port: 443 + protocol: TCP + targetPort: https + selector: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + type: LoadBalancer +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-controller-admission + namespace: posthog-ingress-nginx +spec: + ports: + - appProtocol: https + name: https-webhook + port: 443 + targetPort: webhook + selector: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-controller + namespace: posthog-ingress-nginx +spec: + minReadySeconds: 0 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + template: + metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + annotations: + config.linkerd.io/trace-collector: collector.linkerd-jaeger.svc.cluster.local:55678 + spec: + tolerations: + - key: "nginx" + operator: "Exists" + effect: "NoSchedule" + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: cloud.google.com/gke-nodepool + operator: In + values: + - nginx + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - posthog-ingress-nginx + - ingress-nginx + - context-server + - model-server + - jaeger + - loki + topologyKey: "kubernetes.io/hostname" + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - grafana + - prometheus + - kube-state-metrics + topologyKey: "kubernetes.io/hostname" + containers: + - args: + - /nginx-ingress-controller + - --publish-service=$(POD_NAMESPACE)/posthog-ingress-nginx-controller + - --election-id=posthog-ingress-nginx-leader + - --controller-class=k8s.io/posthog-ingress-nginx + - --ingress-class=nginx + - --configmap=$(POD_NAMESPACE)/posthog-ingress-nginx-controller + - --validating-webhook=:8443 + - --validating-webhook-certificate=/usr/local/certificates/cert + - --validating-webhook-key=/usr/local/certificates/key + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: LD_PRELOAD + value: /usr/local/lib/libmimalloc.so + image: registry.k8s.io/ingress-nginx/controller:v1.6.4@sha256:15be4666c53052484dd2992efacf2f50ea77a78ae8aa21ccd91af6baaa7ea22f + imagePullPolicy: IfNotPresent + lifecycle: + preStop: + exec: + command: + - /wait-shutdown + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: controller + ports: + - containerPort: 80 + name: http + protocol: TCP + - containerPort: 443 + name: https + protocol: TCP + - containerPort: 8443 + name: webhook + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + requests: + cpu: 2000m + memory: 4Gi + securityContext: + allowPrivilegeEscalation: true + capabilities: + add: + - NET_BIND_SERVICE + drop: + - ALL + runAsUser: 101 + volumeMounts: + - mountPath: /usr/local/certificates/ + name: webhook-cert + readOnly: true + dnsPolicy: ClusterFirst + nodeSelector: + kubernetes.io/os: linux + serviceAccountName: posthog-ingress-nginx + terminationGracePeriodSeconds: 300 + volumes: + - name: webhook-cert + secret: + secretName: posthog-ingress-nginx-admission +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission-create + namespace: posthog-ingress-nginx +spec: + template: + metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission-create + spec: + containers: + - args: + - create + - --host=posthog-ingress-nginx-controller-admission,posthog-ingress-nginx-controller-admission.$(POD_NAMESPACE).svc + - --namespace=$(POD_NAMESPACE) + - --secret-name=posthog-ingress-nginx-admission + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20220916-gd32f8c343@sha256:39c5b2e3310dc4264d638ad28d9d1d96c4cbb2b2dcfb52368fe4e3c63f61e10f + imagePullPolicy: IfNotPresent + name: create + securityContext: + allowPrivilegeEscalation: false + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + securityContext: + fsGroup: 2000 + runAsNonRoot: true + runAsUser: 2000 + serviceAccountName: posthog-ingress-nginx-admission +--- +apiVersion: batch/v1 +kind: Job +metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission-patch + namespace: posthog-ingress-nginx +spec: + template: + metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission-patch + spec: + containers: + - args: + - patch + - --webhook-name=posthog-ingress-nginx-admission + - --namespace=$(POD_NAMESPACE) + - --patch-mutating=false + - --secret-name=posthog-ingress-nginx-admission + - --patch-failure-policy=Fail + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20220916-gd32f8c343@sha256:39c5b2e3310dc4264d638ad28d9d1d96c4cbb2b2dcfb52368fe4e3c63f61e10f + imagePullPolicy: IfNotPresent + name: patch + securityContext: + allowPrivilegeEscalation: false + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + securityContext: + fsGroup: 2000 + runAsNonRoot: true + runAsUser: 2000 + serviceAccountName: posthog-ingress-nginx-admission +--- +apiVersion: networking.k8s.io/v1 +kind: IngressClass +metadata: + labels: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: nginx +spec: + controller: k8s.io/posthog-ingress-nginx +--- +apiVersion: admissionregistration.k8s.io/v1 + kind: ValidatingWebhookConfiguration + metadata: + labels: + app.kubernetes.io/component: admission-webhook + app.kubernetes.io/instance: posthog-ingress-nginx + app.kubernetes.io/name: posthog-ingress-nginx + app.kubernetes.io/part-of: posthog-ingress-nginx + app.kubernetes.io/version: 1.6.4 + name: posthog-ingress-nginx-admission + webhooks: + - admissionReviewVersions: + - v1 + clientConfig: + service: + name: posthog-ingress-nginx-controller-admission + namespace: posthog-ingress-nginx + path: /networking/v1/ingresses + failurePolicy: Fail + matchPolicy: Equivalent + name: validate.nginx.ingress.kubernetes.io + rules: + - apiGroups: + - networking.k8s.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - ingresses + sideEffects: None diff --git a/apps/prod/posthog/kustomization.yaml b/apps/prod/posthog/kustomization.yaml new file mode 100644 index 000000000..b84218e20 --- /dev/null +++ b/apps/prod/posthog/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: posthog-ingress-controller +resources: + - ingress-nginx.yaml