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

Fix truncated descriptions in the CRDs #2563

Merged
merged 12 commits into from
Apr 11, 2024
4 changes: 2 additions & 2 deletions .chloggen/fix-truncated-description-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: operator, instrumentation, opamp bridge
component: documentation

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: The description for some fields was truncated in the CRDs
note: The description for some fields was truncated in the documentation.

# One or more tracking issues related to the change
issues: [2563]
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=500"
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=200"
MANIFEST_DIR ?= config/crd/bases

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -173,7 +174,7 @@ release-artifacts: set-image-controller
# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=$(MANIFEST_DIR)

# Run go fmt against code
.PHONY: fmt
Expand Down Expand Up @@ -479,8 +480,11 @@ bundle-push:
api-docs: crdoc kustomize
@{ \
set -e ;\
TMP_MANIFEST_DIR=$$(mktemp -d) ; \
cp -r config/crd/* $$TMP_MANIFEST_DIR; \
$(MAKE) CRD_OPTIONS=$(CRD_OPTIONS),maxDescLen=800 MANIFEST_DIR=$$TMP_MANIFEST_DIR/bases manifests ;\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why here is ,maxDescLen=800 and the length is also defined in CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=200" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will call the manifests target using CRD_OPTIONS="crd:generateEmbeddedObjectMeta=true,maxDescLen=200",maxDescLen=800. The second maxDescLen overrides the first one. By doing this, we can:

  • Reuse the value of CRD_OPTIONS
  • Use the new value for maxDescLen without polluting the bundle

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need the max length for the api-docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is easier to add a high value than implementing a sed command to remove it from the command 😅

TMP_DIR=$$(mktemp -d) ; \
$(KUSTOMIZE) build config/crd -o $$TMP_DIR/crd-output.yaml ;\
$(KUSTOMIZE) build $$TMP_MANIFEST_DIR -o $$TMP_DIR/crd-output.yaml ;\
$(CRDOC) --resources $$TMP_DIR/crd-output.yaml --output docs/api.md ;\
}

Expand Down
288 changes: 76 additions & 212 deletions bundle/manifests/opentelemetry.io_instrumentations.yaml

Large diffs are not rendered by default.

822 changes: 153 additions & 669 deletions bundle/manifests/opentelemetry.io_opampbridges.yaml

Large diffs are not rendered by default.

2,196 changes: 429 additions & 1,767 deletions bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml

Large diffs are not rendered by default.

288 changes: 76 additions & 212 deletions config/crd/bases/opentelemetry.io_instrumentations.yaml

Large diffs are not rendered by default.

822 changes: 153 additions & 669 deletions config/crd/bases/opentelemetry.io_opampbridges.yaml

Large diffs are not rendered by default.

2,196 changes: 429 additions & 1,767 deletions config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml

Large diffs are not rendered by default.

281 changes: 150 additions & 131 deletions docs/api.md

Large diffs are not rendered by default.

Loading