diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8e2cbcf Binary files /dev/null and b/.DS_Store differ 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 0000000..e17b369 Binary files /dev/null and b/statping/.DS_Store differ 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