func (p NativeSyncProvider) GetRevision(ctx context.Context) (string, error) {
	resource, err := p.resourceAPI.Get(ctx, p.resourceName, meta_v1.GetOptions{})
	if err != nil {
		return "", err
	}
	revision, exists := resource.Annotations[syncMarkerKey]
	if !exists {
		return "", p.setRevision(ctx, "")
	}
	return revision, nil
}
GetRevision gets the revision of the current sync marker (representing the place flux has synced to).
package sync
import (
	"context"
	"encoding/json"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	kubernetes "k8s.io/client-go/kubernetes"
	v1 "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/rest"
)
const syncMarkerKey = "flux.weave.works/sync-hwm"
type NativeSyncProvider struct {
	namespace    string
	revision     string
	resourceName string
	resourceAPI  v1.SecretInterface
}
func NewNativeSyncProvider(namespace string, resourceName string) (NativeSyncProvider, error) {
	config, err := rest.InClusterConfig()
	if err != nil {
		return NativeSyncProvider{}, err
	}
	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return NativeSyncProvider{}, err
	}
	return NativeSyncProvider{
		resourceAPI:  clientset.CoreV1().Secrets(namespace),
		namespace:    namespace,
		resourceName: resourceName,
	}, nil
}
func (p NativeSyncProvider) String() string {
	return "kubernetes " + p.namespace + ":secret/" + p.resourceName
}