Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#299 kube deployment #311

Merged
merged 5 commits into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import com.networknt.oas.OpenApiParser;
import com.networknt.oas.model.*;
import com.networknt.oas.model.impl.OpenApi3Impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.lang.model.SourceVersion;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -24,21 +27,8 @@
import java.util.Map.Entry;
import java.util.stream.Collectors;

import com.networknt.oas.model.Example;
import com.networknt.oas.model.MediaType;
import com.networknt.oas.model.OpenApi3;
import com.networknt.oas.model.Operation;
import com.networknt.oas.model.Parameter;
import com.networknt.oas.model.Path;
import com.networknt.oas.model.Response;
import com.networknt.oas.model.Schema;
import com.networknt.oas.model.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.io.File.separator;

import javax.lang.model.SourceVersion;

/**
* The input for OpenAPI 3.0 generator include config with json format and OpenAPI specification in yaml format.
*
Expand Down Expand Up @@ -155,6 +145,7 @@ public void generate(final String targetPath, Object model, Any config) throws I
transfer(targetPath, "docker", "Dockerfile", templates.rest.dockerfile.template(config, expose));
transfer(targetPath, "docker", "Dockerfile-Redhat", templates.rest.dockerfileredhat.template(config, expose));
transfer(targetPath, "", "build.sh", templates.rest.buildSh.template(dockerOrganization, serviceId));
transfer(targetPath, "", "kubernetes.yml", templates.rest.kubernetes.template(dockerOrganization, serviceId, config.get("artifactId").toString().trim(), expose, version));
transfer(targetPath, "", ".gitignore", templates.rest.gitignore.template());
transfer(targetPath, "", "README.md", templates.rest.README.template());
transfer(targetPath, "", "LICENSE", templates.rest.LICENSE.template());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@args (String org, String serviceId, String artifact, String expose, String version)
#change the image tag before you deploy, if using minikube, please use any tag other than "latest"
apiVersion: apps/v1
kind: Deployment
metadata:
name: @artifact-deployment
labels:
app: @artifact
spec:
replicas: 1
selector:
matchLabels:
app: @artifact
template:
metadata:
labels:
app: @artifact
spec:
containers:
- name: @artifact
image: @org/@serviceId:@version
---
apiVersion: v1
kind: Service
metadata:
name: @artifact-service
labels:
app: @artifact
spec:
selector:
app: @artifact
type: NodePort
ports:
- protocol: TCP
port: @expose