forked from k-space/kube
		
	Add mysql-clusters namespace
This commit is contained in:
		
							
								
								
									
										8
									
								
								mysql-clusters/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mysql-clusters/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| # MySQL clusters | ||||
|  | ||||
| This is namespace for MySQL clusters managed by operator-bundle | ||||
|  | ||||
| ``` | ||||
| kubectl create namespace mysql-clusters | ||||
| kubectl apply -n mysql-clusters -f application.yaml | ||||
| ``` | ||||
| @@ -1,9 +1,53 @@ | ||||
| --- | ||||
| apiVersion: codemowers.io/v1alpha1 | ||||
| kind: ClusterMysqlDatabaseClass | ||||
| metadata: | ||||
|   name: external | ||||
| spec: | ||||
|   targetCluster: external | ||||
|   targetNamespace: mysql-clusters | ||||
|   description: "MySQL instance running on the ZFS box" | ||||
| --- | ||||
| apiVersion: codemowers.io/v1alpha1 | ||||
| kind: ClusterMysqlDatabaseClass | ||||
| metadata: | ||||
|   name: shared | ||||
| spec: | ||||
|   targetCluster: shared | ||||
|   targetNamespace: mysql-clusters | ||||
|   description: "Shared MySQL cluster" | ||||
|   replicas: 3 | ||||
|   routers: 2 | ||||
|   storageClass: mysql | ||||
| --- | ||||
| apiVersion: codemowers.io/v1alpha1 | ||||
| kind: ClusterMysqlDatabaseClass | ||||
| metadata: | ||||
|   name: dedicated | ||||
| spec: | ||||
|   targetNamespace: mysql-clusters | ||||
|   description: "Dedicated MySQL cluster" | ||||
|   replicas: 3 | ||||
|   routers: 2 | ||||
|   storageClass: mysql | ||||
| --- | ||||
| apiVersion: v1 | ||||
| kind: ConfigMap | ||||
| metadata: | ||||
|   name: phpmyadmin | ||||
|   namespace: mysql-clusters | ||||
| data: | ||||
|   config.user.inc.php: | | ||||
|     <?php | ||||
|     for ($i = 1; isset($hosts[$i - 1]); $i++) { | ||||
|       $cfg['Servers'][$i]['ssl'] = true; | ||||
|     } | ||||
| --- | ||||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   name: phpmyadmin | ||||
|   labels: | ||||
|     app: phpmyadmin | ||||
|   namespace: mysql-clusters | ||||
| spec: | ||||
|   # phpMyAdmin session handling is not really compatible with more replicas | ||||
|   replicas: 1 | ||||
| @@ -18,32 +62,39 @@ spec: | ||||
|       containers: | ||||
|         - name: phpmyadmin | ||||
|           image: phpmyadmin/phpmyadmin | ||||
|           volumeMounts: | ||||
|             - name: config | ||||
|               mountPath: /etc/phpmyadmin/config.user.inc.php | ||||
|               subPath: config.user.inc.php | ||||
|           ports: | ||||
|             - name: web | ||||
|               containerPort: 80 | ||||
|               protocol: TCP | ||||
|           env: | ||||
|             - name: PMA_ARBITRARY | ||||
|               value: "1" | ||||
|             - name: PMA_HOSTS | ||||
|               value: mysql-cluster.authelia,mysql-cluster.etherpad,mariadb.authelia,mariadb.nextcloud,172.20.36.1 | ||||
|               value: mysql-cluster-shared.mysql-clusters,mysql-cluster.authelia,mysql-cluster.etherpad,mariadb.authelia,mariadb.nextcloud,172.20.36.1 | ||||
|             - name: PMA_PORTS | ||||
|               value: 6446,6446,3306,3306,3306 | ||||
|               value: 6446,6446,6446,3306,3306,3306 | ||||
|             - name: PMA_ABSOLUTE_URI | ||||
|               value: https://phpmyadmin.k-space.ee/ | ||||
|             - name: UPLOAD_LIMIT | ||||
|               value: 10G | ||||
|       volumes: | ||||
|         - name: config | ||||
|           configMap: | ||||
|             name: phpmyadmin | ||||
| --- | ||||
| apiVersion: networking.k8s.io/v1 | ||||
| kind: Ingress | ||||
| metadata: | ||||
|   name: phpmyadmin | ||||
|   namespace: mysql-clusters | ||||
|   annotations: | ||||
|     kubernetes.io/ingress.class: traefik | ||||
|     traefik.ingress.kubernetes.io/router.entrypoints: websecure | ||||
|     traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd | ||||
|     traefik.ingress.kubernetes.io/router.tls: "true" | ||||
|     external-dns.alpha.kubernetes.io/target: traefik.k-space.ee | ||||
|     traefik.ingress.kubernetes.io/router.middlewares: traefik-sso@kubernetescrd | ||||
| spec: | ||||
|   rules: | ||||
|   - host: phpmyadmin.k-space.ee | ||||
| @@ -64,8 +115,7 @@ apiVersion: v1 | ||||
| kind: Service | ||||
| metadata: | ||||
|   name: phpmyadmin | ||||
|   labels: | ||||
|     app: phpmyadmin | ||||
|   namespace: mysql-clusters | ||||
| spec: | ||||
|   selector: | ||||
|     app: phpmyadmin | ||||
| @@ -73,36 +123,3 @@ spec: | ||||
|   - protocol: TCP | ||||
|     port: 80 | ||||
|     targetPort: 80 | ||||
| --- | ||||
| apiVersion: networking.k8s.io/v1 | ||||
| kind: NetworkPolicy | ||||
| metadata: | ||||
|   name: phpmyadmin | ||||
| spec: | ||||
|   podSelector: | ||||
|     matchLabels: | ||||
|       app: phpmyadmin | ||||
|   policyTypes: | ||||
|   - Ingress | ||||
|   - Egress | ||||
|   ingress: | ||||
|     - from: | ||||
|         - namespaceSelector: | ||||
|             matchLabels: | ||||
|               kubernetes.io/metadata.name: traefik | ||||
|       ports: | ||||
|         - protocol: TCP | ||||
|           port: 80 | ||||
|   egress: | ||||
|   - # Allow connecting to MySQL instance in any namespace | ||||
|     to: | ||||
|     - namespaceSelector: {} | ||||
|     ports: | ||||
|     - port: 6446 | ||||
|   - # Allow connecting to any MySQL instance outside the cluster | ||||
|     to: | ||||
|     - ipBlock: | ||||
|         cidr: 0.0.0.0/0 | ||||
|     ports: | ||||
|     - protocol: TCP | ||||
|       port: 3306 | ||||
| @@ -1,5 +0,0 @@ | ||||
| # phpMyAdmin | ||||
|  | ||||
| ``` | ||||
| kubectl apply -n phpmyadmin -f application.yml | ||||
| ``` | ||||
| @@ -1 +0,0 @@ | ||||
| ../shared/networkpolicy-base.yml | ||||
		Reference in New Issue
	
	Block a user