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

community-operator-crds should have the custom resource definition in the "crds" subdirectory #282

Closed
bbergquist0930 opened this issue Nov 19, 2023 · 3 comments · May be fixed by #283
Closed
Labels

Comments

@bbergquist0930
Copy link

Helm 3.0 specifies that a custom resource definition should be located within the crds subdirectory. When located there, Helm will install the custom resource definition before the rest of the chart.

With the current location within the templates subdirectory, this chart cannot be used effectively as a subchart with the parent chart using the custom resource as the custom resource is not installed early enough.

Steps to reproduce the behavior:

  1. Create a helm chart that will have the community-operator as a subchart
helm create crds-test
cd crds-test
rm -rf templates/*
delete customresourcedefinitions.apiextensions.k8s.io mongodbcommunity.mongodbcommunity.mongodb.com
  1. Add in the community-operator as a dependency
echo "
dependencies:
  - name: community-operator
    version: 0.8.3
    repository: https://mongodb.github.io/helm-charts
" >>Chart.yaml
  1. Build the chart dependencies
helm repo add mongodb https://mongodb.github.io/helm-charts
helm dependency build
  1. Add a usage of the custom resource definition to the parent chart
curl https://raw.githubusercontent.com/mongodb/mongodb-kubernetes-operator/master/config/samples/mongodb.com_v1_mongodbcommunity_cr.yaml --output templates/mongodb.com_v1_mongodbcommunity_cr.yaml
  1. Try to install the chart

  1. See error

Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: resource mapping not found for name: "example-mongodb" namespace: "" from "": no matches for kind "MongoDBCommunity" in version "mongodbcommunity.mongodb.com/v1"
ensure CRDs are installed first

What did you expect?
The custom resource definition should have been installed before the custom resource referenced it.

What happened instead?
The custom resource definition was not installed and then the reference to it failed when the custom resource reference it.

Additional context
Locally I have locally repackaged the community-operator-crds chart with the custom resource definition within the crds directory and locally repackaged the community-operator chart pointing to this local community-operator-crds.

cat Chart.yaml 
apiVersion: v2
name: parent-chart
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"


dependencies:
  - name: community-operator-cp
    version: 0.8.3
    repository: "@smm-chart-db-local"

With no other changes, the parent chart can be installed

helm install crds-test .
NAME: crds-test
LAST DEPLOYED: Sun Nov 19 08:10:20 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
@bbergquist0930
Copy link
Author

crds-test.zip

ZIP file of the project that follows the instructions above

Copy link
Contributor

This issue is being marked stale because it has been open for 60 days with no activity. Please comment if this issue is still affecting you. If there is no change, this issue will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jan 19, 2024
Copy link
Contributor

This issue was closed because it became stale and did not receive further updates. If the issue is still affecting you, please re-open it, or file a fresh Issue with updated information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant