Skip to content

Can't add service annotation #35

@dannymcerlean1

Description

@dannymcerlean1

Hi, really nice project! Reporting a small issue I found when trying to add annotations/labels to a service.

Bug Report

When creating a Server object, I'm unable to add annotations or labels to the associated k8 service.

1. Minimal reproduce step (Required)

import manifests
import konfig.models.kube.frontend
import konfig.models.kube.frontend.container
import konfig.models.kube.frontend.service

import konfig.models.kube.frontend
import konfig.models.kube.frontend.container
import konfig.models.kube.frontend.service

temporalCodecServer: frontend.Server {
    name = "test"
    namespace = "test"
    needNamespace = False
    image = "TEST"
    mainContainer = container.Main {
        env.GET_HOSTS_FROM: {
            value = "dns"
        }
        ports = [
            {
                containerPort = 8080
            }
        ]
    }
    services = [
        service.Service {
           name = "serviceToAnnotate"
            annotations = {
                "key" = "value"
            }
        }
    ]
}

2. What did you expect to see? (Required)

something like this:

apiVersion: v1
kind: Service
metadata:
  name: TEST
  namespace: test
  annotations:
    key: "value
spec:
  ports:
    - port: 8080
  selector:
    app.kubernetes.io/name: sampleapp

3. What did you see instead (Required)

Above service without annotations

4. What is your KCL components version? (Required)

My kcl.mod file looks like this:

[package]
name = "test"
version = "0.0.1"

[dependencies]
konfig = { git = "https://github.com/kcl-lang/konfig" }

[profile]
entries = [
    "main.k",
    "${konfig:KCL_MOD}/models/kube/render/render.k"
]

I am using the latest version (0.10.0)

Above example is for annotations, I see the same behavior for labels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions