Skip to content

Commit

Permalink
petclinic -> spring-petclinic
Browse files Browse the repository at this point in the history
  • Loading branch information
scothis committed Aug 3, 2020
1 parent 3a0f5ad commit 34dde5d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ko apply --strict -f config

Samples are located in the [samples directory](./samples), including:

- [Spring PetClinic with MySQL](./samples/petclinic)
- [Spring PetClinic with MySQL](./samples/spring-petclinic)
- [Custom Projection](./samples/custom-projection)
- [Controlled Resource](./samples/controlled-resource)
- [Environment Variables and Mappings](./samples/environment-variable-mappings)
Expand Down
2 changes: 1 addition & 1 deletion samples/environment-variable-mappings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ kubectl delete -f ./samples/environment-variable-mappings/
kubectl apply -f ./samples/environment-variable-mappings/
```

The application logs will not contain the `GAME_SERVER` variable:
The application logs will no longer contain the `GAME_SERVER` variable:

```sh
kubectl logs -l job-name=mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ If not already installed, [install the ServiceBinding CRD and controller][instal
Apply the PetClinic application, MySQL service and connect them with a ServiceBinding:

```sh
kubectl apply -f ./samples/petclinic
kubectl apply -f ./samples/spring-petclinic
```

Wait for the application (and database) to start and become healthy:

```sh
kubectl wait deployment petclinic --for condition=available --timeout=2m
kubectl wait deployment spring-petclinic --for condition=available --timeout=2m
```

## Understand

Inspect the PetClinic application as bound:

```sh
kubectl describe deployment petclinic
kubectl describe deployment spring-petclinic
```

If the ServiceBinding is working, a new environment variable (SERVICE_BINDINGS_ROOT), volume and volume mount (petclinic-db-projection-binding) is added to the deployment.
If the ServiceBinding is working, a new environment variable (SERVICE_BINDINGS_ROOT), volume and volume mount (binding-49a23274b0590d5057aae1ae621be723716c4dd5) is added to the deployment.
The describe output will contain:

```txt
Expand All @@ -42,11 +42,11 @@ The describe output will contain:
SPRING_PROFILES_ACTIVE: mysql
SERVICE_BINDINGS_ROOT: /bindings
Mounts:
/bindings/petclinic-db from petclinic-db-projection-binding (ro)
/bindings/spring-petclinic-db from binding-49a23274b0590d5057aae1ae621be723716c4dd5 (ro)
Volumes:
petclinic-db-projection-binding:
binding-49a23274b0590d5057aae1ae621be723716c4dd5:
Type: Secret (a volume populated by a Secret)
SecretName: petclinic-db-projection
SecretName: spring-petclinic-db-projection
Optional: false
...
```
Expand All @@ -57,7 +57,7 @@ Spring Cloud Bindings is automatically added to Spring applications built by Pak
We can see the effect of Spring Cloud Bindings by view the application logs:

```sh
kubectl logs -l app=petclinic -c application --tail 1000
kubectl logs -l app=spring-petclinic -c application --tail 1000
```

The logs should contain:
Expand Down Expand Up @@ -92,7 +92,7 @@ Spring Cloud Bindings Boot Auto-Configuration Enabled
To connect to the application, forward a local port into the cluster:

```sh
kubectl port-forward service/petclinic 8080:80
kubectl port-forward service/spring-petclinic 8080:80
```

Then open `http://localhost:8080` in a browser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
apiVersion: v1
kind: Service
metadata:
name: petclinic
name: spring-petclinic
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: petclinic
app: spring-petclinic

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: petclinic
name: spring-petclinic
labels:
app: petclinic
app: spring-petclinic
spec:
replicas: 1
selector:
matchLabels:
app: petclinic
app: spring-petclinic
template:
metadata:
labels:
app: petclinic
app: spring-petclinic
spec:
containers:
- name: application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
apiVersion: service.binding/v1alpha2
kind: ServiceBinding
metadata:
name: petclinic-db
name: spring-petclinic-db
spec:
application:
apiVersion: apps/v1
kind: Deployment
name: petclinic
name: spring-petclinic
service:
apiVersion: bindings.labs.vmware.com/v1alpha1
kind: ProvisionedService
name: petclinic-db
name: spring-petclinic-db
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
apiVersion: bindings.labs.vmware.com/v1alpha1
kind: ProvisionedService
metadata:
name: petclinic-db
name: spring-petclinic-db
spec:
binding:
name: petclinic-db
name: spring-petclinic-db

---
apiVersion: v1
kind: Secret
metadata:
name: petclinic-db
name: spring-petclinic-db
type: Opaque
stringData:
type: mysql
Expand Down Expand Up @@ -60,17 +60,17 @@ spec:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: petclinic-db
name: spring-petclinic-db
key: username
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: petclinic-db
name: spring-petclinic-db
key: password
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: petclinic-db
name: spring-petclinic-db
key: database
- name: MYSQL_ROOT_PASSWORD
value: root
Expand Down

0 comments on commit 34dde5d

Please sign in to comment.