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

feat(crossplane-cli): during apply check XRs with crossplane beta trace #22

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

haarchri
Copy link
Contributor

Description of your changes

Fixes: upbound/official-providers-ci#177

Added a option with crossplane cli to trace all applied XRs during the assert process, making it easier to identify any resources with issues - instead searching all logs.

For compatibility, if the CROSSPLANE_CLI environment variable is not set, this command will be skipped.

Without CROSSPLANE_CLI:
The trace step is skipped, and the assert proceeds with the other test steps.

cat Makefile
[...]
SKIP_DELETE ?=
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
	@$(INFO) running automated tests
	@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 $(SKIP_DELETE) || $(FAIL)
	@$(OK) running automated tests
[...]
    logger.go:42: 17:13:44 | case/0-apply | role.iam.aws.upbound.io/configuration-aws-eks-jh67d annotated
    logger.go:42: 17:13:44 | case/0-apply | role.iam.aws.upbound.io/configuration-aws-eks-r84lv annotated
    logger.go:42: 17:13:44 | case/0-apply | openidconnectprovider.iam.aws.upbound.io/configuration-aws-eks-c5gm6 annotated
    logger.go:42: 17:13:44 | case/0-apply | running command: [sh -c if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi]
    logger.go:42: 17:13:44 | case/0-apply | running command: [sh -c echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml]
    logger.go:42: 17:13:44 | case/0-apply | Dump MR manifests for the apply assertion step:
    logger.go:42: 17:13:45 | case/0-apply | apiVersion: v1
    logger.go:42: 17:13:45 | case/0-apply | items:
    logger.go:42: 17:13:45 | case/0-apply | - apiVersion: ec2.aws.upbound.io/v1beta2
    logger.go:42: 17:13:45 | case/0-apply |   kind: Route
    logger.go:42: 17:13:45 | case/0-apply |   metadata:
[...]

With CROSSPLANE_CLI:
The script traces each composite resource to help identify any issues during the apply step.

cat Makefile
[...]
SKIP_DELETE ?=
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
	@$(INFO) running automated tests
	@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) CROSSPLANE_CLI=$(CROSSPLANE_CLI) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 $(SKIP_DELETE) || $(FAIL)
	@$(OK) running automated tests
[...]
    logger.go:42: 17:14:49 | case/0-apply | role.iam.aws.upbound.io/configuration-aws-eks-r84lv annotated
    logger.go:42: 17:14:49 | case/0-apply | openidconnectprovider.iam.aws.upbound.io/configuration-aws-eks-c5gm6 annotated
    logger.go:42: 17:14:49 | case/0-apply | running command: [sh -c if [ -n "${CROSSPLANE_CLI}" ]; then ${KUBECTL} get composite --no-headers -o name | while read -r comp; do [ -n "$comp" ] && ${CROSSPLANE_CLI} beta trace "$comp"; done; fi]
    logger.go:42: 17:14:49 | case/0-apply | NAME                                                     SYNCED   READY   STATUS
    logger.go:42: 17:14:49 | case/0-apply | XEKS/configuration-aws-eks                               True     False   Creating: Unready resources: access-entry, accessPolicyAssociation
    logger.go:42: 17:14:49 | case/0-apply | ├─ SecurityGroup/configuration-aws-eks-rf92h             True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ AccessEntry/configuration-aws-eks-gt7x2               False    False   ReconcileError: ...me system:masters is invalid, it cannot start with system:  []}]
    logger.go:42: 17:14:49 | case/0-apply | ├─ AccessPolicyAssociation/configuration-aws-eks-p75g9   False    -       ReconcileError: ...enced field was empty (referenced resource may not yet be ready)
    logger.go:42: 17:14:49 | case/0-apply | ├─ Addon/configuration-aws-eks-cni-addon                 True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Addon/configuration-aws-eks-ebs-csi-addon             True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Addon/configuration-aws-eks-pod-identity-addon        True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ ClusterAuth/configuration-aws-eks-kwk7z               True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Cluster/configuration-aws-eks-tltlw                   True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ NodeGroup/configuration-aws-eks-zslkz                 True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ ProviderConfig/configuration-aws-eks                  -        -       
    logger.go:42: 17:14:49 | case/0-apply | ├─ OpenIDConnectProvider/configuration-aws-eks-c5gm6     True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Role/configuration-aws-eks-jh67d                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Role/configuration-aws-eks-r84lv                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | └─ ProviderConfig/configuration-aws-eks                  -        -       
    logger.go:42: 17:14:49 | case/0-apply | NAME                                                       SYNCED   READY   STATUS
    logger.go:42: 17:14:49 | case/0-apply | XNetwork/configuration-aws-eks                             True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ InternetGateway/configuration-aws-eks-kr8w9             True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ MainRouteTableAssociation/configuration-aws-eks-mqqpp   True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ RouteTableAssociation/configuration-aws-eks-fk88f       True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ RouteTableAssociation/configuration-aws-eks-kzk7r       True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ RouteTableAssociation/configuration-aws-eks-p8w4h       True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ RouteTableAssociation/configuration-aws-eks-px74m       True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ RouteTable/configuration-aws-eks-njz4v                  True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Route/configuration-aws-eks-gf86p                       True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ SecurityGroupRule/configuration-aws-eks-lpbvs           True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ SecurityGroupRule/configuration-aws-eks-nwr8h           True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ SecurityGroup/configuration-aws-eks-kccqv               True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Subnet/configuration-aws-eks-8gs2t                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Subnet/configuration-aws-eks-clxpj                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Subnet/configuration-aws-eks-fkndp                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | ├─ Subnet/configuration-aws-eks-ngt4k                      True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | └─ VPC/configuration-aws-eks-hwmsr                         True     True    Available
    logger.go:42: 17:14:49 | case/0-apply | running command: [sh -c echo "Dump MR manifests for the apply assertion step:"; ${KUBECTL} get managed -o yaml]
    logger.go:42: 17:14:49 | case/0-apply | Dump MR manifests for the apply assertion step:
[...]

Fixes #

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

… trace the XRs to get an easier overview

Signed-off-by: Christopher Haar <[email protected]>
Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @haarchri LGTM!

@sergenyalcin sergenyalcin merged commit 15cbf92 into crossplane:main Aug 22, 2024
6 checks passed
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.

uptest use crossplane beta trace
2 participants