Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 1 | --- |
Wei-Yu Chen | 53aec36 | 2019-01-18 16:30:33 -0800 | [diff] [blame] | 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # Copyright 2018 Intel Corporation |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 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 | --- |
| 18 | apiVersion: v1 |
| 19 | kind: Service |
| 20 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 21 | labels: |
| 22 | app: cassandra |
| 23 | name: cassandra |
| 24 | spec: |
| 25 | clusterIP: None |
| 26 | ports: |
| 27 | - port: 9042 |
| 28 | selector: |
| 29 | app: cassandra |
| 30 | --- |
| 31 | apiVersion: "apps/v1" |
| 32 | kind: StatefulSet |
| 33 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 34 | name: cassandra |
| 35 | labels: |
| 36 | app: cassandra |
| 37 | spec: |
| 38 | serviceName: cassandra |
| 39 | replicas: 1 # 3 |
| 40 | selector: |
| 41 | matchLabels: |
| 42 | app: cassandra |
| 43 | template: |
| 44 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 45 | labels: |
| 46 | app: cassandra |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 47 | spec: |
| 48 | nodeSelector: |
Wei-Yu Chen | 9f533ef | 2019-02-18 11:39:17 -0800 | [diff] [blame] | 49 | kubernetes.io/hostname: "{{ .Values.hssdb_node_selector }}" |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 50 | terminationGracePeriodSeconds: 1 |
| 51 | containers: |
| 52 | - name: cassandra |
Wei-Yu Chen | b4ae01e | 2019-02-11 13:11:44 -0800 | [diff] [blame] | 53 | image: {{ .Values.hss.images.init }} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 54 | imagePullPolicy: Always |
| 55 | resources: |
| 56 | limits: |
| 57 | cpu: "3" |
| 58 | memory: 4Gi |
| 59 | env: |
| 60 | - name: MAX_HEAP_SIZE |
| 61 | value: 512M |
| 62 | - name: HEAP_NEWSIZE |
| 63 | value: 100M |
| 64 | - name: CASSANDRA_SEEDS |
Wei-Yu Chen | da76c32 | 2019-01-18 13:31:55 -0800 | [diff] [blame] | 65 | value: "{{ .Values.hssdb_hostname }}-0" |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 66 | - name: CASSANDRA_CLUSTER_NAME |
| 67 | value: "HSS Cluster" |
| 68 | - name: CASSANDRA_RPC_ADDRESS |
| 69 | valueFrom: |
| 70 | fieldRef: |
| 71 | fieldPath: status.podIP |
| 72 | - name: CASSANDRA_ENDPOINT_SNITCH |
| 73 | value: "GossipingPropertyFileSnitch" |
| 74 | securityContext: |
| 75 | runAsUser: 1337 |
| 76 | readinessProbe: |
| 77 | exec: |
| 78 | command: ["/bin/bash", "-c", "nodetool status -r | awk -v h=$(hostname) '$2==h {exit ($1==\"UN\" ? 0 : -1)}'"] |
| 79 | initialDelaySeconds: 15 |
| 80 | timeoutSeconds: 5 |
| 81 | volumeMounts: |
| 82 | - name: cassandra-config |
| 83 | mountPath: /etc/cassandra/cassandra-rackdc.properties |
| 84 | subPath: cassandra-rackdc.properties |
| 85 | volumes: |
| 86 | - name: cassandra-config |
| 87 | configMap: |
| 88 | name: cassandra |