addon-controller icon indicating copy to clipboard operation
addon-controller copied to clipboard

BUG: Helm with yaml configmap templates incorrectly get parsed by sveltos

Open thecodeassassin opened this issue 1 year ago • 1 comments

Problem Description

This yaml in the linstor helm repo is treated as if it was a policyRef configmap.

It should not be parsed at all, otherwise all charts that have yaml files as configmaps will fail to deploy.

https://github.com/piraeusdatastore/piraeus-operator/blob/c27bf54a81fe6e6c0674c6492fdd9fbc9d4269a3/charts/piraeus/templates/config.yaml#L11

1 Failure Message: failed to decode k8s resource # This is the configuration for default images. Err: Object 'Kind' is missing in 1

System Information

CLUSTERAPI VERSION: latest SVELTOS VERSION: 0.29 KUBERNETES VERSION: 1.29.1

Logs

INSTRUCTIONS: Provide any additional information you think would be helpful below. Large files, logs, etc. can be attached to this issue so long as they meet the GitHub attachment guidelines described here: https://help.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests

Name:         storage-capi-europe-north
Namespace:    default
Labels:       argocd.argoproj.io/instance=bootstrap
              projectsveltos.io/cluster-name=europe-north
              projectsveltos.io/cluster-profile-name=storage
              projectsveltos.io/cluster-type=Capi
Annotations:  <none>
API Version:  config.projectsveltos.io/v1alpha1
Kind:         ClusterSummary
Spec:
  Cluster Name:       europe-north
  Cluster Namespace:  default
  Cluster Profile Spec:
    Cluster Selector:  purpose=edge
    Depends On:
      cert-manager
      base-secrets
    Helm Charts:
      Chart Name:         dtrdnk-helm-charts/piraeus
      Chart Version:      2.2.0
      Helm Chart Action:  Install
      Release Name:       linstor
      Release Namespace:  piraeus-datastore
      Repository Name:    dtrdnk-helm-charts
      Repository URL:     https://dtrdnk.github.io/helm-charts
      Values:             installCRDs: true

    Reloader:                false
    Stop Matching Behavior:  WithdrawPolicies
    Sync Mode:               ContinuousWithDriftDetection
  Cluster Type:              Capi
Status:
  Dependencies:  All dependencies deployed
  Feature Summaries:
    Deployed Group Version Kind:
      Issuer.v1.cert-manager.io
      Certificate.v1.cert-manager.io
      LinstorCluster.v1.piraeus.io
      LinstorSatelliteConfiguration.v1.piraeus.io
    Feature ID:         Resources
    Hash:               1wfyi3zvwyp9VvpknsXhz/Pe9rtVJZxc5zNPR0ZyAJE=
    Last Applied Time:  2024-05-09T20:14:56Z
    Status:             Provisioned
    Failure Message:    failed to decode k8s resource     # This is the configuration for default images. Err: Object 'Kind' is missing in '{"base":"quay.io/piraeusdatastore","components":{"drbd-module-loader":{"image":"drbd9-jammy","match":[{"image":"drbd9-centos7","osImage":"CentOS Linux 7"},{"image":"drbd9-centos8","osImage":"CentOS Linux 8"},{"image":"drbd9-almalinux8","osImage":"AlmaLinux 8"},{"image":"drbd9-almalinux8","osImage":"Red Hat Enterprise Linux CoreOS"},{"image":"drbd9-almalinux9","osImage":"AlmaLinux 9"},{"image":"drbd9-bionic","osImage":"Ubuntu 18\\.04"},{"image":"drbd9-focal","osImage":"Ubuntu 20\\.04"},{"image":"drbd9-jammy","osImage":"Ubuntu 22\\.04"},{"image":"drbd9-bullseye","osImage":"Debian GNU/Linux 11"},{"image":"drbd9-buster","osImage":"Debian GNU/Linux 10"}],"tag":"v9.2.5"},"drbd-reactor":{"image":"drbd-reactor","tag":"v1.2.0"},"drbd-shutdown-guard":{"image":"drbd-shutdown-guard","tag":"v1.0.0"},"ha-controller":{"image":"piraeus-ha-controller","tag":"v1.1.4"},"linstor-controller":{"image":"piraeus-server","tag":"v1.24.2"},"linstor-csi":{"image":"piraeus-csi","tag":"v1.2.3"},"linstor-satellite":{"image":"piraeus-server","tag":"v1.24.2"}}}'
    Feature ID:         Helm
    Hash:               kh7/iWZBPm00cjDtAcunZwlq6uomSFd9VOSclID0uAI=
    Last Applied Time:  2024-05-09T20:18:27Z
    Status:             Provisioning
  Helm Release Summaries:
    Release Name:       linstor
    Release Namespace:  piraeus-datastore
    Status:             Managing
    Values Hash:        aW5zdGFsbENSRHM6IHRydWUK
Events:                 <none>

thecodeassassin avatar May 09 '24 20:05 thecodeassassin

There was an issue processing the content piraeus-operator. this PR fixed that issue

With that PR fixed everything is working fine and all gets deployed.

  1. git clone --branch v2 https://github.com/piraeusdatastore/piraeus-operator
  2. cd piraeus-operator
  3. edit charts/piraeus/values.yaml to set installCRDs: true
  4. helm template --include-crds charts/piraeus > /tmp/piraeus

Now that I have the data I want to deploy:

  1. kubectl create configmap piraeus --from-file=/tmp/piraeus
  2. kubectl create configmap linstorcluster --from-file=/tmp/linstorcluster (this contains LinstorCluster instance)

At this point created this ClusterProfile

apiVersion: [config.projectsveltos.io/v1alpha1](http://config.projectsveltos.io/v1alpha1)
kind: ClusterProfile
metadata:
 name: deploy-piraeus
spec:
 clusterSelector: env=fv
 policyRefs:
 - name: piraeus
  namespace: default
  kind: ConfigMap
 - name: linstorcluster
  namespace: default
  kind: ConfigMap

and all got deployed

featureSummaries:
  - deployedGroupVersionKind:
   - ServiceAccount.v1.
   - Secret.v1.
   - ConfigMap.v1.
   - [CustomResourceDefinition.v1.apiextensions.k8s.io](http://customresourcedefinition.v1.apiextensions.k8s.io/)
   - [ClusterRole.v1.rbac.authorization.k8s.io](http://clusterrole.v1.rbac.authorization.k8s.io/)
   - [ClusterRoleBinding.v1.rbac.authorization.k8s.io](http://clusterrolebinding.v1.rbac.authorization.k8s.io/)
   - [Role.v1.rbac.authorization.k8s.io](http://role.v1.rbac.authorization.k8s.io/)
   - [RoleBinding.v1.rbac.authorization.k8s.io](http://rolebinding.v1.rbac.authorization.k8s.io/)
   - Service.v1.
   - Deployment.v1.apps
   - [ValidatingWebhookConfiguration.v1.admissionregistration.k8s.io](http://validatingwebhookconfiguration.v1.admissionregistration.k8s.io/)
   - [LinstorCluster.v1.piraeus.io](http://linstorcluster.v1.piraeus.io/)
   featureID: Resources
   hash: H5ZO3dABozZ5cl99Rd++F4loJJIKoqt1uVNi6PGzShI=
   lastAppliedTime: "2024-05-10T10:44:26Z"
   status: Provisioned

gianlucam76 avatar May 10 '24 12:05 gianlucam76

Available in v0.30.0

gianlucam76 avatar May 17 '24 09:05 gianlucam76