Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vmarzal opened this issue Feb 28, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@vmarzal
Copy link
Contributor

vmarzal commented Feb 28, 2024

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

@vmarzal vmarzal added the bug Something isn't working label Feb 28, 2024
@rohanKanojia rohanKanojia moved this to Planned in Eclipse JKube Apr 3, 2024
@arsenalzp
Copy link
Contributor

arsenalzp commented Apr 10, 2024

Hello colleagues,
Can I work on this issue?

@rohanKanojia
Copy link
Member

Umm, it's not decided yet how to approach this problem. But if you want to give it a try and propose something, feel free to go ahead.

@arsenalzp
Copy link
Contributor

Could you please assign it to me?

@rohanKanojia
Copy link
Member

@arsenalzp : Sorry, we don't have any bot running for these kind of project chores.

Thanks for showing interest in fixing this issue.

@rohanKanojia
Copy link
Member

@arsenalzp : Hello, are you still working on this issue?

@arsenalzp
Copy link
Contributor

Hello,
I have two more issues and PRs which are being reviewed right now. Let me manage with them then I proceed with this issue.

@arsenalzp
Copy link
Contributor

Hello,
Some of my PRs were accepted so I'm ready to work for this issue!

@arsenalzp
Copy link
Contributor

arsenalzp commented Sep 1, 2024

Oh, I spent a couple of hours to troubleshoot the issue.
The main question: how should it work, what is the expectation?
Enricher creates two resources based on the given resources fragments; requestor of this particular issue used two files named identically for two different resource/profile.
Name should be different based on environment names:
common/common-route.yml and demo/demo-route.yml for common and demo environments respectively, then two different files are produced:

target/classes/META-INF/jkube/openshift/common-route.yml:

apiVersion: v1
kind: Route
metadata:
  annotations:
    cert-manager.io/issuer-name: letsencrypt-prod
    cert-manager.io/issuer-kind: ClusterIssuer
  labels:
    testProject: spring-boot-sample
    app: spring-boot
    provider: jkube
    version: 1.17.0
    group: org.eclipse.jkube.quickstarts.maven
    app.kubernetes.io/part-of: org.eclipse.jkube.quickstarts.maven
    app.kubernetes.io/managed-by: jkube
    app.kubernetes.io/name: spring-boot
    app.kubernetes.io/version: 1.17.0
  name: common
spec:
  tls:
    insecureEdgeTerminationPolicy: Redirect
    termination: edge

and

target/classes/META-INF/jkube/openshift/demo-route.yml:

apiVersion: v1
kind: Route
metadata:
  labels:
    testProject: spring-boot-sample
    app: spring-boot
    provider: jkube
    version: 1.17.0
    group: org.eclipse.jkube.quickstarts.maven
    app.kubernetes.io/part-of: org.eclipse.jkube.quickstarts.maven
    app.kubernetes.io/managed-by: jkube
    app.kubernetes.io/name: spring-boot
    app.kubernetes.io/version: 1.17.0
  name: demo
  namespace: demo-namespace
spec:
  host: demo-namespace.apps.ocpdes.es

Otherwise, enricher produces two files named like route.yml and route-1.yml withe the identical content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants