@soft-stech/fleet
Version:
54 lines (53 loc) • 2.29 kB
JavaScript
import { z } from "zod";
import { iObjectMetaSchema } from "@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema";
/**
* ClusterRegistration is used internally by Fleet and should not be used directly.
*/
export const IClusterRegistrationSchema = z.object({
/**
* APIVersion defines the versioned schema of this representation of an object.
* Servers should convert recognized schemas to the latest internal value, and
* may reject unrecognized values.
* More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
*/
"apiVersion": z.literal("fleet.cattle.io/v1alpha1"),
/**
* Kind is a string value representing the REST resource this object represents.
* Servers may infer this from the endpoint the client submits requests to.
* Cannot be updated.
* In CamelCase.
* More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
*/
"kind": z.literal("ClusterRegistration"),
"metadata": iObjectMetaSchema.optional(),
"spec": z.object({
/**
* ClientID is a unique string that will identify the cluster. The
* agent either uses the configured ID or the kubeSystem.UID.
*/
"clientID": z.string().optional(),
/**
* ClientRandom is a random string that the agent generates. When
* fleet-controller grants a registration, it creates a registration
* secret with this string in the name.
*/
"clientRandom": z.string().optional(),
/**
* ClusterLabels are copied to the cluster resource during the registration.
*/
"clusterLabels": z.record(z.string()).optional()
}).optional(),
"status": z.object({
/**
* ClusterName is only set after the registration is being processed by
* fleet-controller.
*/
"clusterName": z.string().optional(),
/**
* Granted is set to true, if the request service account is present
* and its token secret exists. This happens directly before creating
* the registration secret, roles and rolebindings.
*/
"granted": z.boolean().optional()
}).optional()
});