https://github.com/hnaderi/sbt-k8s
Unopinionated kubernetes manifests for scala and sbt
https://github.com/hnaderi/sbt-k8s
k8s kubernetes manifest sbt sbt-plugin scala typesafe typesafe-config typesafeconfig yaml
Last synced: 3 months ago
JSON representation
Unopinionated kubernetes manifests for scala and sbt
- Host: GitHub
- URL: https://github.com/hnaderi/sbt-k8s
- Owner: hnaderi
- License: apache-2.0
- Created: 2022-08-30T12:42:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-01T02:32:00.000Z (4 months ago)
- Last Synced: 2025-07-01T03:36:05.586Z (4 months ago)
- Topics: k8s, kubernetes, manifest, sbt, sbt-plugin, scala, typesafe, typesafe-config, typesafeconfig, yaml
- Language: Scala
- Homepage: http://projects.hnaderi.dev/sbt-k8s/
- Size: 326 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![]()
sbt k8s
sbt plugin for scala k8s[](https://index.scala-lang.org/hnaderi/sbt-k8s/sbt-k8s)
![]()
![]()
[](https://scala-steward.org)### Usage
This sbt plugin is available for sbt 1.x
To use the latest version of plugins, include the following in your `project/plugins.sbt`:
```scala
addSbtPlugin("dev.hnaderi" % "sbt-k8s" % "@VERSION@") // everything
addSbtPlugin("dev.hnaderi" % "sbt-k8s-manifests" % "@VERSION@") // just manifest generation and objects
addSbtPlugin("dev.hnaderi" % "sbt-k8s-cookbook" % "@VERSION@") // easy to use recipes (RECOMMENDED)
```and your project in `build.sbt`
#### If you have native packager docker plugin. (all settings are optional)
```scala
lazy val service = project
.settings(
microserviceResources := ResourceRequirements(
limits = Map("cpu" -> Quantity("500m"), "memory" -> Quantity("512Mi")),
requests = Map("cpu" -> Quantity("250m"), "memory" -> Quantity("128Mi"))
),
microserviceEnvironments := Seq(
Variable("SERVICE_NAME", "example"),
ExternalSecretVariable("POSTGRES_PASSWORD", "password", "pg-credentials"),
ConfigFile("service-config", Map(
"app.conf" -> file(s"deployments/configs/service.conf"),
"base.conf" -> file(s"deployments/configs/base.conf")
),
"/mnt/config"
)
),
microserviceServices := Seq(ServiceDefinition("ws", 8080, 80))
)
.enablePlugins(DockerPlugin, K8sMicroservicePlugin)
```#### If you don't want to use native packager (microserviceImage is required)
```scala
lazy val service = project
.settings(
microserviceImage := "your.registry/your-image:version"
)
.enablePlugins(K8sMicroservicePlugin)
```#### If you want to create completely custom manifests (you are on your own, create any kubernetes object you want)
```scala
lazy val service = project
.settings(
k8sManifestObjects := Seq(
// kubernetes objects from scala-k8s
)
)
.enablePlugin(K8sManifestPlugin)
```### How to run
now you have `k8sManifestGen` and `k8sManifestPrint` tasks that will generate or print manifest for defined objects.
default generation will write manifest in `target/k8s/manifest.yml`### Configure
You can configure everything using settings. current settings are prefixed by `k8sManifest` or `microservice`