Skip to content

Error when trying to apply v1alpha1 using single ServiceAccount with Workload Identity. #98

@w1mvy

Description

@w1mvy

What happened

Upgraded SpannerAutoscaler from v0.2.1 to v0.4.3. I then applied the v1alpha1 changes and got the following error.

The SpannerAutoscaler "spanner-autoscaler" is invalid: spec.serviceAccountSecretRef: Invalid value: "null": spec.serviceAccountSecretRef in body must be of type object: "null"

The v1alpha1 manifest uses single ServiceAccount with Workload Identity as follows. ref

---
apiVersion: spanner.mercari.com/v1alpha1
kind: SpannerAutoscaler
metadata:
  name: spannerautoscaler-sample-alpha
  namespace: test
spec:
  scaleTargetRef:
    projectId: test-project
    instanceId: test-instance
  minNodes: 1
  maxNodes: 4
  maxScaleDownNodes: 2
  targetCPUUtilization:
    highPriority: 80

What you expected to happen

I expect that even v1alpha1 that uses WorkloadIdentity and one ServiceAccount will convert correctly.

When convert from v1alpha1 using single ServiceAccount with Workload Identity to v1beta1, I think that this is due to the fact that AuthTypeADC is not set in spec.authentication.type during conversion, and have made the following fixes.

Please check it and if it looks OK, I will create a Pull Request.

https://github.com/mercari/spanner-autoscaler/compare/master...w1mvy:fix/convertfrom-v1alpha-when-single-sa?expand=1

How to reproduce it

apply v1alpha1 using single ServiceAccount with Workload Identity in env spanner-autoscaler v0.4.3

Environment

  • GKE
  • SpannerAutoscaler: v0.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions