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

Added project name to the PROJECT config file #172

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

mneverov
Copy link
Contributor

Added project name to the PROJECT config file

projectName field is needed for operator-sdk to deduct the metadata name for the
project. When the bundle command reads input files from the stdin and no --project
argument is provided, and projectName is absent the generated metadata name has
invalid pattern: '.v0.18.0'.
This commit adds the projectName field so metadata.name is correctly generated.

Fixes #37

@mneverov mneverov requested a review from jpkrohling as a code owner January 24, 2021 14:25
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 24, 2021

CLA Signed

The committers are authorized under a signed CLA.

@mneverov
Copy link
Contributor Author

mneverov commented Jan 24, 2021

operator-sdk version

operator-sdk version: "v1.3.0-27-gdf8186c4-dirty", commit: "df8186c446c7e8d260bcd42216e59b4a08ce7185", kubernetes version: "v1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64"

I believe that error that was mentioned in the original issue was fixed in PR#4276.

When I run make bundle I get another error:

make bundle

/home/mneverov/go/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/mneverov/go/bin/operator-sdk generate kustomize manifests -q
/home/mneverov/go/bin/kustomize build config/manifests | /home/mneverov/go/bin/operator-sdk generate bundle -q --overwrite --manifests --version "0.18.0"
ERRO[0000] ClusterServiceVersion validation: [CSVFileNotValid] (.v0.18.0) metadata.name ".v0.18.0" is invalid:
[a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')]
ERRO[0000] ClusterServiceVersion validation: [FieldNotFound] required field missing
FATA[0000] Error generating bundle manifests: error generating ClusterServiceVersion: invalid generated ClusterServiceVersion
Makefile:201: recipe for target 'bundle' failed
make: *** [bundle] Error 1

ClusterServiceVersion validation: [CSVFileNotValid] (.v0.18.0) metadata.name ".v0.18.0" is invalid.

Command $(OPERATOR_SDK) generate kustomize manifests -q works because the operator name is set from the name of the root directory of this project (opentelementry-operator).

Command $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --manifests --version $(VERSION) $(BUNDLE_METADATA_OPTS) doesn't work because it reads the operator name from the PROJECT file (if it exists), otherwise from the provided --project argument.
After I added projectName to the PROJECT file the make bundle was successful:

make bundle

/home/mneverov/go/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/mneverov/go/bin/operator-sdk generate kustomize manifests -q
/home/mneverov/go/bin/kustomize build config/manifests | /home/mneverov/go/bin/operator-sdk generate bundle -q --overwrite --manifests --version "0.18.0"
/home/mneverov/go/bin/operator-sdk bundle validate ./bundle
INFO[0000] Found annotations file                        bundle-dir=bundle container-tool=docker
INFO[0000] Could not find optional dependencies file     bundle-dir=bundle container-tool=docker
INFO[0000] All validation tests have completed successfully

I committed all the changes that were done after successful command run. Let me know if I should revert opentelemetry-operator.clusterserviceversion.yaml files.
I also ran go mod tidy and got some changes in go.sum.

@jpkrohling
Copy link
Member

Let me know if I should revert opentelemetry-operator.clusterserviceversion.yaml files.

Yes, they are generated post-release.

projectName field is needed for operator-sdk to deduct the metadata name for the
project. When the bundle command reads input files from the stdin and no --project
argument is provided, and projectName is absent the generated metadata name has
invalid pattern: '.v0.18.0'.
This commit adds the projectName field so metadata.name is correctly generated.

Fixes open-telemetry#37
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Thanks!

@mergify mergify bot merged commit a1c6f8a into open-telemetry:master Jan 25, 2021
shree007 pushed a commit to shree007/opentelemetry-operator that referenced this pull request Dec 12, 2021
Added project name to the PROJECT config file

projectName field is needed for operator-sdk to deduct the metadata name for the
project. When the bundle command reads input files from the stdin and no --project
argument is provided, and projectName is absent the generated metadata name has
invalid pattern: '.v0.18.0'.
This commit adds the projectName field so metadata.name is correctly generated.

Fixes open-telemetry#37
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Added project name to the PROJECT config file

projectName field is needed for operator-sdk to deduct the metadata name for the
project. When the bundle command reads input files from the stdin and no --project
argument is provided, and projectName is absent the generated metadata name has
invalid pattern: '.v0.18.0'.
This commit adds the projectName field so metadata.name is correctly generated.

Fixes open-telemetry#37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align operator version with the tooling around it
2 participants