Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
only public workloads should be use NODE_PORT
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb committed Oct 9, 2023
1 parent 8cf8b0a commit 65c783b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/containers.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let hello = new containers.Workload(
image: "paulbouwer/hello-kubernetes:1",
port: 8080,
readiness: "/",
replicas: 4,
replicas: 3,
env: {
"MESSAGE" => message,
},
Expand Down
11 changes: 9 additions & 2 deletions tf-aws/workload.w
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,19 @@ class _Chart extends k8s.Chart {
}
);

let isPublic = props.public ?? false;
let var serviceType: cdk8s.ServiceType? = nil;

if isPublic {
serviceType = cdk8s.ServiceType.NODE_PORT;
}

let service = deployment.exposeViaService(
name: name,
serviceType: cdk8s.ServiceType.NODE_PORT,
serviceType: serviceType,
);

if (props.public ?? false) {
if isPublic {
new cdk8s.Ingress(
metadata: {
name: name,
Expand Down

0 comments on commit 65c783b

Please sign in to comment.