forked from spring-cloud-services-samples/animal-rescue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use skaffold to deploy the animal-rescue app and SCG object to k8s (s…
- Loading branch information
1 parent
e343c7d
commit c232519
Showing
13 changed files
with
204 additions
and
4 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
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
23 changes: 23 additions & 0 deletions
23
...in/java/io/spring/cloud/samples/animalrescue/backend/KubernetesSecurityConfiguration.java
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,23 @@ | ||
package io.spring.cloud.samples.animalrescue.backend; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.security.config.web.server.ServerHttpSecurity; | ||
import org.springframework.security.web.server.SecurityWebFilterChain; | ||
|
||
@Configuration | ||
@Profile("k8s") | ||
public class KubernetesSecurityConfiguration { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(KubernetesSecurityConfiguration.class); | ||
|
||
@Bean | ||
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity httpSecurity) { | ||
return httpSecurity.httpBasic().disable().build(); | ||
} | ||
|
||
} |
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 @@ | ||
node_modules |
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,2 @@ | ||
FROM nginx:1.17 | ||
COPY build /usr/share/nginx/html |
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,51 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: animal-rescue-backend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: animal-rescue-backend | ||
template: | ||
metadata: | ||
labels: | ||
app: animal-rescue-backend | ||
spec: | ||
containers: | ||
- name: animal-rescue-backend | ||
image: springcloudservices/animal-rescue-backend | ||
env: | ||
- name: spring.profiles.active | ||
value: k8s | ||
resources: | ||
requests: | ||
memory: "256Mi" | ||
cpu: "100m" | ||
limits: | ||
memory: "512Mi" | ||
cpu: "500m" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: animal-rescue-backend | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
selector: | ||
app: animal-rescue-backend | ||
|
||
--- | ||
apiVersion: "tanzu.vmware.com/v1" | ||
kind: SpringCloudGatewayBinding | ||
metadata: | ||
name: animal-rescue-backend-routes | ||
spec: | ||
gateway: animal-rescue-gateway-with-dynamic-routes | ||
service: animal-rescue-backend | ||
routes: | ||
- predicates: | ||
- Path=/api/** | ||
filters: | ||
- StripPrefix=1 |
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,44 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: animal-rescue-frontend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: animal-rescue-frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: animal-rescue-frontend | ||
spec: | ||
containers: | ||
- name: animal-rescue-frontend | ||
image: springcloudservices/animal-rescue-frontend | ||
ports: | ||
- containerPort: 80 | ||
restartPolicy: Always | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: animal-rescue-frontend | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
selector: | ||
app: animal-rescue-frontend | ||
|
||
--- | ||
apiVersion: "tanzu.vmware.com/v1" | ||
kind: SpringCloudGatewayBinding | ||
metadata: | ||
name: animal-rescue-frontend-routes | ||
spec: | ||
gateway: animal-rescue-gateway-with-dynamic-routes | ||
service: animal-rescue-frontend | ||
routes: | ||
- predicates: | ||
- Path=/rescue/** | ||
filters: | ||
- StripPrefix=1 |
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,5 @@ | ||
apiVersion: "tanzu.vmware.com/v1" | ||
kind: SpringCloudGateway | ||
metadata: | ||
name: animal-rescue-gateway-with-dynamic-routes | ||
spec: {} |
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,18 @@ | ||
apiVersion: "tanzu.vmware.com/v1" | ||
kind: SpringCloudGateway | ||
metadata: | ||
name: animal-rescue-gateway | ||
spec: | ||
routes: | ||
- id: animal-rescue-frontend | ||
uri: http://animal-rescue-frontend.animal-rescue.svc.cluster.local | ||
predicates: | ||
- Path=/rescue/** | ||
filters: | ||
- StripPrefix=1 | ||
- id: animal-rescue-backend | ||
uri: http://animal-rescue-backend.animal-rescue.svc.cluster.local | ||
predicates: | ||
- Path=/api/** | ||
filters: | ||
- StripPrefix=1 |
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,10 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: animal-rescue | ||
|
||
resources: | ||
- namespace.yaml | ||
- animal-rescue-frontend.yaml | ||
- animal-rescue-backend.yaml | ||
- animal-rescue-gateway.yaml | ||
- animal-rescue-gateway-with-dynamic-routes.yaml |
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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: animal-rescue |
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,22 @@ | ||
apiVersion: skaffold/v2beta6 | ||
kind: Config | ||
build: | ||
tagPolicy: | ||
sha256: {} | ||
artifacts: | ||
- image: springcloudservices/animal-rescue-backend | ||
context: backend | ||
buildpacks: | ||
builder: gcr.io/paketo-buildpacks/builder:base-platform-api-latest | ||
dependencies: | ||
paths: | ||
- src/main/** | ||
- build.gradle | ||
- settings.gradle | ||
- image: springcloudservices/animal-rescue-frontend | ||
context: frontend | ||
|
||
deploy: | ||
kustomize: | ||
paths: | ||
- k8s |