hello: How do we enable dataplane in GKE autopilot...
# google-cloud
h
hello: How do we enable dataplane in GKE autopilot? I am using gcp classic provider but did not see an config to do that.
n
This is how I do it (with
Go
)
Copy code
// EnableManagedControlPlane activates some hub functions that cannot be used because of bugs
// with the gkehub pulumi module as of today.
func (sm *ServiceMesh) EnableManagedControlPlane() error {
	_, err := local.NewCommand(
		sm.Context, "mesh-auto-control-plane", &local.CommandArgs{
			Create: pulumi.Sprintf(
				`gcloud alpha container hub mesh update \
					--control-plane automatic \
					--membership %s \
					--project %s
				`,
				sm.Outputs.ClusterName.ApplyT(
					func(s interface{}) string {
						return s.(string)
					},
				).(pulumi.StringOutput),
				sm.Config.Get("project"),
			),
			// @todo implement DELETE
		},
	)
	if err != nil {
		return fmt.Errorf(
			"EnableManagedControlPlane: could not apply auto control plane for membership name %s: %w",
			sm.Outputs.ClusterName.ApplyT(
				func(s interface{}) string {
					return s.(string)
				},
			),
			err,
		)
	}

	return nil
}
Not perfect, but works like a charm!