Kuberig

Kuberig

  • Docs
  • Blog
  • Help

›Resource Coding

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

Resource Grouping

Both the @EnvResource and @EnvResources annotation provide a group attribute that allows you to create groups of resources.

Both the deploy and generateYaml Gradle tasks provide command line options to specify what groups you want to execute the task for.

The default mode for the deploy and generateYaml tasks is to deploy the resources generated from methods that do not specify a group.

When providing a value for the --group option only that group will be considered. Group name matching is done in a case-insensitive way.

If you have a group for kafka resources you can deploy it using the following command line.

./gradlew deployLocalEnvironment --group kafka

In case you want to deploy all resources regardless of the value of the group attribute you can use the --allGroups option.

On the command line this becomes:

./gradlew deployLocalEnvironment --allGroups

Examples

@EnvResource

Shows how to specify a group attribute on the @EnvResource annotation.

package example

import io.kuberig.annotations.EnvResource
import kinds.v1.ConfigMapDsl
import kinds.v1.configMap

class FirstResource {

    @EnvResource(group = "kafka")
    fun firstResource() : ConfigMapDsl {
        return configMap {
            metadata {
                name("first-resource")
            }
            data("some-key", "some-value")
        }
    }

}

@EnvResources

Shows how to specify a group attribute on the @EnvResources annotation.

package example

import io.kuberig.annotations.EnvResources
import io.kuberig.dsl.support.DslResourceEmitter.emit
import kinds.v1.configMap

class FirstEmit {

    @EnvResources(group = "kafka")
    fun firstEmit() {
        emit(
            configMap {
                metadata {
                    name("first-emit")
                }
                data("some-key", "some-value")
            }
        )
    }

}
Last updated on 1/10/2021
← Coding ResourcesResource Apply Action →
Kuberig
Docs
HomeQuick StartDSL Intro
Community
Stack OverflowDiscordTwitter
More
BlogGitHubStar
Follow @kuberigio
Copyright © 2021 Rigeldev BV