solo-io / gloo-portal-issues

Public tracker for issues related to Gloo Portal
https://docs.solo.io/gloo-portal/latest/
1 stars 3 forks source link

When generating CRDs from Helm, linebreak before apiVersion: apiextensions.k8s.io/v1 is omitted #135

Closed havard-fjaer closed 2 years ago

havard-fjaer commented 2 years ago

Describe the bug The first line apiextensions.k8s.io/v1 for CRD portals.portal.gloo.solo.io becomes part of a comment on the line above.

To Reproduce When running: helm template gloo-portal gloo-portal/gloo-portal -n gloo-portal --values helm-values.yaml --version v1.1.2

with helm values:

glooEdge:
  enabled: true
crd:
  create: true
licenseKey:
...

apiVersion: apiextensions.k8s.io/v1 becomes part of the above comment, and installation of the CRD fails in the cluster:

---
# Source: gloo-portal/templates/crd.yaml
# Generate CRDs inside the templates directory to support Helm 2 installsapiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  labels:
    app: gloo-portal
    app.kubernetes.io/name: gloo-portal
  name: portals.portal.gloo.solo.io
...

Expected behavior apiVersion: apiextensions.k8s.io/v1 should be on a line by itself.

Mitigation When running: helm template gloo-portal gloo-portal/gloo-portal -n gloo-portal --values helm-values.yaml --include-crds --version v1.1.2 with crd/create:false:

glooEdge:
  enabled: true
crd:
  create: false
licenseKey:
...

the CRD is generated as expected. The comment: # Generate CRDs inside the templates directory to support Helm 2 installs is not part of the generated templates when only using the --include-crds flag.

None of the other CRDs are affected by this problem. Suspect there is a line break missing in or somewhere near the template.

Additional context Add any other context about the problem here, e.g.

chrisgaun commented 2 years ago

Probably a good first issue. We have some new engineers starting so hopefully they can pick it up

sam-heilbron commented 2 years ago

I just tried this with the latest portal version:

helm template gloo-portal gloo-portal/gloo-portal -n gloo-portal --values values.yaml --version v1.3.0-beta1

and it appears to be resolved:

# Source: gloo-portal/templates/crd.yaml
# Generate CRDs inside the templates directory to support Helm 2 installs# Code generated by skv2. DO NOT EDIT.

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    crd.solo.io/specHash: 16e45e9e2abcdf4d
  labels:
    app: gloo-portal
    app.kubernetes.io/name: gloo-portal
  name: portals.portal.gloo.solo.io

However, it is only resolved because the first line of the schemas is itself a comment. Would be good to still clean this up in case that auto generated comment is removed

bewebi commented 2 years ago

Resolved by solo-io/dev-portal#2198, to be released in the next 1.3.0 beta