Skip to content

Commit

Permalink
Use redis package instead of various multiple packages
Browse files Browse the repository at this point in the history
  • Loading branch information
krnowak authored and Lorenzo Manacorda committed Jan 31, 2018
1 parent 2806bc6 commit fa18258
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions examples/bind-config/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Runtime binding + initial configuration

This demonstrates how to run two Habitat Services with a [binding](https://www.habitat.sh/docs/run-packages-binding/) between them, with initial configuration used to override the port of the PostgreSQL Habitat service. It also displays how different fields in the manifest file can be combined.
This demonstrates how to run two Habitat Services with a [binding](https://www.habitat.sh/docs/run-packages-binding/) between them, with initial configuration used to override the port of the redis Habitat service. It also displays how different fields in the manifest file can be combined.

## Workflow

Expand All @@ -10,6 +10,6 @@ After the Habitat operator is up and running, execute the following command from
kubectl create -f examples/bind-config/habitat.yml
```

This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a PostgreSQL database. The Go server will display the database port number that was overriden by the initial configuration.
This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a Redis database. The Go server will display the database port number that was overriden by the initial configuration.

When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP.
7 changes: 3 additions & 4 deletions examples/bind-config/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ type: Opaque
data:
# Each item needs to be encoded in base64, as Kubernetes expects that encoding.
# Plain text content of the secret: "port = 4444"
# This overrides the port set in the postgresql Habitat service.
# This overrides the port set in the Redis Habitat service.
user.toml: cG9ydCA9IDQ0NDQ=
---
apiVersion: habitat.sh/v1beta1
kind: Habitat
metadata:
name: example-bind-configured-db-service
spec:
image: kinvolk/postgresql-hab
image: kinvolk/redis-hab
count: 1
service:
name: postgresql
name: redis
# Name of the secret.
# This is mounted inside of the pod as a user.toml file.
configSecretName: user-toml-secret
Expand Down
2 changes: 1 addition & 1 deletion examples/bind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ After the Habitat operator is up and running, execute the following command from
kubectl create -f examples/bind/habitat.yml
```

This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a PostgreSQL database. The Go server will display the port number the database listens on.
This will deploy two `Habitat`s, a simple HTTP server written in Go that will be bound to a Redis database. The Go server will display the port number the database listens on.

When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP.
8 changes: 4 additions & 4 deletions examples/bind/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ kind: Habitat
metadata:
name: db
spec:
image: kinvolk/postgresql-hab
image: kinvolk/redis-hab
count: 1
service:
name: postgresql
name: redis
topology: standalone
---
apiVersion: habitat.sh/v1beta1
Expand All @@ -23,7 +23,7 @@ spec:
# Name is the name of the bind specified in the Habitat configuration files.
- name: db
# Service is the name of the service this bind refers to.
service: postgresql
service: redis
# Group is the group of the service this bind refers to.
group: default
---
Expand All @@ -33,7 +33,7 @@ metadata:
name: go-service
spec:
selector:
habitat-name: go
habitat-name: web-app
type: NodePort
ports:
- name: web
Expand Down
6 changes: 3 additions & 3 deletions examples/config/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Initial configuration

This example demostrates how initial configuration works with the Habitat operator. With the manifest file we deploy a `"Hello world."` Node.js Habitat service.
This example demostrates how initial configuration works with the Habitat operator. With the manifest file we deploy a Redis Habitat service.
NOTE: Adding secret configuration to the `default.toml` is discouraged, as it will be uploaded as a docker image. Instead use the initial configuration `user.toml` file.

## Workflow
Expand All @@ -9,8 +9,8 @@ After the Habitat operator is up and running, execute the following command from

`kubectl create -f examples/config/habitat.yml`

This will create a [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the configurations and a simple Node.js application that will display a msg. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP.
Initially our app is configured to display the msg `"Hello world."`. Because we override this with the Secret we just created, our app will instead display `Hello from our Habitat-Operator!`.
This will create a [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the configurations and a Redis database. When running on minikube, it can be accessed under port `30001` of the minikube VM. `minikube ip` can be used to retrieve the IP.
Initially the Redis database is configured to be in protected mode. Because we override this with the Secret we just created, our db will not be in this mode anymore.

## Deletion

Expand Down
15 changes: 8 additions & 7 deletions examples/config/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ type: Opaque
data:
# Each item needs to be encoded in base64, as Kubernetes
# expects that encoding.
# Plain text content: "message = 'Hello from our Habitat-Operator!'"
user.toml: bWVzc2FnZSA9ICdIZWxsbyBmcm9tIG91ciBIYWJpdGF0LU9wZXJhdG9yISc=
# Plain text content: protected-mode = "no"
user.toml: cHJvdGVjdGVkLW1vZGUgPSAibm8i
---
apiVersion: habitat.sh/v1beta1
kind: Habitat
metadata:
name: example-configured-habitat
spec:
image: kinvolk/nodejs-hab
image: kinvolk/redis-hab
count: 1
service:
name: mytutorialapp
name: db
topology: standalone
group: nodejs
group: redisdb
# Create Secret with the initial configuration you want.
configSecretName: user-toml-secret
---
apiVersion: v1
kind: Service
metadata:
name: mytutorialapp
name: db
spec:
selector:
habitat-name: example-configured-habitat
Expand All @@ -35,7 +35,8 @@ spec:
# This endpoint displays the message from the secret
- name: web
nodePort: 30001
port: 5555
# This is the default port as set in default.toml
port: 6379
protocol: TCP
# This endpoint exposes the Habitat supervisor API
- name: http-gateway
Expand Down
6 changes: 3 additions & 3 deletions examples/encrypted/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ kind: Habitat
metadata:
name: example-encrypted-habitat
spec:
# the core/nginx habitat service packaged as a Docker image
image: kinvolk/consul-hab
# the core/redis habitat service packaged as a Docker image
image: kinvolk/redis-hab
count: 3
service:
name: consul
name: redis
topology: leader
# the name of the secret containing the ring key
ringSecretName: example-encrypted-ring-20170829113029
2 changes: 1 addition & 1 deletion examples/leader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Simply run:

`kubectl create -f examples/leader/habitat.yml`.

This will deploy 3 instances of consul Habitat service.
This will deploy 3 instances of Redis Habitat service.

Note: Whenever creating a `leader` topology specify instance `count` of 3 or more and would be best if the number is odd, this is so the election can take place.
4 changes: 2 additions & 2 deletions examples/leader/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ kind: Habitat
metadata:
name: example-leader-follower-habitat
spec:
# the core/consul habitat service packaged as a Docker image
image: kinvolk/consul-hab
# the core/redis habitat service packaged as a Docker image
image: kinvolk/redis-hab
# count must be at least 3 for a leader-follower topology
count: 3
service:
Expand Down
6 changes: 3 additions & 3 deletions examples/namespaced/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ metadata:
name: example-namespaced-habitat
namespace: example-namespace
spec:
# the core/nginx habitat service packaged as a Docker image
image: kinvolk/nginx-hab
# the core/redis habitat service packaged as a Docker image
image: kinvolk/redis-hab
count: 1
service:
name: nginx
name: redis
topology: standalone
# if not present, defaults to "default"
group: foobar
2 changes: 1 addition & 1 deletion examples/standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Simply run:

`kubectl create -f examples/standalone/habitat.yml`.

This will deploy an instance of an nginx Habitat service.
This will deploy an instance of a redis Habitat service.
6 changes: 3 additions & 3 deletions examples/standalone/habitat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ kind: Habitat
metadata:
name: example-standalone-habitat
spec:
# the core/nginx habitat service packaged as a Docker image
image: kinvolk/nginx-hab
# the core/redis habitat service packaged as a Docker image
image: kinvolk/redis-hab
count: 1
service:
name: nginx
name: redis
topology: standalone
# if not present, defaults to "default"
group: foobar

0 comments on commit fa18258

Please sign in to comment.