I have a multi-module maven project (Spring Boot), I generate the docker images in using the JIB Maven Plugin but how should I name the images in scaffold? Im pushing to local docker repo and Skaffold afaik does not support templating. What is the recommended was to reference these images in Skaffold?
Keep in mind that for separate images per module I need to name them as:
${image.registry.host}:${image.registry.port}/${project.artifact}
So no choice really but to parametrize them in the pom.
Do I now need to put in host and port names into the skaffold file? Whats the best way to handle this atm? And how about the name in Kubernetes deployment descriptor?
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
<configuration>
<!--If you want custom base image and push registry, use below configuration replace above-->
<from>
<image>openjdk:8-jdk-alpine</image>
</from>
<to>
**<image>${image.registry.host}:${image.registry.port}/${project.artifactId}**:${project.version}</image>
</to>
<container>
<jvmFlags>
<jvmFlag>-Djava.security.egd=file:/dev/./urandom</jvmFlag>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Duser.timezone=GMT+08</jvmFlag>
</jvmFlags>
<mainClass>com.example.jib.JibApplication</mainClass>
<ports>
<port>8080</port>
</ports>
</container>
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
</plugin>
What goes in the Scaffold.yml for image name?
apiVersion: skaffold/v1beta4
kind: Config
# Enforce SKaffold to use Jib
build:
local:
push: false
# Generated artifact
artifacts:
**- image: lvthillo/my-app. ??????????? HOW SHOULD I NAME THIS?
image: module2/ ???????**
# Use jibMaven
jibMaven: {}
# Execute deployment.yml
deploy:
kubectl:
manifests:
- kubernetes/deployment.yml
Here is Kubernetes deployment descriptor.
What name should image have here???
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-deployment
spec:
replicas: 1
selector:
matchLabels:
app: spring-boot-jib
template:
metadata:
labels:
app: spring-boot-jib
spec:
containers:
- name: spring-boot-jib-pod
**image: lvthillo/my-app. ????????? What name here???**
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
apiVersion: v1
kind: Service
metadata:
name: spring-boot-jib-service
spec:
type: NodePort
ports:
- protocol: TCP
port: 8080
nodePort: 32321
selector:
app: spring-boot-jib