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

[CCE] pvc creation failed #51

Open
1 task done
dmicheneau opened this issue Jan 6, 2023 · 3 comments
Open
1 task done

[CCE] pvc creation failed #51

dmicheneau opened this issue Jan 6, 2023 · 3 comments
Assignees
Labels
category/cce Resource category CCE upjet-issue

Comments

@dmicheneau
Copy link
Collaborator

dmicheneau commented Jan 6, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The creation of PVC (CCE) resource does not work.
Crossplane creates the PVC resource with an external name, but not on the Flexible Engine web interface.
If I exercise the terraform generated by crossplane, the PVC resource is well created.
We believe that the problem is in importation when crossplane asks the API, on the line: Source in HuaweiCloud Provider

Expected Behavior

No response

Steps To Reproduce

create a crossplane pvc resource with manifest below:

apiVersion: cce.flexibleengine.upbound.io/v1beta1
kind: Pvc
metadata:
  annotations:
    meta.upbound.io/example-id: cce/v1beta1/pvc
  labels:
    testing.upbound.io/example-name: example_pvc
  name: example-pvc
spec:
  forProvider:
    accessModes:
    - ReadWriteOnce
    annotations:
      everest.io/disk-volume-type: SSD
    clusterIdSelector:
      matchLabels:
        testing.upbound.io/example-name: example_cce_cluster
    name: example-pvc
    namespaceSelector:
      matchLabels:
        testing.upbound.io/example-name: default
    storage: 10Gi
    storageClassName: csi-disk

locate directory wordir tmp
delete terraform tfstate
and make a terraform apply.
Magic ! the pvc is created.

Environment

  • Provider Version: 1.35.1
  • terrafom: 1.3.7
@dmicheneau dmicheneau added the bug Something isn't working label Jan 6, 2023
@azrod azrod added terraform-provider-issue category/cce Resource category CCE and removed bug Something isn't working labels Jan 6, 2023
@azrod azrod added bug Something isn't working and removed bug Something isn't working labels Jan 12, 2023
@azrod azrod changed the title [CCE] pvc [CCE] pvc creation failed Jan 12, 2023
@azrod
Copy link
Collaborator

azrod commented Jan 16, 2023

After releasing terraform-provider new error is returned

Message:               apply failed: Error creating FlexibleEngine CCE PVC: Resource not found: [POST https://REDACTED.cce.eu-west-0.prod-cloud-ocb.orange-business.com/api/v1/namespaces/REDACTED/persistentvolumeclaims], error message: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"namespaces \"REDACTED\" not found","reason":"NotFound","details":{"name":"REDACTED","kind":"namespaces"},"code":404}

@azrod
Copy link
Collaborator

azrod commented Jan 17, 2023

The error in the terraform provider is now corrected

@azrod
Copy link
Collaborator

azrod commented Jan 17, 2023

Now i have error caused by a tainted state. After creation the resource as READY = false this is caused by annotations field

Note in terraform doc

Note that the imported state may not be identical to your resource definition,
due to some attributes missing from the API response, security or some other reason.

The missing attributes include: annotations.
It is generally recommended running terraform plan after importing a PVC. You can then decide if changes should be applied to the PVC, or the resource definition should be updated to align with the PVC. Also you can ignore changes as below.

This problem is know in upjet crossplane/upjet#80

kubectl describe pvc.cce.flexibleengine.upbound.io/example-cce-pvc
Name:         example-cce-pvc
Namespace:    
Labels:       testing.upbound.io/example-name=example_cce_pvc
Annotations:  crossplane.io/external-create-pending: 2023-01-17T11:09:04+01:00
              crossplane.io/external-create-succeeded: 2023-01-17T11:09:04+01:00
              crossplane.io/external-name: redacted
              meta.upbound.io/example-id: cce/v1beta1/pvc
              upjet.crossplane.io/provider-meta: {"redacted":{"create":300000000000,"delete":180000000000}}
API Version:  cce.flexibleengine.upbound.io/v1beta1
Kind:         Pvc
Metadata:
  Creation Timestamp:  2023-01-17T10:08:53Z
  Finalizers:
    finalizer.managedresource.crossplane.io
  Generation:  3
  Managed Fields:
    API Version:  cce.flexibleengine.upbound.io/v1beta1
    Fields Type:  FieldsV1
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2023-01-17T10:08:53Z
    API Version:  cce.flexibleengine.upbound.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1: (...)
    Manager:      provider
    Operation:    Update
    Time:         2023-01-17T10:14:08Z
    API Version:  cce.flexibleengine.upbound.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1: (...)
    Manager:         provider
    Operation:       Update
    Subresource:     status
    Time:            2023-01-17T10:14:10Z
  Resource Version:  1234916
  Self Link:         /apis/cce.flexibleengine.upbound.io/v1beta1/pvcs/example-cce-pvc
  UID:               redacted
Spec:
  Deletion Policy:  Delete
  For Provider:
    Access Modes:
      ReadWriteOnce
    Annotations:
      everest.io/disk-volume-type:  SSD
    Cluster Id:                     redacted
    Cluster Id Ref:
      Name:  example-cce-cluster
    Cluster Id Selector:
      Match Labels:
        testing.upbound.io/example-name:  example_cce_cluster
    Name:                                 example-cce-pvc
    Namespace:                            example-cce-namespace
    Namespace Ref:
      Name:  example-cce-namespace
    Namespace Selector:
      Match Labels:
        testing.upbound.io/example-name:  example_cce_namespace
    Region:                               eu-west-0
    Storage:                              10Gi
    Storage Class Name:                   csi-disk
  Provider Config Ref:
    Name:  default
Status:
  At Provider:
    Creation Timestamp:  2023-01-17T10:09:07Z
    Id:                  redacted
    Status:              Pending
  Conditions:
    Last Transition Time:  2023-01-17T10:14:09Z
    Reason:                Available
    Status:                True
    Type:                  Ready
    Last Transition Time:  2023-01-17T10:14:12Z
    Message:               observe failed: cannot run plan: plan failed: Instance cannot be destroyed: Resource flexibleengine_cce_pvc.example-cce-pvc has lifecycle.prevent_destroy set, but the plan calls for this resource to be destroyed. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or reduce the scope of the plan using the -target flag.
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced
    Last Transition Time:  2023-01-17T10:14:06Z
    Reason:                Finished
    Status:                True
    Type:                  AsyncOperation
    Last Transition Time:  2023-01-17T10:14:06Z
    Message:               apply failed: Timeout for waiting PVC status become ready: context deadline exceeded: 
    Reason:                ApplyFailure
    Status:                False
    Type:                  LastAsyncOperation
Events:
  Type     Reason                         Age                From                                                     Message
  ----     ------                         ----               ----                                                     -------
  Normal   CreatedExternalResource        6m35s              managed/cce.flexibleengine.upbound.io/v1beta1, kind=pvc  Successfully requested creation of external resource
  Warning  CannotObserveExternalResource  19s (x7 over 87s)  managed/cce.flexibleengine.upbound.io/v1beta1, kind=pvc  cannot run plan: plan failed: Instance cannot be destroyed: Resource flexibleengine_cce_pvc.example-cce-pvc has lifecycle.prevent_destroy set, but the plan calls for this resource to be destroyed. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or reduce the scope of the plan using the -target flag.

@azrod azrod linked a pull request Jan 17, 2023 that will close this issue
1 task
@azrod azrod removed a link to a pull request Jan 17, 2023
1 task
@azrod azrod self-assigned this Jan 17, 2023
azrod added a commit that referenced this issue Jan 17, 2023
* feat(cce/pvc): ignore CCE PVC Resource #51

* fix(cce/pvc): conflict ignoredResource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/cce Resource category CCE upjet-issue
Projects
None yet
Development

No branches or pull requests

2 participants