Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cassandra example: daemonset volume fix, readme cleanup, update to new gcr image #21645

Merged
merged 1 commit into from
Mar 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
184 changes: 146 additions & 38 deletions examples/cassandra/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/cassandra/cassandra-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: gcr.io/google_containers/cassandra:v6
image: gcr.io/google-samples/cassandra:v8
name: cassandra
ports:
- containerPort: 9042
Expand Down
7 changes: 3 additions & 4 deletions examples/cassandra/cassandra-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
template:
metadata:
labels:
name: cassandra
app: cassandra
spec:
# Filter to specific nodes:
# nodeSelector:
Expand All @@ -25,7 +25,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: "gcr.io/google_containers/cassandra:v6"
image: gcr.io/google-samples/cassandra:v8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Label key needs to be changed to app, above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

name: cassandra
ports:
- containerPort: 9042
Expand All @@ -40,5 +40,4 @@ spec:
name: data
volumes:
- name: data
hostPath:
path: /var/lib/cassandra
emptyDir: {}
2 changes: 1 addition & 1 deletion examples/cassandra/cassandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
resources:
limits:
cpu: "0.1"
image: gcr.io/google_containers/cassandra:v6
image: gcr.io/google-samples/cassandra:v8
name: cassandra
ports:
- name: cql
Expand Down
6 changes: 3 additions & 3 deletions examples/cassandra/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# build the cassandra image.

VERSION=v7
VERSION=v8

all: build

Expand All @@ -24,9 +24,9 @@ kubernetes-cassandra.jar: ../java/* ../java/src/io/k8s/cassandra/*.java
cd ../java && mvn clean

build: kubernetes-cassandra.jar
docker build -t gcr.io/google_containers/cassandra:${VERSION} .
docker build -t gcr.io/google_samples/cassandra:${VERSION} .

push: build
gcloud docker push gcr.io/google_containers/cassandra:${VERSION}
gcloud docker push gcr.io/google_samples/cassandra:${VERSION}

.PHONY: all build push
Binary file modified examples/cassandra/image/kubernetes-cassandra.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package io.k8s.cassandra;

import java.io.IOException;
Expand Down Expand Up @@ -32,22 +48,22 @@
import org.slf4j.LoggerFactory;

public class KubernetesSeedProvider implements SeedProvider {

@JsonIgnoreProperties(ignoreUnknown = true)
static class Address {
public String ip;
}

@JsonIgnoreProperties(ignoreUnknown = true)
static class Subset {
public List<Address> addresses;
public List<Address> addresses;
}

@JsonIgnoreProperties(ignoreUnknown = true)
static class Endpoints {
public List<Subset> subsets;
}

private static String getEnvOrDefault(String var, String def) {
String val = System.getenv(var);
if (val == null) {
Expand Down Expand Up @@ -141,7 +157,7 @@ public List<InetAddress> getSeeds() {
logger.warn("Endpoints are not available");
}
} catch (IOException | NoSuchAlgorithmException | KeyManagementException ex) {
logger.warn("Request to kubernetes apiserver failed", ex);
logger.warn("Request to kubernetes apiserver failed", ex);
}
if (list.size() == 0) {
// If we got nothing, we might be the first instance, in that case
Expand Down