Skip to content

Inconsistency when merging a route.yml fragment with two different profiles (commons, demo) #2758

@vmarzal

Description

@vmarzal

Describe the bug

Problem merging a 'route.yml' common configuration with a environment one. The result is not displaying several annotations placed in the common file.

Eclipse JKube version

1.16.1

Component

OpenShift Maven Plugin

Apache Maven version

other (please specify in additional context)

Gradle version

None

Steps to reproduce

I was trying to extract a common configuration from the metadata.annotations route.yml files of two environments.

Common configuration:

metadata:
  annotations:
    cert-manager.io/issuer-kind: ClusterIssuer
    cert-manager.io/issuer-name: letsencrypt-prod
  1. I put that piece in the /common/route.yml:
metadata:
  annotations:
    cert-manager.io/issuer-kind: ClusterIssuer
    cert-manager.io/issuer-name: letsencrypt-prod
spec:
  tls:
    insecureEdgeTerminationPolicy: Redirect
    termination: edge
  1. And delete it from the environment files (example from de /demo/route.yml) getting simple fragments like these:
metadata:
  namespace: demo-namespace
spec:
  host: demo-namespace.apps.ocpdes.es
  1. The profile activation is performed with the configuration provided and the directories exist in src/main/jkube.
<profile>
	<id>demo</id>
	<properties>
		<spring.profiles.active>demo</spring.profiles.active>
		<jkube.environment>common,demo</jkube.environment>
	</properties>
</profile>

With the command 'mvn oc:resource -Pdemo' I get that merged route.yml file with no trace of my custom annotations.

---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
  annotations:
    jkube.eclipse.org/scm-url: ...
    jkube.eclipse.org/scm-tag: HEAD
    jkube.eclipse.org/git-commit: 22ec86b77b032234a5a4d9c70bbda3f2e5e910a0
    jkube.eclipse.org/git-url: ...
    app.openshift.io/vcs-ref:...
    app.openshift.io/vcs-uri: ...
    jkube.eclipse.org/git-branch: ....
  labels:

Expected behavior

The expected behavior is a route.yml file with the common annotations (in addition to the opinionated defaults):

---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
  annotations:
    cert-manager.io/issuer-name: letsencrypt-prod
    cert-manager.io/issuer-kind: ClusterIssuer
    jkube.eclipse.org/scm-url: ...
    jkube.eclipse.org/scm-tag: HEAD
    ....

Runtime

OpenShift

Kubernetes API Server version

1.22.15

Environment

Windows

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

Maven 3.9.4

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions