Closed rvowles closed 1 year ago
I forgot to add the last step:
$ kubectl port-forward --namespace=localstack svc/localstack 4566 $ aws --endpoint=http://localhost:4566/ s3 ls
The bucket is appearing to be synced and ready in kubectl get buckets
but it is not in localstack as it keeps getting deleted immediately after creation. I have tried with localstack latest, 1..0.4, 1.0.3 and 0.14.5 - same commands are being issued with the same effect. I'm going to try swapping back to 0.27.1 of this provider next.
We have given up on crossplane as it is too unreliable
I am using 0.30.0 and I tried 0.29.0 as well. I will move back to 0.27 after lodging this ticket. The issue is that even creating a simple bucket, there is an endless loop of create & delete of the bucket:
then it starts all over again. I tried this on two Mac machines, an Intel and an M1.
=== Install kind:
[source,bash]
kind create cluster --name cplane
=== Install localstack
save a new
localstack-values.yml
override file (localstack starts up too slowly and keeps crashing):[source,yml]
livenessProbe: initialDelaySeconds: 0 periodSeconds: 100 timeoutSeconds: 1 successThreshold: 1 failureThreshold: 3
[source,bash]
kubectl create namespace localstack helm repo add localstack-repo https://helm.localstack.cloud helm upgrade --install localstack localstack-repo/localstack --namespace localstack -f ./localstack-values.yml
=== Install crossplane
kubectl create namespace crossplane-system helm repo add crossplane-stable https://charts.crossplane.io/stable helm repo update helm install crossplane --namespace crossplane-system crossplane-stable/crossplane
Install the crossplane kubectl extensions (if haven't already):
$ curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh $ sudo mv kubectl-crossplane /usr/local/bin
Install the crossplane AWS provider:
$ kubectl crossplane install provider crossplane/provider-aws:v0.30.0
save this as
localstack-provider.yml
and thenkubectl apply -f
it [source,yaml]AWS credentials secret
apiVersion: v1 kind: Secret metadata: name: localstack-creds namespace: crossplane-system type: Opaque data:
This is just test/test.
credentials: W2RlZmF1bHRdCmF3c19hY2Nlc3Nfa2V5X2lkID0gdGVzdAphd3Nfc2VjcmV0X2FjY2Vzc19rZXkgPSB0ZXN0Cg==
AWS provider that references the secret credentials
apiVersion: aws.crossplane.io/v1beta1 kind: ProviderConfig metadata: name: localstack namespace: localstack spec: endpoint: hostnameImmutable: true url: type: Static static: http://localstack.localstack:4566 credentials: source: Secret secretRef: namespace: crossplane-system name: localstack-creds key: credentials
Now try and create a bucket:
kubectl apply -f this:
[source,yaml]
s3 bucket
apiVersion: s3.aws.crossplane.io/v1beta1 kind: Bucket metadata: name: flux-test-bucket annotations:
This will be the actual bucket name. It must be globally unique
spec: forProvider: locationConstraint: ap-southeast-2 acl: private publicAccessBlockConfiguration: blockPublicPolicy: true accelerateConfiguration: status: Enabled versioningConfiguration: status: Enabled tagging: tagSet:
You can simplify it to just the locationConstraint and the acl, but it doesn't make any difference.
it should come up using
kubectl get buckets
.NAME READY SYNCED AGE flux-test-bucket True True 37m
Do
kubectl port-forward --namespace localstack svc/localstack 4566
on a terminal to create a link to localstack and thenaws --endpoint=http://localhost:4566 s3 ls
- it might appear and then it will disappear, and never come back.The error occurring in the logs I did see:
1.6605294868661654e+09 DEBUG events Normal {"object": {"kind":"Bucket","name":"flux-test-bucket","uid":"312a0367-46d3-4fe5-8ca5-828cf322b454","apiVersion":"s3.aws.crossplane.io/v1beta1","resourceVersion":"17669"}, "reason": "UpdatedExternalResource", "message": "Successfully requested update of external resource"} 1.6605294868733933e+09 ERROR controller.managed/bucket.s3.aws.crossplane.io Reconciler error {"reconciler group": "s3.aws.crossplane.io", "reconciler kind": "Bucket", "name": "flux-test-bucket", "namespace": "", "error": "cannot update managed resource status: Operation cannot be fulfilled on buckets.s3.aws.crossplane.io \"flux-test-bucket\": the object has been modified; please apply your changes to the latest version and try again"} sigs.k8s.io/controller-runtime/pkg/internal/controller.(Controller).processNextWorkItem /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266 sigs.k8s.io/controller-runtime/pkg/internal/controller.(Controller).Start.func2.2 /home/runner/work/provider-aws/provider-aws/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227 1.6605294868737316e+09 DEBUG provider-aws Reconciling {"controller": "managed/bucket.s3.aws.crossplane.io", "request": "/flux-test-bucket"} 1.6605294870281725e+09 DEBUG provider-aws External resource is up to date {"controller": "managed/bucket.s3.aws.crossplane.io", "request": "/flux-test-bucket", "uid": "312a0367-46d3-4fe5-8ca5-828cf322b454", "version": "17670", "external-name": "flux-test-bucket", "requeue-after": 1660529547.0281692} 1.66