Kuberig

Kuberig

  • Docs
  • Blog
  • Help

›Code Samples

Getting started

  • Intro
  • Quick Start
  • DSL Intro

Environments

  • Initializing an Environment
  • Managing Container Versions
  • Environment Support

Resource Coding

  • Coding Resources
  • Resource Grouping
  • Resource Apply Action
  • DSL Details

Code Samples

  • Defining a ConfigMap
  • Defining a Secret
  • Defining a Deployment
  • Defining a Service
  • Defining an Ingress

Reference

  • Configuration
  • Repository Organisation
  • Encryption Support
  • Service Account Setup

Defining a Deployment

private val name = "simple-app"
private val label = Pair("app", name)

@EnvResource
fun appDeployment(): DeploymentDsl {
    return deployment {
        metadata {
            name(name)
        }
        spec {
            replicas(2)
            selector {
                matchLabels {
                    matchLabel(label)
                }
            }
            template {
                metadata {
                    labels {
                        label(label)
                    }
                }
                spec {
                    containers {
                        container {
                            name(name)
                            image("simple-app:${containerVersion("simple-app")}")
                        }
                    }
                }
            }
        }
    }
}

The containerVersion helper function will retrieve the actual image version/tag to use from a container.versions file. First the environment specific container.versions file will be checked for an entry for 'simple-app'. If no entry is available the global container.versions file will be used instead.

Last updated on 12/30/2020
← Defining a SecretDefining a Service →
Kuberig
Docs
HomeQuick StartDSL Intro
Community
Stack OverflowDiscordTwitter
More
BlogGitHubStar
Follow @kuberigio
Copyright © 2021 Rigeldev BV