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

quarkus-kubernetes: wrong kubernetes resource get generated when using an existing resource #18095

Closed
lburgazzoli opened this issue Jun 23, 2021 · 2 comments · Fixed by #18136
Assignees
Labels
area/kubernetes kind/bug Something isn't working
Milestone

Comments

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jun 23, 2021

Describe the bug

I've tried to configure the generated kubernetes resources using an existing resource as described in deploying-to-kubernetes guide but I noticed that it is required to provide some empty objects to get a proper generated resources.

As example, assuming I want to use the following resource:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
    spec:
      containers:
        - env:
            - name: MY_NS
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace

Then the generated resource has a spec like:

spec:
  replicas: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/version: latest
        app.kubernetes.io/name: my-app

which lacks the mandatory selector section.

if I amend the existing resource and I add some empty sections, like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 1
  selector:
    matchLabels:
  template:
    metadata:
      annotations:
      labels:
    containers:
      - env:
          - name: MY_NS
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace

then the generated result is like:

spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/version: latest
      app.kubernetes.io/name: my-app
  template:
    metadata:
      annotations:
        prometheus.io/port: "8080"
        prometheus.io/scheme: http
        app.quarkus.io/commit-id: ...
        app.quarkus.io/vcs-url: ...
        app.quarkus.io/build-timestamp: 2021-06-23 - 07:41:56 +0000
        prometheus.io/scrape: "true"
        prometheus.io/path: /q/metrics
      labels:
        app.kubernetes.io/version: latest
        app.kubernetes.io/name: my-app

Expected behavior

It should not be needed to set empty sections to get a proper generated resource

Actual behavior

The generated resource is incorrect if empty fields are omitted

@lburgazzoli lburgazzoli added the kind/bug Something isn't working label Jun 23, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 23, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Jun 23, 2021

@iocanel I think this is one for you

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

Successfully merging a pull request may close this issue.

4 participants