Comments (2)
Thanks for showing interest, basically this task involves moving _faq.adoc
file to jkube-kit/doc
so that both maven and gradle plugins could share documentation.
You'd also need to move maven specific blocks in ifeval::["{plugin-type}" == "maven"]
endif::[]
blocks and similarly for gradle docs.
Steps for doing your task
- In order to contribute to Eclipse, you would need to create an Eclipse Account and Sign Eclipse Contributor Agreement.
- Configure your Git Username
git config --global user.name "John Doe"
- Configure your Git email
git config --global user.email [email protected]
- Fork JKube repository on Github
- Clone JKube repository
[email protected]:eclipse/jkube.git
- Add git remote for your fork
git remote add Prafful-Rastogi [email protected]:Prafful-Rastogi/jkube.git
- Create new branch for this task
git checkout -b pr/issue2296
- Add a file named
_faq.adoc
injkube-kit/doc/src/main/asciidoc/inc
folder with the following content
[[faq]]
= FAQ
== General questions
=== How do I define an environment variable?
The easiest way is to add a `src/main/jkube/deployment.yml` file to your project containing something like:
[source, yaml]
----
spec:
template:
spec:
containers:
- env:
- name: FOO
value: bar
----
The above will generate an environment variable `$FOO` of value `bar`
For a full list of the environments used in java base images, https://hub.docker.com/r/jkube.java-jboss-openjdk8-jdk[see this list]
=== How do I define a system property?
The simplest way is to add system properties to the `JAVA_OPTIONS` environment variable.
For a full list of the environments used in java base images, https://hub.docker.com/r/jkube.java-jboss-openjdk8-jdk[see this list]
e.g. add a `src/main/jkube/deployment.yml` file to your project containing something like:
[source, yaml]
----
spec:
template:
spec:
containers:
- env:
- name: JAVA_OPTIONS
value: "-Dfoo=bar -Dxyz=abc"
----
The above will define the system properties `foo=bar` and `xyz=abc`
=== How do I mount a config file from a ConfigMap?
First you need to create your `ConfigMap` resource via a file `src/main/jkube/configmap.yml`
[source, yaml]
----
data:
application.properties: |
# spring application properties file
welcome = Hello from Kubernetes ConfigMap!!!
dummy = some value
----
Then mount the entry in the `ConfigMap` into your `Deployment` via a file `src/main/jkube/deployment.yml`
[source, yaml]
----
metadata:
annotations:
configmap.jkube.io/update-on-change: ${project.artifactId}
spec:
replicas: 1
template:
spec:
volumes:
- name: config
configMap:
name: ${project.artifactId}
items:
- key: application.properties
path: application.properties
containers:
- volumeMounts:
- name: config
mountPath: /deployments/config
----
Here is https://github.com/eclipse/jkube/tree/master/quickstarts/maven/external-resources[an example quickstart doing this]
Note that the annotation `configmap.jkube.io/update-on-change` is optional; its used if your application is not capable
of watching for changes in the `/deployments/config/application.properties` file. In this case if you are also running
the https://github.com/fabric8io/configmapcontroller[configmapcontroller] then this will cause a rolling upgrade of your
application to use the new `ConfigMap` contents as you change it.
=== How do I use a Persistent Volume?
First you need to create your `PersistentVolumeClaim` resource via a file `src/main/jkube/foo-pvc.yml` where `foo` is the name of the `PersistentVolumeClaim`. It might be your app requires multiple vpersistent volumes so you will need multiple `PersistentVolumeClaim` resources.
[source, yaml]
----
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
----
Then to mount the `PersistentVolumeClaim` into your `Deployment` create a file `src/main/jkube/deployment.yml`
[source, yaml]
----
spec:
template:
spec:
volumes:
- name: foo
persistentVolumeClaim:
claimName: foo
containers:
- volumeMounts:
- mountPath: /whatnot
name: foo
----
Where the above defines the `PersistentVolumeClaim` called `foo` which is then mounted into the container at `/whatnot`
=== How do I generate Ingress for my generated Service?
`Ingress` generation is supported by Eclipse JKube for `Service` objects of type `LoadBalancer`. In order to generate
`Ingress` you need to enable `jkube.createExternalUrls` property to `true` and `jkube.domain` property to desired host
suffix, it would be appended to your service name for host value.
You can also provide a host for it in properties like this:
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
----
jkube.createExternalUrls=true
jkube.domain=example.com
----
ifeval::["{plugin-type}" == "maven"]
You can find an example in our link: https://github.com/eclipse/jkube/tree/master/quickstarts/maven/spring-boot[spring-boot]
quickstart in `kubernetes-with-ingress` profile.
endif::[]
=== How do I build the image with Podman instead of Docker?
ifeval::["{plugin-type}" == "maven"]
When invoking <<jkube:build>> with only Podman installed, the following error appears:
endif::[]
ifeval::["{plugin-type}" == "gradle"]
When invoking <<jkubeBuild>> with only Podman installed, the following error appears:
endif::[]
----
No <dockerHost> given, no DOCKER_HOST environment variable, no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine' and no external provider like Docker machine configured -> [Help 1]
----
By default, JKube is relying on the Docker REST API `/var/run/docker.sock` to build Docker images. Using Podman even with the Docker CLI emulation won't work as it is just a CLI wrapper and does not provide any Docker REST API.
However, it is possible to start an emulated Docker REST API with the podman command:
----
export DOCKER_HOST="unix:/run/user/$(id -u)/podman/podman.sock"
podman system service --time=0 unix:/run/user/$(id -u)/podman/podman.sock &
----
=== How to configure image name generated by Eclipse JKube?
If you want to configure image name generated by Eclipse JKube which is `%g/%a:%l` by default(see <<image-name>>). It will depend upon what mode you're using in Eclipse JKube:
- If you're using <<zero-config, zero configuration mode>>, which means you depend on Eclipse JKube <<generators>> to generate an opinionated image, you will be able to do it using `jkube.generator.name` maven property.
- If you're providing <<config-image, {plugin-configuration-type} image configuration>>, image name would be picked from `name` tag like in this example:
ifeval::["{plugin-type}" == "maven"]
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<image>
<name>myusername/myimagename:latest</name> <!-- Your image name -->
<build>
<from>openjdk:latest</from>
<cmd>java -jar maven/${project.artifactId}-${project.version}.jar</cmd>
</build>
</image>
----
endif::[]
ifeval::["{plugin-type}" == "gradle"]
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
----
{pluginExtension} {
images {
image {
name = "myusername/myimagename:latest"
build {
from = "openjdk:latest"
cmd {
exec = ["java", "-jar", "${project.name}-${project.version}.jar"]
}
}
}
}
}
----
endif::[]
- If you're using <<simple-dockerfile-build, Simple Dockerfile Mode>>, you can configure image name via `jkube.image.name` or `jkube.generator.name` flags
- Delete
kubernetes-maven-plugin/doc/src/main/asciidoc/inc/_faq.adoc
- Update
_faq.adoc
reference in maven plugin docskubernetes-maven-plugin/doc/src/main/asciidoc/index.adoc
to point to jkube-kit/doc
-include::inc/_faq.adoc[]
+include::{kitdoc-path}/inc/_faq.adoc[]
- Update
gradle-plugin/doc/src/main/asciidoc/index.adoc
and add an entry for FAQ:
+include::{kitdoc-path}/inc/_faq.adoc[]
- Add your changes to git index
git add jkube-kit/doc/ kubernetes-maven-plugin/
- Commit your changes
git commit --signoff -m "doc : FAQ now displayed in Gradle Plugin documentation (#2296)"
- Push your changes to your fork
git push Prafful-Rastogi pr/issue2296
- Create pull request from GitHub interface
Testing your changes
After making these changes, you'd need to generate documentation locally and check if FAQ section is rendered correctly in both maven and gradle plugins. Here are steps for doing it:
- From project base directory run
./scripts/generateDoc.sh
it would create folder in project directory nameddocs-generated/
- Open this in browser:
firefox docs-generated/index.html
- Verify FAQ section is displayed correctly like in Maven Plugins https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/#faq
from jkube.
I would like to take this issue. Can you assign it to me and this will be my second contribution to eclipse jkube, any suggestions that I should keep in mind? Would appreciate your efforts.
from jkube.
Related Issues (20)
- KubernetesResourceTaskTest.setUp The declared Exception exception is never thrown HOT 1
- KubernetesUndeployTaskTest.setUp The declared Exception exception is never thrown HOT 1
- KubernetesWatchTaskTest.setUp The declared Exception exception is never thrown HOT 4
- MavenIssueManagementEnricherTest.setUp The declared Exception exception is never thrown HOT 1
- Cannot make k8s:helm-lint work with either 1.16.0 or 1.17-SNAPSHOT HOT 8
- Fix unit tests failing for windows in `jkube-kit/config/service` module HOT 1
- Fix failing JibBuildServiceBuildIntegrationTest in `jkube-kit/config`
- NpipeConnectionSocketFactory.createSocket The declared Exception exception is never thrown
- OCIRegistryInterceptorTest The declared Exception exception is never thrown
- OpenShiftHelmLintTaskTest.setUp The declared Exception exception is never thrown
- PortForwardServiceTest.setUp The declared Exception exception is never thrown HOT 3
- SpringBootUtilTest The declared Exception exception is never thrown HOT 1
- SpringBootWatcher.watch The declared Exception exception is never thrown HOT 1
- PortForwardServiceTest : Remove use of `Thread.sleep` HOT 3
- Quickstarts : Update Micronaut version in `quickstarts/maven/micronaut` HOT 1
- Quickstarts : Add Quickstart for Micronaut 4 HOT 6
- ImageConfigurationTest : Remove usage of `org.mockito.Mockito.mock` with real objects using builders HOT 1
- BuildConfigurationTest : Remove usage of `org.mockito.Mockito.mock` with real objects using builders HOT 1
- SecretEnricher : Use primitive `int` instead of `Integer` in for loop HOT 6
- Inconsistency when merging a route.yml fragment with two different profiles (commons, demo)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jkube.