public static ReflectorProperties GetReflectionProperties(this V1ObjectMeta metadata)
    {
        return(new ReflectorProperties
        {
            Version = metadata.ResourceVersion,

            Allowed = metadata.SafeAnnotations()
                      .TryGet(Annotations.Reflection.Allowed, out bool allowed) && allowed,
            AllowedNamespaces = metadata.SafeAnnotations()
                                .TryGet(Annotations.Reflection.AllowedNamespaces, out string?allowedNamespaces)
                ? allowedNamespaces ?? string.Empty
                : string.Empty,
            AutoEnabled = metadata.SafeAnnotations()
                          .TryGet(Annotations.Reflection.AutoEnabled, out bool autoEnabled) && autoEnabled,
            AutoNamespaces = metadata.SafeAnnotations()
                             .TryGet(Annotations.Reflection.AutoNamespaces, out string?autoNamespaces)
                ? autoNamespaces ?? string.Empty
                : string.Empty,
            Reflects = metadata.SafeAnnotations()
                       .TryGet(Annotations.Reflection.Reflects, out string?metaReflects)
                ? string.IsNullOrWhiteSpace(metaReflects) ? KubeRef.Empty :
                       KubeRef.TryParse(metaReflects, out var metaReflectsRef) ? metaReflectsRef.Namespace == string.Empty
                    ? new KubeRef(metadata.NamespaceProperty, metaReflectsRef.Name)
                    : metaReflectsRef : KubeRef.Empty
                : KubeRef.Empty,
            IsAutoReflection = metadata.SafeAnnotations()
                               .TryGet(Annotations.Reflection.MetaAutoReflects, out bool metaAutoReflects) && metaAutoReflects,
            ReflectedVersion = metadata.SafeAnnotations()
                               .TryGet(Annotations.Reflection.MetaReflectedVersion, out string?reflectedVersion)
                ? string.IsNullOrWhiteSpace(reflectedVersion) ? string.Empty : reflectedVersion
                : string.Empty
        });
Beispiel #2
0
 protected override Task <V1Secret> OnResourceGet(KubeRef refId)
 {
     return(Client.ReadNamespacedSecretAsync(refId.Name, refId.Namespace));
 }
Beispiel #3
0
 protected override Task OnResourceDelete(KubeRef resourceId)
 {
     return(Client.DeleteNamespacedSecretAsync(resourceId.Name, resourceId.Namespace));
 }
Beispiel #4
0
 protected override Task OnResourceApplyPatch(V1Patch patch, KubeRef refId)
 {
     return(Client.PatchNamespacedSecretWithHttpMessagesAsync(patch, refId.Name, refId.Namespace));
 }
 protected override Task <V1ConfigMap> OnResourceGet(KubeRef refId)
 {
     return(Client.ReadNamespacedConfigMapAsync(refId.Name, refId.Namespace));
 }
 protected override Task OnResourceApplyPatch(V1Patch patch, KubeRef refId)
 {
     return(Client.PatchNamespacedConfigMapAsync(patch, refId.Name, refId.Namespace));
 }