-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nats-io/travis-config
Add Travis
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
sudo: required | ||
|
||
env: | ||
- KUBERNETES_CONFIG_FILE=$HOME/.kube/config CHANGE_MINIKUBE_NONE_USER=true | ||
|
||
before_script: | ||
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ | ||
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ | ||
- sudo minikube start --vm-driver=none --kubernetes-version=v1.10.0 --bootstrapper=localkube --feature-gates="TokenRequest=true,PodShareProcessNamespace=true" --extra-config=apiserver.service-account-signing-key-file=/var/lib/localkube/certs/apiserver.key --extra-config=apiserver.service-account-issuer=api --extra-config=apiserver.service-account-api-audiences=api --extra-config=apiserver.service-account-key-file=/var/lib/localkube/certs/sa.pub | ||
- minikube update-context | ||
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done | ||
|
||
script: | ||
- kubectl cluster-info | ||
- ./test/operator/deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# Wait once again for cluster to be ready | ||
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' | ||
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done | ||
|
||
# Bootstrap own user policy | ||
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:default | ||
|
||
# Confirm delete the CRD in case present right now | ||
kubectl get crd | grep natscluster && { | ||
kubectl delete crd natsclusters.nats.io | ||
} | ||
|
||
# Deploy the NATS cluster manifest with RBAC enabled | ||
kubectl -n nats-io apply -f https://raw.githubusercontent.com/nats-io/nats-operator/master/example/deployment-rbac.yaml | ||
|
||
# Wait until the CRD is ready | ||
attempts=0 | ||
until kubectl get crd natsclusters.nats.io -o yaml | grep InitialNamesAccepted; do | ||
if [[ attempts -eq 60 ]]; then | ||
echo "Gave up waiting for CRD to be ready..." | ||
kubectl -n nats-io logs deployment/nats-operator | ||
exit 1 | ||
fi | ||
((++attempts)) | ||
|
||
echo "Waiting for CRD... ($attempts attempts)" | ||
sleep 1 | ||
done | ||
|
||
# Deploy the NATS Streaming CRD with RBAC enabled | ||
kubectl apply -f deploy/deployment-rbac.yaml | ||
|
||
# Wait until the CRD is ready | ||
attempts=0 | ||
until kubectl get crd natsstreamingclusters.streaming.nats.io -o yaml | grep InitialNamesAccepted; do | ||
if [[ attempts -eq 60 ]]; then | ||
echo "Gave up waiting for CRD to be ready..." | ||
kubectl -n nats-io logs deployment/nats-streaming-operator | ||
exit 1 | ||
fi | ||
((++attempts)) | ||
|
||
echo "Waiting for CRD... ($attempts attempts)" | ||
sleep 1 | ||
done | ||
|
||
# Deploy an example manifest and wait for pods to appear | ||
kubectl -n nats-io apply -f deploy/examples/example-nats-cluster.yaml | ||
|
||
# Wait until 3 pods appear | ||
attempts=0 | ||
until kubectl -n nats-io get pods | grep -v operator | grep nats | grep Running | wc -l | grep 3; do | ||
if [[ attempts -eq 60 ]]; then | ||
echo "Gave up waiting for NatsCluster to be ready..." | ||
kubectl -n nats-io logs deployment/nats-operator | ||
kubectl -n nats-io logs -l nats_cluster=example-nats | ||
exit 1 | ||
fi | ||
|
||
echo "Waiting for pods to appear ($attempts attempts)..." | ||
((++attempts)) | ||
sleep 1 | ||
done | ||
|
||
# Show output to confirm. | ||
kubectl -n nats-io logs -l nats_cluster=example-nats | ||
|
||
# Next, deploy the NATS Streaming Cluster | ||
kubectl -n nats-io apply -f deploy/examples/example-stan-cluster.yaml | ||
|
||
# Wait until 3 pods appear | ||
attempts=0 | ||
until kubectl -n nats-io get pods | grep -v operator | grep stan | wc -l | grep 3; do | ||
if [[ attempts -eq 120 ]]; then | ||
echo "Gave up waiting for NatsStreamingCluster to be ready..." | ||
kubectl -n nats-io get pods | ||
kubectl -n nats-io logs deployment/nats-streaming-operator | ||
kubectl -n nats-io logs -l stan_cluster=example-stan | ||
exit 1 | ||
fi | ||
|
||
echo "Waiting for pods to appear ($attempts attempts)..." | ||
((++attempts)) | ||
sleep 1 | ||
done |