
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/rbac-cluster.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: helm-emqxs
  namespace: xtgt
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: helm-rabbitmq
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
automountServiceAccountToken: true
secrets:
  - name: helm-rabbitmq
---
# Source: outside-deploy/charts/mysql-db/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: helm-mysql
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
  annotations:
secrets:
  - name: helm-mysql
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/secrets.yaml
apiVersion: v1
kind: Secret
metadata:
  name: helm-rabbitmq
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
type: Opaque
data:
  rabbitmq-password: "blljUk45MXIuX2hq"
  rabbitmq-erlang-cookie: "ZHczVHhEaTM1cEc0U3BubzlHZ1lkZEk2TDhYOUxHZk0="
---
# Source: outside-deploy/charts/mysql-db/templates/secrets.yaml
apiVersion: v1
kind: Secret
metadata:
  name: helm-mysql
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
type: Opaque
data:
  mysql-root-password: "UXpmWFFoZDNiUQ=="
  mysql-password: "SXREQmtnMllneA=="
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/configmap-cluster.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-emqxs-env
  namespace: xtgt
  labels:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
    helm.sh/chart: emqx-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
data:
  EMQX_CLUSTER__K8S__ADDRESS_TYPE: hostname
  EMQX_CLUSTER__K8S__APISERVER: https://kubernetes.default.svc:443
  EMQX_CLUSTER__K8S__SUFFIX: svc.cluster.local
  EMQX_NAME: helm-emqxs
  EMQX_CLUSTER__K8S__APP_NAME: helm-emqxs
  EMQX_CLUSTER__DISCOVERY: k8s
  EMQX_CLUSTER__K8S__SERVICE_NAME: helm-emqxs-headless
  EMQX_CLUSTER__K8S__NAMESPACE: xtgt
  EMQX_ALLOW_ANONYMOUS: "false"
  EMQX_ACL_NOMATCH: "deny"
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/configmap-cluster.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-emqxs-cm
  namespace: xtgt
  labels:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
    helm.sh/chart: emqx-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
data:
  emqx_auth_username.conf: |-
    auth.user.1.username = cmlc
    auth.user.1.password = odD8#Ve7.B
    auth.user.password_hash = sha256

  acl.conf: |-
    {allow, {user, "admin"}, pubsub, ["admin/#"]}.
    {allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
    {allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
    {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
    {allow, all}.

  loaded_plugins: |-
    {emqx_auth_username,true}.
    {emqx_management, true}.
    {emqx_recon, true}.
    {emqx_retainer, false}.
    {emqx_dashboard, true}.
    {emqx_telemetry, true}.
    {emqx_rule_engine, true}.
    {emqx_bridge_mqtt, false}.
---
# Source: outside-deploy/charts/all-middleware/charts/nacos/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-nacos-cm
  namespace: xtgt
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    helm.sh/chart: nacos-1.1.1
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
data:
  mysql.db.name: "nacos_config"
  mysql.db.host: "helm-mysql"
  mysql.port: "3306"
  mysql.user: "k8s_admin"
  mysql.password: "EWde2cKP9w.G"
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/configuration.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-rabbitmq-config
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
data:
  rabbitmq.conf: |-
    ## Username and password
    ##
    default_user = admin
    default_pass = nYcRN91r._hj
    ## Clustering
    ##
    cluster_formation.peer_discovery_backend  = rabbit_peer_discovery_k8s
    cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
    cluster_formation.node_cleanup.interval = 10
    cluster_formation.node_cleanup.only_log_warning = true
    cluster_partition_handling = autoheal
    # queue master locator
    queue_master_locator = min-masters
    # enable guest user
    loopback_users.guest = false
    #default_vhost = xtgt-vhost
    #disk_free_limit.absolute = 50MB
    #load_definitions = /app/load_definition.json
---
# Source: outside-deploy/charts/mysql-db/templates/primary/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-mysql
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
    app.kubernetes.io/component: primary
data:
  my.cnf: |-
    
    [mysqld]
    port=3306
    basedir=/opt/bitnami/mysql
    datadir=/bitnami/mysql/data
    pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
    socket=/opt/bitnami/mysql/tmp/mysql.sock
    log-error=/bitnami/mysql/data/error.log
    general_log_file = /bitnami/mysql/data/general.log
    slow_query_log_file = /bitnami/mysql/data/slow.log
    innodb_data_file_path = ibdata1:512M:autoextend
    innodb_buffer_pool_size = 512M
    innodb_buffer_pool_instances = 2
    innodb_log_file_size = 512M
    innodb_log_files_in_group = 4
    innodb_log_files_in_group = 4
    log-bin = /bitnami/mysql/data/mysql-bin
    max_binlog_size=1G
    transaction_isolation = REPEATABLE-READ
    default_storage_engine = innodb
    character-set-server = utf8mb4
    collation-server=utf8mb4_bin
    binlog_format = ROW
    binlog_rows_query_log_events=on
    binlog_cache_size=4M
    binlog_expire_logs_seconds  = 1296000
    max_binlog_cache_size=2G
    gtid_mode = on
    enforce_gtid_consistency = 1
    sync_binlog = 1
    innodb_flush_log_at_trx_commit = 1
    innodb_flush_method = O_DIRECT
    log_slave_updates=1
    relay_log_recovery = 1
    relay-log-purge = 1
    default_time_zone = '+08:00'
    lower_case_table_names=1
    log_bin_trust_function_creators=1
    group_concat_max_len=67108864
    innodb_io_capacity = 4000
    innodb_io_capacity_max = 8000
    innodb_flush_sync = 0
    innodb_flush_neighbors = 0
    innodb_write_io_threads = 8
    innodb_read_io_threads = 8
    innodb_purge_threads = 4
    innodb_page_cleaners = 4
    innodb_open_files = 65535
    innodb_max_dirty_pages_pct = 50
    innodb_lru_scan_depth = 4000
    innodb_checksum_algorithm = crc32
    innodb_lock_wait_timeout = 10
    innodb_rollback_on_timeout = 1
    innodb_print_all_deadlocks = 1
    innodb_file_per_table = 1
    innodb_online_alter_log_max_size = 4G
    innodb_stats_on_metadata = 0
    innodb_thread_concurrency = 0
    innodb_sync_spin_loops = 100
    innodb_spin_wait_delay = 30
    lock_wait_timeout = 3600
    slow_query_log = 1
    long_query_time = 10
    log_queries_not_using_indexes =1
    log_throttle_queries_not_using_indexes = 60
    min_examined_row_limit = 100
    log_slow_admin_statements = 1
    log_slow_slave_statements = 1
    default_authentication_plugin=mysql_native_password
    skip-name-resolve=1
    explicit_xtgts_for_timestamp=1
    plugin_dir=/opt/bitnami/mysql/plugin
    max_allowed_packet=128M
    max_connections = 2000
    max_connect_errors = 1000000
    table_definition_cache=2000
    table_open_cache_instances=64
    tablespace_definition_cache=1024
    thread_cache_size=256
    interactive_timeout = 600
    wait_timeout = 600
    tmpdir=/opt/bitnami/mysql/tmp
    max_allowed_packet=32M
    bind-address=0.0.0.0
    performance_schema = 1
    performance_schema_instrument = '%memory%=on'
    performance_schema_instrument = '%lock%=on'
    innodb_monitor_enable=ALL
    
    [mysql]
    no-auto-rehash
    
    [mysqldump]
    quick
    max_allowed_packet = 32M
    
    [client]
    port=3306
    socket=/opt/bitnami/mysql/tmp/mysql.sock
    default-character-set=UTF8
    plugin_dir=/opt/bitnami/mysql/plugin
    
    [manager]
    port=3306
    socket=/opt/bitnami/mysql/tmp/mysql.sock
    pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
---
# Source: outside-deploy/charts/mysql-db/templates/primary/initialization-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-mysql-init-scripts
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
    app.kubernetes.io/component: primary
data:
  create_users_grants_core.sql: |-
    create user zyly@'%' identified by 'Cmii@451315';
    grant select on *.* to zyly@'%';
    create user zyly_qc@'%' identified by 'Uh)E_owCyb16';
    grant all on *.* to zyly_qc@'%';
    create user k8s_admin@'%' identified by 'fP#UaH6qQ3)8';
    grant all on *.* to k8s_admin@'%';
    create user audit_dba@'%' identified by 'PjCzqiBmJaTpgkoYXynH';
    grant all on *.* to audit_dba@'%';
    create user db_backup@'%' identified by 'RU5Pu(4FGdT9';
    GRANT SELECT, RELOAD, PROCESS, LOCK TABLES, REPLICATION CLIENT, EVENT on *.* to db_backup@'%';
    create user monitor@'%' identified by 'PL3#nGtrWbf-';
    grant REPLICATION CLIENT on *.* to monitor@'%';
    flush privileges;
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/rbac-cluster.yaml
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: helm-emqxs
  namespace: xtgt
rules:
  - apiGroups:
      - ""
    resources:
      - endpoints
    verbs:
      - get
      - watch
      - list
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/role.yaml
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: helm-rabbitmq-endpoint-reader
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
rules:
  - apiGroups: [""]
    resources: ["endpoints"]
    verbs: ["get"]
  - apiGroups: [""]
    resources: ["events"]
    verbs: ["create"]
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/rbac-cluster.yaml
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: helm-emqxs
  namespace: xtgt
subjects:
  - kind: ServiceAccount
    name: helm-emqxs
    namespace: xtgt
roleRef:
  kind: Role
  name: helm-emqxs
  apiGroup: rbac.authorization.k8s.io
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/rolebinding.yaml
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: helm-rabbitmq-endpoint-reader
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
subjects:
  - kind: ServiceAccount
    name: helm-rabbitmq
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: helm-rabbitmq-endpoint-reader
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/svc-cluster.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-emqxs
  namespace: xtgt
  labels:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
    helm.sh/chart: emqx-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  type: NodePort
  selector:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
  ports:
    - port: 1883
      name: mqtt
      targetPort: 1883
      nodePort: 31883
    - port: 18083
      name: dashboard
      targetPort: 18083
      nodePort: 38085
    - port: 8083
      name: mqtt-websocket
      targetPort: 8083
      nodePort: 38083
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/svc-headless.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-emqxs-headless
  namespace: xtgt
  labels:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
    helm.sh/chart: emqx-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  type: ClusterIP
  clusterIP: None
  selector:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
  ports:
    - name: mqtt
      port: 1883
      protocol: TCP
      targetPort: 1883
    - name: mqttssl
      port: 8883
      protocol: TCP
      targetPort: 8883
    - name: mgmt
      port: 8081
      protocol: TCP
      targetPort: 8081
    - name: websocket
      port: 8083
      protocol: TCP
      targetPort: 8083
    - name: wss
      port: 8084
      protocol: TCP
      targetPort: 8084
    - name: dashboard
      port: 18083
      protocol: TCP
      targetPort: 18083
    - name: ekka
      port: 4370
      protocol: TCP
      targetPort: 4370
---
# Source: outside-deploy/charts/all-middleware/charts/mongo/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-mongo
  namespace: xtgt
  labels:
    cmii.app: helm-mongo
    cmii.type: middleware
    helm.sh/chart: mongo-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  type: ClusterIP
  selector:
    cmii.app: helm-mongo
    cmii.type: middleware
  ports:
    - port: 27017
      name: server-27017
      targetPort: 27017
---
# Source: outside-deploy/charts/all-middleware/charts/nacos/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-nacos
  namespace: xtgt
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    helm.sh/chart: nacos-1.1.1
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  type: ClusterIP
  selector:
    cmii.app: helm-nacos
    cmii.type: middleware
  ports:
    - port: 8848
      name: server
      targetPort: 8848
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/svc-headless.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-rabbitmq-headless
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
spec:
  clusterIP: None
  ports:
    - name: epmd
      port: 4369
      targetPort: epmd
    - name: amqp
      port: 5672
      targetPort: amqp
    - name: dist
      port: 25672
      targetPort: dist
    - name: dashboard
      port: 15672
      targetPort: stats
  selector: 
    app.kubernetes.io/name: helm-rabbitmq
    app.kubernetes.io/release: xtgt
  publishNotReadyAddresses: true
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-rabbitmq
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
spec:
  type: ClusterIP
  ports:
    - name: amqp
      port: 5672
      targetPort: amqp
    - name: dashboard
      port: 15672
      targetPort: dashboard
  selector: 
    app.kubernetes.io/name: helm-rabbitmq
    app.kubernetes.io/release: xtgt
---
# Source: outside-deploy/charts/mysql-db/templates/primary/svc-headless.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-mysql-headless
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
    cmii.type: middleware
    cmii.app: mysql
    app.kubernetes.io/component: primary
  annotations:
spec:
  type: ClusterIP
  clusterIP: None
  publishNotReadyAddresses: true
  ports:
    - name: mysql
      port: 3306
      targetPort: mysql
  selector: 
    app.kubernetes.io/name: mysql-db
    app.kubernetes.io/release: xtgt
    cmii.type: middleware
    cmii.app: mysql
    app.kubernetes.io/component: primary
---
# Source: outside-deploy/charts/mysql-db/templates/primary/svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: helm-mysql
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
    cmii.type: middleware
    cmii.app: mysql
    app.kubernetes.io/component: primary
  annotations:
spec:
  type: ClusterIP
  ports:
    - name: mysql
      port: 3306
      protocol: TCP
      targetPort: mysql
      nodePort: null
  selector: 
    app.kubernetes.io/name: mysql-db
    app.kubernetes.io/release: xtgt
    cmii.type: middleware
    cmii.app: mysql
    app.kubernetes.io/component: primary
---
# Source: outside-deploy/charts/all-middleware/charts/emqx/templates/cluster/statefulset-cluster.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-emqxs
  namespace: xtgt
  labels:
    cmii.type: middleware
    cmii.app: helm-emqxs
    cmii.emqx.architecture: cluster
    helm.sh/chart: emqx-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  replicas: 3
  serviceName: helm-emqxs-headless
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      cmii.type: middleware
      cmii.app: helm-emqxs
      cmii.emqx.architecture: cluster
  template:
    metadata:
      labels:
        cmii.type: middleware
        cmii.app: helm-emqxs
        cmii.emqx.architecture: cluster
        helm.sh/chart: emqx-1.1.0
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/version: "3.1.0"
    spec:
      affinity: {}
      serviceAccountName: helm-emqxs
      containers:
        - name: helm-emqxs
          image: "172.32.12.34:8033/cmii/emqx:4.2.12"
          imagePullPolicy: Always
          ports:
            - name: mqtt
              containerPort: 1883
            - name: mqttssl
              containerPort: 8883
            - name: mgmt
              containerPort: 8081
            - name: ws
              containerPort: 8083
            - name: wss
              containerPort: 8084
            - name: dashboard
              containerPort: 18083
            - name: ekka
              containerPort: 4370
          envFrom:
            - configMapRef:
                name: helm-emqxs-env
          resources:
            limits:
              cpu: "1"
              memory: 2Gi
            requests:
              cpu: 300m
              memory: 1Gi
          readinessProbe:
            httpGet:
              path: /status
              port: 8081
            initialDelaySeconds: 5
            periodSeconds: 5
          volumeMounts:
            - name: emqx-data
              mountPath: "/opt/emqx/data/mnesia"
              readOnly: false
            - name: helm-emqxs-cm
              mountPath: "/opt/emqx/etc/plugins/emqx_auth_username.conf"
              subPath: emqx_auth_username.conf
              readOnly: false
            - name: helm-emqxs-cm
              mountPath: "/opt/emqx/etc/acl.conf"
              subPath: "acl.conf"
              readOnly: false
            - name: helm-emqxs-cm
              mountPath: "/opt/emqx/data/loaded_plugins"
              subPath: loaded_plugins
              readOnly: false
      volumes:
        - name: emqx-data
          persistentVolumeClaim:
            claimName: helm-emqxs
        - name: helm-emqxs-cm
          configMap:
            name: helm-emqxs-cm
            items:
              - key: emqx_auth_username.conf
                path: emqx_auth_username.conf
              - key: acl.conf
                path: acl.conf
              - key: loaded_plugins
                path: loaded_plugins
---
# Source: outside-deploy/charts/all-middleware/charts/mongo/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-mongo
  namespace: xtgt
  labels:
    cmii.app: helm-mongo
    cmii.type: middleware
    helm.sh/chart: mongo-1.1.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  serviceName: helm-mongo
  replicas: 1
  selector:
    matchLabels:
      cmii.app: helm-mongo
      cmii.type: middleware
  template:
    metadata:
      labels:
        cmii.app: helm-mongo
        cmii.type: middleware
        helm.sh/chart: mongo-1.1.0
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/version: "3.1.0"
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      affinity: {}
      containers:
        - name: helm-mongo
          image: "172.32.12.34:8033/cmii/mongo:5.0"
          resources:
            limits:
              cpu: "2"
              memory: 4Gi
            requests:
              cpu: "1"
              memory: 2Gi
          ports:
            - containerPort: 27017
              name: mongo27017
              protocol: TCP
          env:
            - name: MONGO_INITDB_ROOT_USERNAME
              value: cmlc
            - name: MONGO_INITDB_ROOT_PASSWORD
              value: REdPza8#oVlt
          volumeMounts:
            - name: mongo-data
              mountPath: /data/db
              readOnly: false
              subPath: xtgt/helm-mongo/data/db
      volumes:
        - name: mongo-data
          persistentVolumeClaim:
            claimName: helm-mongo
---
# Source: outside-deploy/charts/all-middleware/charts/nacos/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-nacos
  namespace: xtgt
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    helm.sh/chart: nacos-1.1.1
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "3.1.0"
spec:
  serviceName: helm-nacos
  replicas: 1
  selector:
    matchLabels:
      cmii.app: helm-nacos
      cmii.type: middleware
  template:
    metadata:
      labels:
        cmii.app: helm-nacos
        cmii.type: middleware
        helm.sh/chart: nacos-1.1.1
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/version: "3.1.0"
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      affinity: {}
      containers:
        - name: nacos-server
          image: "172.32.12.34:8033/cmii/nacos-server:2.0.1"
          ports:
            - containerPort: 8848
              name: dashboard
          env:
            - name: NACOS_AUTH_ENABLE
              value: "true"
            - name: NACOS_REPLICAS
              value: "1"
            - name: MYSQL_SERVICE_DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.db.name
            - name: MYSQL_SERVICE_PORT
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.port
            - name: MYSQL_SERVICE_USER
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.user
            - name: MYSQL_SERVICE_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.password
            - name: MYSQL_SERVICE_HOST
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.db.host
            - name: NACOS_SERVER_PORT
              value: "8848"
            - name: NACOS_APPLICATION_PORT
              value: "8848"
            - name: PREFER_HOST_MODE
              value: "hostname"
            - name: MODE
              value: standalone
            - name: SPRING_DATASOURCE_PLATFORM
              value: mysql
          resources:
            limits:
              cpu: "1"
              memory: 2Gi
            requests:
              cpu: 500m
              memory: 1Gi
---
# Source: outside-deploy/charts/all-middleware/charts/rabbitmq/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-rabbitmq
  namespace: "xtgt"
  labels:
    app.kubernetes.io/name: helm-rabbitmq
    helm.sh/chart: rabbitmq-8.26.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: rabbitmq
spec:
  serviceName: helm-rabbitmq-headless
  podManagementPolicy: OrderedReady
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app.kubernetes.io/name: helm-rabbitmq
      app.kubernetes.io/release: xtgt
  template:
    metadata:
      labels:
        app.kubernetes.io/name: helm-rabbitmq
        helm.sh/chart: rabbitmq-8.26.1
        app.kubernetes.io/release: xtgt
        app.kubernetes.io/managed-by: rabbitmq
      annotations:
        checksum/config: d6c2caa9572f64a06d9f7daa34c664a186b4778cd1697ef8e59663152fc628f1
        checksum/secret: 8fb8044e4f8278f22279b8c032726643705008d6096266874a1cc61e41de0514
    spec:
      
      serviceAccountName: helm-rabbitmq
      affinity: {}
      securityContext:
        fsGroup: 5001
        runAsUser: 5001
      terminationGracePeriodSeconds: 120
      initContainers:
        - name: volume-permissions
          image: "172.32.12.34:8033/cmii/bitnami-shell:10-debian-10-r140"
          imagePullPolicy: "Always"
          command:
            - /bin/bash
          args:
            - -ec
            - |
              mkdir -p "/bitnami/rabbitmq/mnesia"
              chown -R "5001:5001" "/bitnami/rabbitmq/mnesia"
          securityContext:
            runAsUser: 0
          resources:
            limits: {}
            requests: {}
          volumeMounts:
            - name: data
              mountPath: /bitnami/rabbitmq/mnesia
      containers:
        - name: rabbitmq
          image: "172.32.12.34:8033/cmii/rabbitmq:3.9.12-debian-10-r3"
          imagePullPolicy: "Always"
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: MY_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MY_POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: K8S_SERVICE_NAME
              value: "helm-rabbitmq-headless"
            - name: K8S_ADDRESS_TYPE
              value: hostname
            - name: RABBITMQ_FORCE_BOOT
              value: "no"
            - name: RABBITMQ_NODE_NAME
              value: "rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local"
            - name: K8S_HOSTNAME_SUFFIX
              value: ".$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local"
            - name: RABBITMQ_MNESIA_DIR
              value: "/bitnami/rabbitmq/mnesia/$(RABBITMQ_NODE_NAME)"
            - name: RABBITMQ_LDAP_ENABLE
              value: "no"
            - name: RABBITMQ_LOGS
              value: "-"
            - name: RABBITMQ_ULIMIT_NOFILES
              value: "65536"
            - name: RABBITMQ_USE_LONGNAME
              value: "true"
            - name: RABBITMQ_ERL_COOKIE
              valueFrom:
                secretKeyRef:
                  name: helm-rabbitmq
                  key: rabbitmq-erlang-cookie
            - name: RABBITMQ_LOAD_DEFINITIONS
              value: "no"
            - name: RABBITMQ_SECURE_PASSWORD
              value: "yes"
            - name: RABBITMQ_USERNAME
              value: "admin"
            - name: RABBITMQ_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: helm-rabbitmq
                  key: rabbitmq-password
            - name: RABBITMQ_PLUGINS
              value: "rabbitmq_management, rabbitmq_peer_discovery_k8s, rabbitmq_shovel, rabbitmq_shovel_management, rabbitmq_auth_backend_ldap"
          ports:
            - name: amqp
              containerPort: 5672
            - name: dist
              containerPort: 25672
            - name: dashboard
              containerPort: 15672
            - name: epmd
              containerPort: 4369
          livenessProbe:
            exec:
              command:
                - /bin/bash
                - -ec
                - rabbitmq-diagnostics -q ping
            initialDelaySeconds: 120
            periodSeconds: 30
            timeoutSeconds: 20
            successThreshold: 1
            failureThreshold: 6
          readinessProbe:
            exec:
              command:
                - /bin/bash
                - -ec
                - rabbitmq-diagnostics -q check_running && rabbitmq-diagnostics -q check_local_alarms
            initialDelaySeconds: 10
            periodSeconds: 30
            timeoutSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          lifecycle:
            preStop:
              exec:
                command:
                  - /bin/bash
                  - -ec
                  - |
                    if [[ -f /opt/bitnami/scripts/rabbitmq/nodeshutdown.sh ]]; then
                        /opt/bitnami/scripts/rabbitmq/nodeshutdown.sh -t "120" -d  "false"
                    else
                        rabbitmqctl stop_app
                    fi
          resources:
            limits: {}
            requests: {}
          volumeMounts:
            - name: configuration
              mountPath: /bitnami/rabbitmq/conf
            - name: data
              mountPath: /bitnami/rabbitmq/mnesia
      volumes:
        - name: configuration
          configMap:
            name: helm-rabbitmq-config
            items:
              - key: rabbitmq.conf
                path: rabbitmq.conf
        - name: data
          persistentVolumeClaim:
            claimName: helm-rabbitmq
---
# Source: outside-deploy/charts/mysql-db/templates/primary/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-mysql
  namespace: xtgt
  labels:
    app.kubernetes.io/name: mysql-db
    helm.sh/chart: mysql-db-8.8.1
    app.kubernetes.io/release: xtgt
    app.kubernetes.io/managed-by: mysql-db
    cmii.type: middleware
    cmii.app: mysql
    app.kubernetes.io/component: primary
spec:
  replicas: 1
  selector:
    matchLabels: 
      app.kubernetes.io/name: mysql-db
      app.kubernetes.io/release: xtgt
      cmii.type: middleware
      cmii.app: mysql
      app.kubernetes.io/component: primary
  serviceName: helm-mysql
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        checksum/configuration: 6b60fa0f3a846a6ada8effdc4f823cf8003d42a8c8f630fe8b1b66d3454082dd
      labels:
        app.kubernetes.io/name: mysql-db
        helm.sh/chart: mysql-db-8.8.1
        app.kubernetes.io/release: xtgt
        app.kubernetes.io/managed-by: mysql-db
        cmii.type: middleware
        cmii.app: mysql
        app.kubernetes.io/component: primary
    spec:
      
      serviceAccountName: helm-mysql
      affinity: {}
      nodeSelector:
        mysql-deploy: "true"
      securityContext:
        fsGroup: 1001
      initContainers:
        - name: change-volume-permissions
          image: "172.32.12.34:8033/cmii/bitnami-shell:10-debian-10-r140"
          imagePullPolicy: "Always"
          command:
            - /bin/bash
            - -ec
            - |
              chown -R 1001:1001 /bitnami/mysql
          securityContext:
            runAsUser: 0
          volumeMounts:
            - name: mysql-data
              mountPath: /bitnami/mysql
      containers:
        - name: mysql
          image: "172.32.12.34:8033/cmii/mysql:8.0.26-debian-10-r0"
          imagePullPolicy: "IfNotPresent"
          securityContext:
            runAsUser: 1001
          env:
            - name: BITNAMI_DEBUG
              value: "false"
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: helm-mysql
                  key: mysql-root-password
            - name: MYSQL_DATABASE
              value: "cmii"
          ports:
            - name: mysql
              containerPort: 3306
          livenessProbe:
            failureThreshold: 5
            initialDelaySeconds: 120
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3
            exec:
              command:
                - /bin/bash
                - -ec
                - |
                  password_aux="${MYSQL_ROOT_PASSWORD:-}"
                  if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
                      password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
                  fi
                  mysqladmin status -uroot -p"${password_aux}"
          readinessProbe:
            failureThreshold: 5
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 3
            exec:
              command:
                - /bin/bash
                - -ec
                - |
                  password_aux="${MYSQL_ROOT_PASSWORD:-}"
                  if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
                      password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
                  fi
                  mysqladmin status -uroot -p"${password_aux}"
          startupProbe:
            failureThreshold: 60
            initialDelaySeconds: 120
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
            exec:
              command:
                - /bin/bash
                - -ec
                - |
                  password_aux="${MYSQL_ROOT_PASSWORD:-}"
                  if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
                      password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
                  fi
                  mysqladmin status -uroot -p"${password_aux}"
          resources: 
            limits: {}
            requests: {}
          volumeMounts:
            - name: mysql-data
              mountPath: /bitnami/mysql
            - name: custom-init-scripts
              mountPath: /docker-entrypoint-initdb.d
            - name: config
              mountPath: /opt/bitnami/mysql/conf/my.cnf
              subPath: my.cnf
      volumes:
        - name: config
          configMap:
            name: helm-mysql
        - name: custom-init-scripts
          configMap:
            name: helm-mysql-init-scripts
        - name: mysql-data
          hostPath:
            path: /var/lib/docker/mysql-pv

