From af1b38f37ac5205e58e2a54d0d708fd7bd8b73b9 Mon Sep 17 00:00:00 2001 From: kevinzcf Date: Tue, 24 Jan 2023 23:55:30 +0100 Subject: [PATCH] import csv --- .DS_Store | Bin 0 -> 6148 bytes demo/hello-deployment.yaml | 32 +++++++++ demo/kustomization.yaml | 7 ++ demo/mysql-deployment.yaml | 66 +++++++++++++++++ demo/wordpress-deployment.yaml | 68 ++++++++++++++++++ statping/.DS_Store | Bin 0 -> 6148 bytes statping/adminer-deployment.yaml | 40 +++++++++++ statping/deployment.yaml | 83 +++++++++++++++++++++ statping/init-config.yaml | 13 ++++ statping/initdb/core.csv | 2 + statping/initdb/services.csv | 3 + statping/kustomization.yaml | 9 +++ statping/postgres-deployment.yaml | 72 +++++++++++++++++++ statping/sql-sts.yaml | 116 ++++++++++++++++++++++++++++++ statping/statping-deployment.yaml | 73 +++++++++++++++++++ 15 files changed, 584 insertions(+) create mode 100644 .DS_Store create mode 100644 demo/hello-deployment.yaml create mode 100644 demo/kustomization.yaml create mode 100644 demo/mysql-deployment.yaml create mode 100644 demo/wordpress-deployment.yaml create mode 100644 statping/.DS_Store create mode 100644 statping/adminer-deployment.yaml create mode 100644 statping/deployment.yaml create mode 100644 statping/init-config.yaml create mode 100644 statping/initdb/core.csv create mode 100644 statping/initdb/services.csv create mode 100644 statping/kustomization.yaml create mode 100644 statping/postgres-deployment.yaml create mode 100644 statping/sql-sts.yaml create mode 100644 statping/statping-deployment.yaml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8e2cbcfdb40854881cc9aa8deb5e78eaf1dcf1d7 GIT binary patch literal 6148 zcmeHK%}T>S5Z<-bZYe?ziXIod7HsLE7B3;z7cim+m70)JgE3p0)Er77SA8Mh#OHBl zcLSF8;7P>J!0b1>GqaodAp64@qDT`UkCSj3H zH%#;whw$44%UI3=&~M)#CMpEqM>tL5Ebnwa`A)6AyVnp6(Gm~-lPdf?$mf|C%ja1>Oc^YLp*EbH)6wQ%yv{-a|gI-(q zmuuZ~dVV!}PF_;=X1L@)yOw>66}*G7R@SROOB0n&z*pr}@r1+x zF+dCu16#y^Jp@E+i)yA)i2-8ZXAI!}AVCpbi={!mbwGpHXY|(*QNYHx1fsO)S}YBM z2ZWncK$FVt6N8&{7?(EAwOAT7>5S`@VII43^?2cWbr_dAoN?D6wZs51u*yKqbR9hZ zFX5Nj_{d*Pp&l_n4E!?&czx&(Jt)eat!w4sSt~&wK~XTSL<0oul}iA0a349=PUDwo aL!4`|G>Eg{xK0P8i-0DC8e-rV82AFVZ%q#X literal 0 HcmV?d00001 diff --git a/demo/hello-deployment.yaml b/demo/hello-deployment.yaml new file mode 100644 index 0000000..c976b37 --- /dev/null +++ b/demo/hello-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hello +spec: + replicas: 2 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 100% + selector: + matchLabels: + app: hello + template: + metadata: + labels: + app: hello + spec: + affinity: + # ⬇⬇⬇ This ensures pods will land on separate hosts + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: [{ key: app, operator: In, values: [hello] }] + topologyKey: "kubernetes.io/hostname" + containers: + - name: hello-from + image: pbitty/hello-from:latest + ports: + - name: http + containerPort: 80 + terminationGracePeriodSeconds: 1 diff --git a/demo/kustomization.yaml b/demo/kustomization.yaml new file mode 100644 index 0000000..9874c24 --- /dev/null +++ b/demo/kustomization.yaml @@ -0,0 +1,7 @@ +secretGenerator: +- name: mysql-pass + literals: + - password=YOUR_PASSWORD +resources: + - mysql-deployment.yaml + - wordpress-deployment.yaml diff --git a/demo/mysql-deployment.yaml b/demo/mysql-deployment.yaml new file mode 100644 index 0000000..cd3370f --- /dev/null +++ b/demo/mysql-deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + ports: + - port: 3306 + targetPort: 5432 + selector: + app: wordpress + tier: mysql + clusterIP: None +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: mysql + spec: + containers: + - image: postgres:15.1 + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-pv-claim diff --git a/demo/wordpress-deployment.yaml b/demo/wordpress-deployment.yaml new file mode 100644 index 0000000..dfeb168 --- /dev/null +++ b/demo/wordpress-deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress + labels: + app: wordpress +spec: + type: NodePort + ports: + - port: 80 + nodePort: 30007 + selector: + app: wordpress + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + labels: + app: wordpress +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: frontend + spec: + containers: + - image: wordpress:4.8-apache + name: wordpress + env: + - name: WORDPRESS_DB_HOST + value: wordpress-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + - name: wordpress-persistent-storage + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + persistentVolumeClaim: + claimName: wp-pv-claim diff --git a/statping/.DS_Store b/statping/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e17b36963dffd0c64e999d48dc6add7b1b3630e0 GIT binary patch literal 6148 zcmeHKL2uJA6n^dsOI9KE02&vhNL;J3sfSW=$+`}-10XF34uDERqb?$it0rBAs!F*6 zKZYa!g#W?`zGr*Vnr`AYG2|ybf6w;&?Bq*g$3!Ih^U*$0lZYHRV|@q3CC2^i8&)$d z+$q!;6G~`I8A+OLWZMR-fK}jMQ-HtS2DRywVoK@a_ZuIl@?(_B2pPOQ9KhSZl_4V9 zp+m4jeCY-FpAk(ct#H0qI4+&g5k?x&b6^{c(KkYl3vhLI;Lluk8+Il zrodR!>iptCWi%IgvChQxa-3J@|Mho9w8*DMmmkqIP4Z%I@29A3)o$t<_?sB=`>2+FOch&Niy-v5~J?{2aE7!UA@X?c#;iq(x$uGDGn82c}?2f^6_=?~X zDb9jfmdb35US>Av3?ij8XPK^g#5K;o_*$T9?Pe%oUJs{nGcMO&rB%QxaE%J^`ryGC zeS@V&wRE6RM*v_Q&B_q-&jNEigTBF1BYI#$Q-PW)%n?IqI@&#x=Nl|FYB~vX_z-4h zVNNJQ&5rRsl}^IfXiKYrRbX9#EnRK${(p4!`G1{cYgPfPz<;HHs1JfcAGc)o){UFv vz1D+&fU|L4sZmi-nC(~vycOSvD?^{h0nj&CYD5dn{s<@;Y+)6+Rt5e5h%=)l literal 0 HcmV?d00001 diff --git a/statping/adminer-deployment.yaml b/statping/adminer-deployment.yaml new file mode 100644 index 0000000..f1c3f1f --- /dev/null +++ b/statping/adminer-deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Service +metadata: + name: adminer + labels: + app: adminer +spec: + type: LoadBalancer + ports: + - port: 9002 + targetPort: 8080 + selector: + app: adminer + tier: frontend +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: adminer + labels: + app: adminer +spec: + selector: + matchLabels: + app: adminer + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: adminer + tier: frontend + spec: + containers: + - image: adminer + name: adminer + ports: + - containerPort: 8080 + name: adminer diff --git a/statping/deployment.yaml b/statping/deployment.yaml new file mode 100644 index 0000000..3445f67 --- /dev/null +++ b/statping/deployment.yaml @@ -0,0 +1,83 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/instance: statping + app.kubernetes.io/name: statping + app.kubernetes.io/version: v0.90.74 + name: statping + namespace: default +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 3 + selector: + matchLabels: + app.kubernetes.io/instance: statping + app.kubernetes.io/name: statping + strategy: + type: Recreate + template: + metadata: + labels: + app.kubernetes.io/instance: statping + app.kubernetes.io/name: statping + spec: + automountServiceAccountToken: true + containers: + - env: + - name: DB_CONN + value: postgres + - name: DB_DATABASE + value: postgres + - name: DB_HOST + value: statping-postgresql + - name: DB_PASS + value: changeme + - name: DB_USER + value: postgres + - name: DESCRIPTION + value: This is a Statping instance deployed as Helm chart + - name: DISABLE_LOGS + value: "false" + - name: NAME + value: Statping Example + - name: POSTGRES_SSLMODE + value: disable + - name: TZ + value: UTC + - name: USE_CDN + value: "false" + - name: VIRTUAL_HOST + - name: VIRTUAL_PORT + value: "8080" + image: statping/statping:v0.90.74 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + periodSeconds: 10 + successThreshold: 1 + tcpSocket: + port: 8080 + timeoutSeconds: 1 + name: statping + ports: + - containerPort: 8080 + name: http + protocol: TCP + readinessProbe: + failureThreshold: 3 + periodSeconds: 10 + successThreshold: 1 + tcpSocket: + port: 8080 + timeoutSeconds: 1 + resources: + startupProbe: + failureThreshold: 30 + periodSeconds: 5 + successThreshold: 1 + tcpSocket: + port: 8080 + timeoutSeconds: 1 + restartPolicy: Always diff --git a/statping/init-config.yaml b/statping/init-config.yaml new file mode 100644 index 0000000..69c7ddd --- /dev/null +++ b/statping/init-config.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: importer +data: + init.sh: | + #!/bin/bash + PGPASSWORD=YOUR_PASSWORD psql -v ON_ERROR_STOP=1 -h statping-postgres -p 5432 -U statping --dbname "statping" <<-EOSQL + TRUNCATE core; + TRUNCATE services; + COPY core FROM '/initdb/core.csv' DELIMITER ',' CSV HEADER; + COPY services FROM '/initdb/services.csv' DELIMITER ',' CSV HEADER; + EOSQL diff --git a/statping/initdb/core.csv b/statping/initdb/core.csv new file mode 100644 index 0000000..2f1d80f --- /dev/null +++ b/statping/initdb/core.csv @@ -0,0 +1,2 @@ +name,description,config,api_secret,style,footer,domain,version,language,migration_id,use_cdn,allow_reports,created_at,updated_at,oauth_providers,gh_client_id,gh_client_secret,gh_users,gh_orgs,google_client_id,google_client_secret,google_users,slack_client_id,slack_client_secret,slack_team,slack_users,custom_name,custom_client_id,custom_client_secret,custom_endpoint_auth,custom_endpoint_token,custom_scopes,custom_open_id +hello world,This status page has sample data included,"",CIxDV7OmcTyWhdlBMnRHTBAkxrQ3h12I,"","",http://localhost:8080,"0.90.74",en,1674076161,f,f,2023-01-18 21:09:21.301778+00,2023-01-18 21:09:21.963744+00,local,"","","","","","","","","","","","","","","","","", diff --git a/statping/initdb/services.csv b/statping/initdb/services.csv new file mode 100644 index 0000000..73a03d6 --- /dev/null +++ b/statping/initdb/services.csv @@ -0,0 +1,3 @@ +id,name,domain,expected,expected_status,check_interval,check_type,method,post_data,port,timeout,order_id,verify_ssl,grpc_health_check,public,group_id,tls_cert,tls_cert_key,tls_cert_root,headers,permalink,redirect,created_at,updated_at,notify_after,allow_notifications,notify_all_changes +1,demo,https://status.superzach.de,"",200,10,http,GET,"","0",10,1,t,f,t,1,"","","","",google,t,2022-10-20 21:09:21.302969+00,2023-01-18 21:09:21.303144+00,3,t,t +2,something,https://github.com/statping/statping,"",200,30,http,GET,"","0",20,2,t,f,t,"0","","","","",statping_github,f,2022-10-20 21:09:21.302969+00,2023-01-18 21:09:21.30423+00,1,t,t diff --git a/statping/kustomization.yaml b/statping/kustomization.yaml new file mode 100644 index 0000000..93412a2 --- /dev/null +++ b/statping/kustomization.yaml @@ -0,0 +1,9 @@ +secretGenerator: + - name: postgres-pass + literals: + - password=YOUR_PASSWORD +resources: + - postgres-deployment.yaml + - init-config.yaml + - statping-deployment.yaml + - adminer-deployment.yaml diff --git a/statping/postgres-deployment.yaml b/statping/postgres-deployment.yaml new file mode 100644 index 0000000..e26722f --- /dev/null +++ b/statping/postgres-deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: v1 +kind: Service +metadata: + name: statping-postgres + labels: + app: statping +spec: + ports: + - port: 5432 + selector: + app: statping + tier: postgres + clusterIP: None +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pv-claim + labels: + app: statping +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: statping-postgres + labels: + app: statping +spec: + selector: + matchLabels: + app: statping + tier: postgres + strategy: + type: Recreate + template: + metadata: + labels: + app: statping + tier: postgres + spec: + containers: + - image: postgres:15.1 + name: postgres + env: + - name: POSTGRES_USER + value: statping + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgres-pass + key: password + ports: + - containerPort: 5432 + name: postgres + volumeMounts: + - name: postgres-persistent-storage + mountPath: /var/lib/postgresql/data + - name: host-mount + mountPath: /initdb + volumes: + - name: host-mount + hostPath: + path: /k8s/statping/initdb + - name: postgres-persistent-storage + persistentVolumeClaim: + claimName: postgres-pv-claim diff --git a/statping/sql-sts.yaml b/statping/sql-sts.yaml new file mode 100644 index 0000000..4bba168 --- /dev/null +++ b/statping/sql-sts.yaml @@ -0,0 +1,116 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app.kubernetes.io/component: primary + app.kubernetes.io/instance: statping + app.kubernetes.io/name: postgresql + name: statping-postgresql + namespace: default +spec: + podManagementPolicy: OrderedReady + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: primary + app.kubernetes.io/instance: statping + app.kubernetes.io/name: postgresql + serviceName: statping-postgresql-hl + template: + metadata: + labels: + app.kubernetes.io/component: primary + app.kubernetes.io/instance: statping + app.kubernetes.io/name: postgresql + name: statping-postgresql + spec: + containers: + - env: + - name: BITNAMI_DEBUG + value: "false" + - name: POSTGRESQL_PORT_NUMBER + value: "5432" + - name: POSTGRESQL_VOLUME_DIR + value: /bitnami/postgresql + - name: PGDATA + value: /bitnami/postgresql/data + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + key: postgres-password + name: statping-postgresql + - name: POSTGRES_DB + value: postgres + - name: POSTGRESQL_ENABLE_LDAP + value: "no" + - name: POSTGRESQL_ENABLE_TLS + value: "no" + - name: POSTGRESQL_LOG_HOSTNAME + value: "false" + - name: POSTGRESQL_LOG_CONNECTIONS + value: "false" + - name: POSTGRESQL_LOG_DISCONNECTIONS + value: "false" + - name: POSTGRESQL_PGAUDIT_LOG_CATALOG + value: "off" + - name: POSTGRESQL_CLIENT_MIN_MESSAGES + value: error + - name: POSTGRESQL_SHARED_PRELOAD_LIBRARIES + value: pgaudit + image: docker.io/bitnami/postgresql:14.4.0-debian-11-r4 + imagePullPolicy: IfNotPresent + livenessProbe: + exec: + command: + - /bin/sh + - -c + - exec pg_isready -U "postgres" -d "dbname=postgres" -h 127.0.0.1 -p 5432 + failureThreshold: 6 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: postgresql + ports: + - containerPort: 5432 + name: tcp-postgresqlh + protocol: TCP + readinessProbe: + exec: + command: + - /bin/sh + - -c + - -e + - | + exec pg_isready -U "postgres" -d "dbname=postgres" -h 127.0.0.1 -p 5432 + [ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ] + failureThreshold: 6 + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + volumeMounts: + - mountPath: /dev/shm + name: dshm + - mountPath: /bitnami/postgresql + name: data + restartPolicy: Always + volumes: + - emptyDir: + medium: Memory + name: dshm + updateStrategy: + type: RollingUpdate + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 8Gi + volumeMode: Filesystem diff --git a/statping/statping-deployment.yaml b/statping/statping-deployment.yaml new file mode 100644 index 0000000..d4e6128 --- /dev/null +++ b/statping/statping-deployment.yaml @@ -0,0 +1,73 @@ +apiVersion: v1 +kind: Service +metadata: + name: statping + labels: + app: statping +spec: + type: LoadBalancer + ports: + - port: 9001 + targetPort: 8080 + selector: + app: statping + tier: frontend +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: statping + labels: + app: statping +spec: + selector: + matchLabels: + app: statping + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: statping + tier: frontend + spec: + containers: + - image: statping/statping + name: statping + env: + - name: DB_CONN + value: postgres + - name: DB_HOST + value: statping-postgres + - name: DB_DATABASE + value: statping + - name: DB_USER + value: statping + - name: DB_PASS + valueFrom: + secretKeyRef: + name: postgres-pass + key: password + ports: + - containerPort: 8080 + name: statping +--- +apiVersion: v1 +kind: Pod +metadata: + name: importer +spec: + containers: + - image: postgres:15.1 + name: postgres-importer + volumeMounts: + - name: importer + mountPath: /init.d + command: ["/init.d/init.sh"] + volumes: + - name: importer + configMap: + name: importer + defaultMode: 0500 + restartPolicy: Never