Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updateMachineStatus: Log changes with ObjectReflectDiff
Because logs like: $ curl -s https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_installer/525/pull-ci-openshift-installer-master-e2e-aws/867/artifacts/e2e-aws/pods/openshift-cluster-api_clusterapi-manager-controllers-76c6686888-brwk4_aws-machine-controller.log.gz | gunzip | tail -n 11 time="2018-10-24T15:08:11Z" level=debug msg="finished calculating AWS status" controller=awsMachine instanceID=i-0d6c4a1b08ea79f9e machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-0-sjvd8 time="2018-10-24T15:08:11Z" level=info msg="machine status has changed, updating" controller=awsMachine instanceID=i-0d6c4a1b08ea79f9e machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-0-sjvd8 time="2018-10-24T15:08:12Z" level=debug msg="checking if machine exists" controller=awsMachine machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="instance exists as \"i-0de7e801e6cb70ca2\"" controller=awsMachine machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="updating machine" controller=awsMachine machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="obtaining EC2 client for region" controller=awsMachine machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk region=us-east-1 time="2018-10-24T15:08:12Z" level=debug msg="found 1 instances for machine" controller=awsMachine machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="instance found" controller=awsMachine instanceID=i-0de7e801e6cb70ca2 machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="updating status" controller=awsMachine instanceID=i-0de7e801e6cb70ca2 machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=debug msg="finished calculating AWS status" controller=awsMachine instanceID=i-0de7e801e6cb70ca2 machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk time="2018-10-24T15:08:12Z" level=info msg="machine status has changed, updating" controller=awsMachine instanceID=i-0de7e801e6cb70ca2 machine=openshift-cluster-api/ci-op-kgknj8yp-1d3f3-worker-1-vwwqk are pretty opaque without details about what has changed. Among the various diff flavors in the package, I've gone with ObjectReflectDiff to get the most readable output. ObjectDiff (strangely) compares compact JSON, leading to output like: $ curl -s https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_cluster-api-provider-aws/93/pull-ci-openshift-cluster-api-provider-aws-master-e2e-aws/94/artifacts/e2e-aws/pods/openshift-cluster-api_clusterapi-manager-controllers-54f8676476-pzkxz_machine-controller.log.gz | gunzip | tail -n6 time="2018-10-29T23:20:13Z" level=info msg="machine status has changed, updating" controller=awsMachine instanceID=i-0cd71a40aceb4b1c5 machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-0-dltpq time="2018-10-29T23:20:13Z" level=debug msg="changed status:\n{\n\nA: }\n\nB: \"providerStatus\":{\"kind\":\"AWSMachineProviderStatus\",\"apiVersion\":\"awsproviderconfig.k8s.io/v1alpha1\",\"InstanceID\":\"i-0cd71a40aceb4b1c5\",\"InstanceState\":\"running\",\"Conditions\":[{\"Type\":\"MachineCreation\",\"Status\":\"True\",\"LastProbeTime\":\"2018-10-29T23:20:13Z\",\"LastTransitionTime\":\"2018-10-29T23:20:13Z\",\"Reason\":\"MachineCreationSucceeded\",\"Message\":\"machine successfully created\"}]},\"addresses\":[{\"type\":\"InternalIP\",\"address\":\"10.0.139.1\"},{\"type\":\"ExternalDNS\",\"address\":\"\"},{\"type\":\"InternalDNS\",\"address\":\"ip-10-0-139-1.ec2.internal\"}]}\n\n" controller=awsMachine instanceID=i-0cd71a40aceb4b1c5 machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-0-dltpq time="2018-10-29T23:20:13Z" level=debug msg="checking if machine exists" controller=awsMachine machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-1-5qgrt time="2018-10-29T23:20:13Z" level=debug msg="instance exists as \"i-0f0cc95e0b1f619ef\"" controller=awsMachine machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-1-5qgrt time="2018-10-29T23:20:13Z" level=debug msg="updating machine" controller=awsMachine machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-1-5qgrt time="2018-10-29T23:20:13Z" level=debug msg="obtaining EC2 client for region" controller=awsMachine machine=openshift-cluster-api/ci-op-3y5hwj87-d771b-worker-1-5qgrt region=us-east-1 ObjectGoPrintDiff sounds very noisy, although I haven't actually run it to see the output. ObjectGoPrintSideBySide sounds like it takes a lot of space too, and while side-by-side diffs can be useful when printed out, once that output has been wrapped in a string with escaped newlines, etc., I expect it would be pretty hard to skim.
- Loading branch information