Wei-Yu Chen | 0f12b9c | 2019-04-18 11:12:59 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # Copyright 2018 Intel Corporation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | --- |
| 17 | apiVersion: v1 |
| 18 | kind: ConfigMap |
| 19 | metadata: |
| 20 | name: {{ .Values.hssdb.name }} |
| 21 | data: |
| 22 | cassandra-rackdc.properties: | |
| 23 | dc=DC1 |
| 24 | rack=RAC1 |
| 25 | prefer_local=true |
| 26 | --- |
| 27 | apiVersion: v1 |
| 28 | kind: Service |
| 29 | metadata: |
| 30 | labels: |
| 31 | app: {{ .Values.hssdb.name }} |
| 32 | name: {{ .Values.hssdb.name }} |
| 33 | spec: |
| 34 | clusterIP: None |
| 35 | ports: |
| 36 | - name: cql |
| 37 | port: 9042 |
| 38 | selector: |
| 39 | app: {{ .Values.hssdb.name }} |
| 40 | --- |
| 41 | apiVersion: "apps/v1" |
| 42 | kind: StatefulSet |
| 43 | metadata: |
| 44 | name: {{ .Values.hssdb.name }} |
| 45 | labels: |
| 46 | app: {{ .Values.hssdb.name }} |
| 47 | spec: |
| 48 | serviceName: {{ .Values.hssdb.name }} |
| 49 | replicas: 1 # 3 |
| 50 | selector: |
| 51 | matchLabels: |
| 52 | app: {{ .Values.hssdb.name }} |
| 53 | template: |
| 54 | metadata: |
| 55 | labels: |
| 56 | app: {{ .Values.hssdb.name }} |
| 57 | spec: |
| 58 | securityContext: |
| 59 | runAsUser: 999 |
| 60 | fsGroup: 999 |
| 61 | containers: |
| 62 | - name: cassandra |
| 63 | image: {{ .Values.hssdb.image }} |
| 64 | imagePullPolicy: {{ .Values.global.imagepullpolicy }} |
| 65 | ports: |
| 66 | - containerPort: 9042 |
| 67 | name: cql |
| 68 | resources: |
| 69 | limits: |
| 70 | cpu: {{ .Values.hssdb.cpu | quote }} |
| 71 | memory: {{ .Values.hssdb.memory }} |
| 72 | env: |
| 73 | - name: MAX_HEAP_SIZE |
| 74 | value: 512M |
| 75 | - name: HEAP_NEWSIZE |
| 76 | value: 100M |
| 77 | - name: CASSANDRA_SEEDS |
| 78 | value: "hssdb-0.{{ .Values.hssdb.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}" |
| 79 | - name: CASSANDRA_CLUSTER_NAME |
| 80 | value: "HSS Cluster" |
| 81 | - name: CASSANDRA_RPC_ADDRESS |
| 82 | valueFrom: |
| 83 | fieldRef: |
| 84 | fieldPath: status.podIP |
| 85 | - name: CASSANDRA_ENDPOINT_SNITCH |
| 86 | value: "GossipingPropertyFileSnitch" |
| 87 | readinessProbe: |
| 88 | exec: |
| 89 | command: ["/bin/bash", "-c", "nodetool status -r | awk -v h=$(hostname) '$2==h {exit ($1==\"UN\" ? 0 : -1)}'"] |
| 90 | initialDelaySeconds: 15 |
| 91 | timeoutSeconds: 5 |
| 92 | volumeMounts: |
| 93 | - name: hssdb-config |
| 94 | mountPath: /etc/cassandra/cassandra-rackdc.properties |
| 95 | subPath: cassandra-rackdc.properties |
| 96 | #- name: hssdb-data |
| 97 | # mountPath: /var/lib/cassandra |
| 98 | volumes: |
| 99 | - name: hssdb-config |
| 100 | configMap: |
| 101 | name: {{ .Values.hssdb.name }} |
| 102 | # volumeClaimTemplates: |
| 103 | # - metadata: |
| 104 | # name: hssdb-data |
| 105 | # spec: |
| 106 | # accessModes: [ "ReadWriteOnce" ] |
| 107 | # resources: |
| 108 | # requests: |
| 109 | # storage: 1Gi |