Skip to content

使用 oam 库,生成 oam 资源对象时,出现编译错误 #1810

Open
@Jamel-jun

Description

@Jamel-jun

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Run this minimal example to reproduce the issue.

import oam

_params = {
	env = "template.dev",
	name = "application-env",
	release_version = "20241111",
}

[
	oam.Application {
		metadata = {
			# init-application-env
			name = _params.name
			namespace = "_params.env.namespace"
			annotations = {
				"app.oam.dev/publishVersion" = _params.release_version
			}
		}
		spec = {
			components = [{
				$type = "k8s-objects"
				name = _params.name
				properties.objects = [{
					apiVersion = "v1"
					kind = "ConfigMap"
					metadata.name = _params.name
					data = {
						LOGGING_CONFIG = "classpath:log4j2-spring-local.xml"
						OTEL_EXPORTER_OTLP_ENDPOINT = "fdsa"
						OTEL_INSTRUMENTATION_RUNTIME_TELEMETRY_ENABLED = "false"
						SPRING_CLOUD_CONFIG_LABEL = "dev/init-dev"
						SPRING_PROFILES_ACTIVE = "dev4"
					}
				}, {
				  apiVersion = "v1"
				  kind = "Secret"
				  $type = "Opaque"
				  metadata.name = "application-env"
				  stringData = {
				    OTEL_EXPORTER_OTLP_HEADERS = "fdsa"
				  }
				}]
			}]

			policies = [{
				$type = "topology"
				name = metadata.namespace
				properties = {
					clusters = ["_params.env.cluster"]
				}
			}]
		}
	}
]

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

Compilation successful, output the correct OAM YAML resource.

3. What did you see instead (Required)

Compilation failed.
image

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

image

Metadata

Metadata

Assignees

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