diff --git a/trainer-env/mysql-k8s/mysql-local-staff-axon.yaml b/trainer-env/mysql-k8s/mysql-local-staff-axon.yaml index 4150f50..efc3591 100644 --- a/trainer-env/mysql-k8s/mysql-local-staff-axon.yaml +++ b/trainer-env/mysql-k8s/mysql-local-staff-axon.yaml @@ -14,15 +14,6 @@ spec: labels: name: axon-mysql spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: "kubernetes.io/hostname" - operator: In - values: - - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com containers: - name: axon-mysql image: mysql:8.0.33 @@ -40,6 +31,16 @@ spec: - name: mysql-data-staff-axon hostPath: path: /data/staff-axon/mysql + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: + - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com + --- apiVersion: v1 kind: Service diff --git a/trainer-env/mysql-k8s/mysql-local-staff-drill.yaml b/trainer-env/mysql-k8s/mysql-local-staff-drill.yaml index b3051a0..7b54562 100644 --- a/trainer-env/mysql-k8s/mysql-local-staff-drill.yaml +++ b/trainer-env/mysql-k8s/mysql-local-staff-drill.yaml @@ -14,15 +14,6 @@ spec: labels: name: drill-mysql spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: "kubernetes.io/hostname" - operator: In - values: - - bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com containers: - name: drill-mysql image: mysql:8.0.33 @@ -40,6 +31,15 @@ spec: - name: mysql-data-staff-axon hostPath: path: /data/staff-axon/mysql + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: + - bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com --- apiVersion: v1 kind: Service diff --git a/trainer-env/axonserver/deployment.yaml b/trainer-upgrade/axons/axons.yaml similarity index 88% rename from trainer-env/axonserver/deployment.yaml rename to trainer-upgrade/axons/axons.yaml index 7e70e5b..e82673d 100644 --- a/trainer-env/axonserver/deployment.yaml +++ b/trainer-upgrade/axons/axons.yaml @@ -19,22 +19,22 @@ data: apiVersion: apps/v1 kind: StatefulSet metadata: - name: axonserver + name: axons labels: - app: axonserver + app: axons spec: - serviceName: axonserver + serviceName: axons replicas: 1 selector: matchLabels: - app: axonserver + app: axons template: metadata: labels: - app: axonserver + app: axons spec: containers: - - name: axonserver + - name: axons image: axoniq/axonserver imagePullPolicy: Always ports: @@ -90,25 +90,26 @@ spec: apiVersion: v1 kind: Service metadata: - name: axonserver-gui + name: axons-gui labels: - app: axonserver + app: axons spec: ports: - name: gui port: 8024 targetPort: 8024 + nodePort: 30026 selector: - app: axonserver - type: LoadBalancer + app: axons + type: NodePort sessionAffinity: ClientIP --- apiVersion: v1 kind: Service metadata: - name: axonserver-grpc + name: axons-grpc labels: - app: axonserver + app: axons spec: ports: - name: grpc @@ -116,4 +117,4 @@ spec: targetPort: 8124 clusterIP: None selector: - app: axonserver \ No newline at end of file + app: axons \ No newline at end of file diff --git a/trainer-upgrade/elastic/elastic.yaml b/trainer-upgrade/elastic/elastic.yaml new file mode 100644 index 0000000..f57f783 --- /dev/null +++ b/trainer-upgrade/elastic/elastic.yaml @@ -0,0 +1,110 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: elastic +spec: + serviceName: elastic + replicas: 3 + selector: + matchLabels: + app: elastic + template: + metadata: + labels: + app: elastic + spec: + securityContext: + fsGroup: 100 + nodeSelector: + kubernetes.io/arch: amd64 + initContainers: + - name: init + image: busybox + imagePullPolicy: IfNotPresent + command: ["/bin/sh", "-c", "sysctl -w vm.max_map_count=262144"] + securityContext: + privileged: true + containers: + - name: elasticsearch + image: docker.elastic.co/elasticsearch/elasticsearch:8.8.0 + imagePullPolicy: Always + ports: + - containerPort: 9200 + name: restful + - containerPort: 9300 + name: transport + env: + - name: cluster.name + value: bfs-elastic-1 + - name: network.host + value: 0.0.0.0 + - name: node.name + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: discovery.seed_hosts + value: "elastic-0.elastic,elastic-1.elastic,elastic-2.elastic" + - name: cluster.initial_master_nodes + value: "elastic-0,elastic-1,elastic-2" + - name: xpack.security.enabled + value: "true" + - name: xpack.monitoring.collection.enabled + value: "true" + - name: ES_JAVA_OPTS + value: "-Xms256m -Xmx256m" + - name: ELASTIC_PASSWORD + value: "changeme" + resources: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 100m + memory: 128Mi + volumeMounts: + - name: es-data + mountPath: /usr/share/elasticsearch/data + volumeClaimTemplates: + - metadata: + name: es-data + spec: + accessModes: ['ReadWriteOnce'] + storageClassName: "local-elastic" + resources: + requests: + storage: 30Gi + +--- +apiVersion: v1 +kind: Service +metadata: + name: elastic-internel + labels: + app: elastic +spec: + ports: + - name: restful + port: 9200 + targetPort: 9200 + nodePort: 30020 + type: NodePort + selector: + app: elastic + +--- +apiVersion: v1 +kind: Service +metadata: + name: elastic + labels: + app: elastic +spec: + ports: + - name: restful + port: 9200 + - name: transport + port: 9300 + clusterIP: None + selector: + app: elastic diff --git a/trainer-upgrade/elastic/stroage.yaml b/trainer-upgrade/elastic/stroage.yaml new file mode 100644 index 0000000..1e4a78e --- /dev/null +++ b/trainer-upgrade/elastic/stroage.yaml @@ -0,0 +1,74 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: local-elastic-0 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic/es_data + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: local-elastic-1 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic/es_data + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: local-elastic-2 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic/es_data + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com + +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-elastic +provisioner: openebs.io/local +allowVolumeExpansion: true +volumeBindingMode: WaitForFirstConsumer diff --git a/trainer-env/jenkins-k8s/deployment-basic.yaml b/trainer-upgrade/jenkins/deployment-basic.yaml similarity index 100% rename from trainer-env/jenkins-k8s/deployment-basic.yaml rename to trainer-upgrade/jenkins/deployment-basic.yaml diff --git a/trainer-upgrade/kafka/kafka.yaml b/trainer-upgrade/kafka/kafka.yaml new file mode 100644 index 0000000..6eeffda --- /dev/null +++ b/trainer-upgrade/kafka/kafka.yaml @@ -0,0 +1,91 @@ +# deployment +--- +apiVersion: platform.confluent.io/v1beta1 +kind: Zookeeper +metadata: + name: zookeeper + namespace: basic +spec: + replicas: 3 + configOverrides: + jvm: + - "-Xmx128m" + podTemplate: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - zookeeper + topologyKey: kubernetes.io/hostname + image: + application: confluentinc/cp-zookeeper:7.4.0 + init: confluentinc/confluent-init-container:2.6.0 + dataVolumeCapacity: 10Gi + logVolumeCapacity: 10Gi + storageClass: + name: local-kafka +--- +apiVersion: platform.confluent.io/v1beta1 +kind: Kafka +metadata: + name: kafka + namespace: basic +spec: + replicas: 3 + configOverrides: + server: + - auto.create.topics.enable=true + - default.replication.factor=3 + jvm: + - "-Xmx512m" + podTemplate: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - kafka + topologyKey: kubernetes.io/hostname + image: + application: confluentinc/cp-server:7.4.0 + init: confluentinc/confluent-init-container:2.6.0 + dataVolumeCapacity: 20Gi + storageClass: + name: local-kafka + metricReporter: + enabled: true + dependencies: + zookeeper: + endpoint: zookeeper.basic.svc.cluster.local:2181 +--- +apiVersion: platform.confluent.io/v1beta1 +kind: SchemaRegistry +metadata: + name: schemaregistry + namespace: basic +spec: + replicas: 3 + configOverrides: + jvm: + - "-Xmx128m" + podTemplate: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - schemaregistry + topologyKey: kubernetes.io/hostname + image: + application: confluentinc/cp-schema-registry:7.4.0 + init: confluentinc/confluent-init-container:2.6.0 \ No newline at end of file diff --git a/trainer-upgrade/kafka/storage.yaml b/trainer-upgrade/kafka/storage.yaml new file mode 100644 index 0000000..ed8c6e4 --- /dev/null +++ b/trainer-upgrade/kafka/storage.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: kafka-local +provisioner: openebs.io/local +reclaimPolicy: Retain +allowVolumeExpansion: true +volumeBindingMode: WaitForFirstConsumer \ No newline at end of file diff --git a/trainer-upgrade/mongo/mongo.yaml b/trainer-upgrade/mongo/mongo.yaml new file mode 100644 index 0000000..cab0a62 --- /dev/null +++ b/trainer-upgrade/mongo/mongo.yaml @@ -0,0 +1,55 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mongo +spec: + replicas: 1 + serviceName: mongo + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - name: mongo + image: mongo:6.0.6 + imagePullPolicy: IfNotPresent + env: + - name: MONGO_INITDB_ROOT_USERNAME + value: root + - name: MONGO_INITDB_ROOT_PASSWORD + value: 'beaconfire123' + ports: + - containerPort: 27017 + volumeMounts: + - name: mongo-data + mountPath: /data/db + volumeClaimTemplates: + - metadata: + name: mongo-data + spec: + accessModes: ['ReadWriteOnce'] + storageClassName: "local-mongo" + resources: + requests: + storage: 5Gi + +--- +apiVersion: v1 +kind: Service +metadata: + name: mongo +spec: + selector: + app: mongo + ports: + - name: mongo + protocol: TCP + port: 27017 + targetPort: 27017 + nodePort: 30018 + type: NodePort diff --git a/trainer-upgrade/mongo/storage.yaml b/trainer-upgrade/mongo/storage.yaml new file mode 100644 index 0000000..3fde9b8 --- /dev/null +++ b/trainer-upgrade/mongo/storage.yaml @@ -0,0 +1,32 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-mongo +provisioner: kubernetes.io/no-provisioner +allowVolumeExpansion: true +volumeBindingMode: WaitForFirstConsumer + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: local-mongo-0 + labels: + type: local +spec: + storageClassName: local-mongo + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + local: + path: /data/mongo + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com \ No newline at end of file diff --git a/trainer-upgrade/mysql/mysql-axonserver.yaml b/trainer-upgrade/mysql/mysql-axonserver.yaml new file mode 100644 index 0000000..4a15d92 --- /dev/null +++ b/trainer-upgrade/mysql/mysql-axonserver.yaml @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: mysql-axons + namespace: basic + labels: + name: mysql-axons +spec: + replicas: 1 + selector: + name: mysql-axons + template: + metadata: + labels: + name: mysql-axons + spec: + containers: + - name: mysql-axons + image: mysql:8.0.33 + ports: + - containerPort: 3306 + volumeMounts: + - name: data-axons + mountPath: /var/lib/mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: "Beaconfire@2099" + - name: MYSQL_DATABASE + value: "event_store" + volumes: + - name: data-axons + hostPath: + path: /data/staff-axon/mysql + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: + - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql-axons + namespace: basic + labels: + name: mysql-axons +spec: + ports: + - protocol: TCP + port: 3306 + targetPort: 3306 + nodePort: 30016 + selector: + name: mysql-axons + type: NodePort \ No newline at end of file diff --git a/trainer-upgrade/mysql/mysql-drill.yaml b/trainer-upgrade/mysql/mysql-drill.yaml new file mode 100644 index 0000000..fbc7e34 --- /dev/null +++ b/trainer-upgrade/mysql/mysql-drill.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: mysql-drill + namespace: basic + labels: + name: mysql-drill +spec: + replicas: 1 + selector: + name: mysql-drill + template: + metadata: + labels: + name: mysql-drill + spec: + containers: + - name: mysql-drill + image: mysql:8.0.33 + ports: + - containerPort: 3306 + volumeMounts: + - name: data-drill + mountPath: /var/lib/mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: "Beaconfire@2099" + volumes: + - name: data-drill + hostPath: + path: /data/staff-axon/mysql + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "kubernetes.io/hostname" + operator: In + values: + - bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql-drill + namespace: basic + labels: + name: mysql-drill +spec: + ports: + - protocol: TCP + port: 3306 + targetPort: 3306 + nodePort: 30017 + selector: + name: mysql-drill + type: NodePort \ No newline at end of file