mirror of https://github.com/k3s-io/k3s
Merge pull request #25583 from chrislovecnm/cassandra-image-bump
Automatic merge from submit-queue Cassandra examples updating images to v9 - this is a version bump for the C* image - I also increased the cpu to .5 because .1 is slow like warm death Who can actually run the build to get the container to the examples repo?pull/6/head
commit
e851d749e4
|
@ -80,7 +80,14 @@ computer.
|
|||
The pods use the [```gcr.io/google-samples/cassandra:v9```](image/Dockerfile)
|
||||
image from Google's [container registry](https://cloud.google.com/container-registry/docs/).
|
||||
The docker is based on `debian:jessie` and includes OpenJDK 8. This image
|
||||
includes a standard Cassandra installation from the Apache Debian repo.
|
||||
includes a standard Cassandra installation from the Apache Debian repo. Through the use
|
||||
of environment variables you are able to change values that are inserted into the `cassandra.yaml`.
|
||||
|
||||
| ENV VAR | DEFAULT VALUE |
|
||||
| ------------- |:-------------: |
|
||||
| CASSANDRA_CLUSTER_NAME | 'Test Cluster' |
|
||||
| CASSANDRA_NUM_TOKENS | 32 |
|
||||
| CASSANDRA_RPC_ADDRESS | 0.0.0.0 |
|
||||
|
||||
### Custom Seed Provider
|
||||
|
||||
|
@ -229,7 +236,7 @@ spec:
|
|||
- /run.sh
|
||||
resources:
|
||||
limits:
|
||||
cpu: 0.1
|
||||
cpu: 0.5
|
||||
env:
|
||||
- name: MAX_HEAP_SIZE
|
||||
value: 512M
|
||||
|
@ -239,13 +246,24 @@ spec:
|
|||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: gcr.io/google-samples/cassandra:v8
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
image: gcr.io/google-samples/cassandra:v9
|
||||
name: cassandra
|
||||
ports:
|
||||
- containerPort: 7000
|
||||
name: intra-node
|
||||
- containerPort: 7001
|
||||
name: tls-intra-node
|
||||
- containerPort: 7199
|
||||
name: jmx
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
- containerPort: 9160
|
||||
name: thrift
|
||||
# If you need it it is going away in C* 4.0
|
||||
#- containerPort: 9160
|
||||
# name: thrift
|
||||
volumeMounts:
|
||||
- mountPath: /cassandra_data
|
||||
name: data
|
||||
|
@ -286,7 +304,7 @@ You can list the new controller:
|
|||
|
||||
$ kubectl get rc -o wide
|
||||
NAME DESIRED CURRENT AGE CONTAINER(S) IMAGE(S) SELECTOR
|
||||
cassandra 2 2 11s cassandra gcr.io/google-samples/cassandra:v8 app=cassandra
|
||||
cassandra 2 2 11s cassandra gcr.io/google-samples/cassandra:v9 app=cassandra
|
||||
|
||||
```
|
||||
|
||||
|
@ -457,16 +475,27 @@ spec:
|
|||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: gcr.io/google-samples/cassandra:v8
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
image: gcr.io/google-samples/cassandra:v9
|
||||
name: cassandra
|
||||
ports:
|
||||
- containerPort: 7000
|
||||
name: intra-node
|
||||
- containerPort: 7001
|
||||
name: tls-intra-node
|
||||
- containerPort: 7199
|
||||
name: jmx
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
- containerPort: 9160
|
||||
name: thrift
|
||||
# If you need it it is going away in C* 4.0
|
||||
#- containerPort: 9160
|
||||
# name: thrift
|
||||
resources:
|
||||
request:
|
||||
cpu: 0.1
|
||||
cpu: 0.5
|
||||
volumeMounts:
|
||||
- mountPath: /cassandra_data
|
||||
name: data
|
||||
|
|
|
@ -22,7 +22,7 @@ spec:
|
|||
- /run.sh
|
||||
resources:
|
||||
limits:
|
||||
cpu: 0.1
|
||||
cpu: 0.5
|
||||
env:
|
||||
- name: MAX_HEAP_SIZE
|
||||
value: 512M
|
||||
|
@ -32,13 +32,24 @@ spec:
|
|||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: gcr.io/google-samples/cassandra:v8
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
image: gcr.io/google-samples/cassandra:v9
|
||||
name: cassandra
|
||||
ports:
|
||||
- containerPort: 7000
|
||||
name: intra-node
|
||||
- containerPort: 7001
|
||||
name: tls-intra-node
|
||||
- containerPort: 7199
|
||||
name: jmx
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
- containerPort: 9160
|
||||
name: thrift
|
||||
# If you need it it is going away in C* 4.0
|
||||
#- containerPort: 9160
|
||||
# name: thrift
|
||||
volumeMounts:
|
||||
- mountPath: /cassandra_data
|
||||
name: data
|
||||
|
|
|
@ -25,16 +25,27 @@ spec:
|
|||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: gcr.io/google-samples/cassandra:v8
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
image: gcr.io/google-samples/cassandra:v9
|
||||
name: cassandra
|
||||
ports:
|
||||
- containerPort: 7000
|
||||
name: intra-node
|
||||
- containerPort: 7001
|
||||
name: tls-intra-node
|
||||
- containerPort: 7199
|
||||
name: jmx
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
- containerPort: 9160
|
||||
name: thrift
|
||||
# If you need it it is going away in C* 4.0
|
||||
#- containerPort: 9160
|
||||
# name: thrift
|
||||
resources:
|
||||
request:
|
||||
cpu: 0.1
|
||||
cpu: 0.5
|
||||
volumeMounts:
|
||||
- mountPath: /cassandra_data
|
||||
name: data
|
||||
|
|
|
@ -33,13 +33,20 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D && \
|
|||
rm -rf /usr/share/doc/ && \
|
||||
rm -rf /usr/share/doc-base/ && \
|
||||
rm -rf /usr/share/man/ && \
|
||||
rm -rf /tmp/*
|
||||
rm -rf /tmp/*
|
||||
|
||||
COPY cassandra.yaml /etc/cassandra/cassandra.yaml
|
||||
COPY logback.xml /etc/cassandra/logback.xml
|
||||
COPY kubernetes-cassandra.jar /kubernetes-cassandra.jar
|
||||
|
||||
VOLUME ["/cassandra_data/data"]
|
||||
VOLUME ["/cassandra_data/data"]
|
||||
|
||||
# 7000: intra-node communication
|
||||
# 7001: TLS intra-node communication
|
||||
# 7199: JMX
|
||||
# 9042: CQL
|
||||
# 9160: thrift service not included cause it is going away
|
||||
EXPOSE 7000 7001 7199 9042
|
||||
|
||||
USER cassandra
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ cluster_name: 'Test Cluster'
|
|||
#
|
||||
# If you already have a cluster with 1 token per node, and wish to migrate to
|
||||
# multiple tokens per node, see http://wiki.apache.org/cassandra/Operations
|
||||
num_tokens: 256
|
||||
num_tokens: 32
|
||||
|
||||
# initial_token allows you to specify tokens manually. While you can use # it with
|
||||
# vnodes (num_tokens > 1, above) -- in which case you should provide a
|
||||
|
@ -258,7 +258,7 @@ seed_provider:
|
|||
parameters:
|
||||
# seeds is actually a comma-delimited list of addresses.
|
||||
# Ex: "<ip1>,<ip2>,<ip3>"
|
||||
- seeds: "%%ip%%"
|
||||
- seeds: 127.0.0.1
|
||||
|
||||
# For workloads with more data than can fit in memory, Cassandra's
|
||||
# bottleneck will be reads that need to fetch data from
|
||||
|
@ -364,7 +364,7 @@ ssl_storage_port: 7001
|
|||
# address associated with the hostname (it might not be).
|
||||
#
|
||||
# Setting listen_address to 0.0.0.0 is always wrong.
|
||||
listen_address: %%ip%%
|
||||
listen_address: 127.0.0.1
|
||||
# listen_interface: eth0
|
||||
|
||||
# Address to broadcast to other Cassandra nodes
|
||||
|
@ -405,7 +405,7 @@ start_rpc: true
|
|||
#
|
||||
# Note that unlike listen_address, you can specify 0.0.0.0, but you must also
|
||||
# set broadcast_rpc_address to a value other than 0.0.0.0.
|
||||
rpc_address: %%ip%%
|
||||
rpc_address: 127.0.0.1
|
||||
# rpc_interface: eth1
|
||||
|
||||
# port for Thrift to listen for clients on
|
||||
|
@ -769,6 +769,6 @@ inter_dc_tcp_nodelay: false
|
|||
disk_access_mode: mmap
|
||||
row_cache_class_name: org.apache.cassandra.cache.OHCProvider
|
||||
|
||||
# Not till 3.5
|
||||
# Not till 3.5
|
||||
#enable_user_defined_functions: true
|
||||
#enable_scripted_user_defined_functions: tru
|
||||
|
|
Binary file not shown.
|
@ -14,6 +14,54 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
perl -pi -e "s/%%ip%%/$(hostname -I)/g" /etc/cassandra/cassandra.yaml
|
||||
set -e
|
||||
CFG=/etc/cassandra/cassandra.yaml
|
||||
CASSANDRA_RPC_ADDRESS="${CASSANDRA_RPC_ADDRESS:-0.0.0.0}"
|
||||
CASSANDRA_NUM_TOKENS="${CASSANDRA_NUM_TOKENS:-32}"
|
||||
CASSANDRA_CLUSTER_NAME="${CASSANDRA_CLUSTER_NAME:=Test Cluster}"
|
||||
CASSANDRA_LISTEN_ADDRESS=${POD_IP}
|
||||
CASSANDRA_BROADCAST_ADDRESS=${POD_IP}
|
||||
CASSANDRA_BROADCAST_RPC_ADDRESS=${POD_IP}
|
||||
|
||||
# TODO what else needs to be modified
|
||||
|
||||
for yaml in \
|
||||
broadcast_address \
|
||||
broadcast_rpc_address \
|
||||
cluster_name \
|
||||
listen_address \
|
||||
num_tokens \
|
||||
rpc_address \
|
||||
; do
|
||||
var="CASSANDRA_${yaml^^}"
|
||||
val="${!var}"
|
||||
if [ "$val" ]; then
|
||||
sed -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CFG"
|
||||
fi
|
||||
done
|
||||
|
||||
# Eventual do snitch $DC && $RACK?
|
||||
#if [[ $SNITCH ]]; then
|
||||
# sed -i -e "s/endpoint_snitch: SimpleSnitch/endpoint_snitch: $SNITCH/" $CONFIG/cassandra.yaml
|
||||
#fi
|
||||
#if [[ $DC && $RACK ]]; then
|
||||
# echo "dc=$DC" > $CONFIG/cassandra-rackdc.properties
|
||||
# echo "rack=$RACK" >> $CONFIG/cassandra-rackdc.properties
|
||||
#fi
|
||||
|
||||
#
|
||||
# see if this is needed
|
||||
#echo "JVM_OPTS=\"\$JVM_OPTS -Djava.rmi.server.hostname=$IP\"" >> $CASSANDRA_CONFIG/cassandra-env.sh
|
||||
#
|
||||
|
||||
# FIXME create README for these args
|
||||
echo "Starting Cassandra on $POD_IP"
|
||||
echo CASSANDRA_RPC_ADDRESS ${CASSANDRA_RPC_ADDRESS}
|
||||
echo CASSANDRA_NUM_TOKENS ${CASSANDRA_NUM_TOKENS}
|
||||
echo CASSANDRA_CLUSTER_NAME ${CASSANDRA_CLUSTER_NAME}
|
||||
echo CASSANDRA_LISTEN_ADDRESS ${POD_IP}
|
||||
echo CASSANDRA_BROADCAST_ADDRESS ${POD_IP}
|
||||
echo CASSANDRA_BROADCAST_RPC_ADDRESS ${POD_IP}
|
||||
|
||||
export CLASSPATH=/kubernetes-cassandra.jar
|
||||
cassandra -f
|
||||
|
|
|
@ -43,6 +43,7 @@ The following environment variables may be used to override the default configur
|
|||
| KUBERNETES_PORT_443_TCP_PORT | 443 | API port number |
|
||||
| CASSANDRA_SERVICE | cassandra | Default service name for lookup |
|
||||
| POD_NAMESPACE | default | Default pod service namespace |
|
||||
| K8S_ACCOUNT_TOKEN | /var/run/secrets/kubernetes.io/serviceaccount/token | Default path to service token |
|
||||
|
||||
# Using
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ import java.util.Map;
|
|||
* <li>CASSANDRA_SERVICE defaults to cassandra</li>
|
||||
* <li>POD_NAMESPACE defaults to 'default'</li>
|
||||
* <li>CASSANDRA_SERVICE_NUM_SEEDS defaults to 8 seeds</li>
|
||||
* <li>K8S_ACCOUNT_TOKEN defaults to the path for the default token</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class KubernetesSeedProvider implements SeedProvider {
|
||||
|
@ -107,10 +108,11 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||
String path = String.format("/api/v1/namespaces/%s/endpoints/", podNamespace);
|
||||
String seedSizeVar = getEnvOrDefault("CASSANDRA_SERVICE_NUM_SEEDS", "8");
|
||||
Integer seedSize = Integer.valueOf(seedSizeVar);
|
||||
String accountToken = getEnvOrDefault("K8S_ACCOUNT_TOKEN", "/var/run/secrets/kubernetes.io/serviceaccount/token");
|
||||
|
||||
List<InetAddress> seeds = new ArrayList<InetAddress>();
|
||||
try {
|
||||
String token = getServiceAccountToken();
|
||||
String token = getServiceAccountToken(accountToken);
|
||||
|
||||
SSLContext ctx = SSLContext.getInstance("SSL");
|
||||
ctx.init(null, trustAll, new SecureRandom());
|
||||
|
@ -222,13 +224,12 @@ public class KubernetesSeedProvider implements SeedProvider {
|
|||
return val;
|
||||
}
|
||||
|
||||
private static String getServiceAccountToken() throws IOException {
|
||||
String file = "/var/run/secrets/kubernetes.io/serviceaccount/token";
|
||||
private static String getServiceAccountToken(String file) {
|
||||
try {
|
||||
return new String(Files.readAllBytes(Paths.get(file)));
|
||||
} catch (IOException e) {
|
||||
logger.warn("unable to load service account token");
|
||||
throw e;
|
||||
logger.warn("unable to load service account token" + file);
|
||||
throw new RuntimeException("Unable to load services account token " + file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ docs/getting-started-guides/coreos/azure/lib/deployment_logic/kubernetes.js: re
|
|||
docs/getting-started-guides/coreos/azure/lib/deployment_logic/kubernetes.js: return cloud_config.process_template(input_file, output_file, function(data) {
|
||||
docs/getting-started-guides/coreos/azure/lib/deployment_logic/kubernetes.js: var write_files_extra = cloud_config.write_files_from('addons', '/etc/kubernetes/addons');
|
||||
docs/getting-started-guides/coreos/azure/lib/deployment_logic/kubernetes.js:var cloud_config = require('../cloud_config.js');
|
||||
examples/cassandra/image/run.sh: cluster_name \
|
||||
examples/cluster-dns/images/frontend/client.py: service_address = socket.gethostbyname(hostname)
|
||||
examples/vitess/env.sh: node_ip=$(get_node_ip)
|
||||
hack/local-up-cluster.sh: runtime_config="--runtime-config=${RUNTIME_CONFIG}"
|
||||
|
@ -86,6 +87,7 @@ test/e2e/es_cluster_logging.go: clusterName, ok := esResponse["cluster_name"]
|
|||
test/e2e/host_path.go: fmt.Sprintf("--file_content_in_loop=%v", filePath),
|
||||
test/e2e/host_path.go: fmt.Sprintf("--file_content_in_loop=%v", filePathInReader),
|
||||
test/e2e/host_path.go: fmt.Sprintf("--retry_time=%d", retryDuration),
|
||||
test/e2e/host_path.go: fmt.Sprintf("--retry_time=%d", retryDuration),
|
||||
test/images/mount-tester/mt.go: flag.BoolVar(&breakOnExpectedContent, "break_on_expected_content", true, "Break out of loop on expected content, (use with --file_content_in_loop flag only)")
|
||||
test/images/mount-tester/mt.go: flag.IntVar(&retryDuration, "retry_time", 180, "Retry time during the loop")
|
||||
test/images/mount-tester/mt.go: flag.StringVar(&readFileContentInLoopPath, "file_content_in_loop", "", "Path to read the file content in loop from")
|
||||
|
|
Loading…
Reference in New Issue