const ( //configmap data ClusterEdgeID = "cluster.edge.id" StoreName = "cluster.name" ClusterType = "cluster.type" FleetType = "cluster.fleet" K8sClusterLocation = "cluster.location" Banner = "edge.banner" TotpSecret = "edge.token" ProjectID = "edge.project.id" ForemanProjectID = "foreman.project.id" BannerID = "banner.id" EdgeAPIEndpoint = "edge.api.endpoint" //edge-info configmap name and ns DefaultEdgeConfigMapNS = "kube-public" EdgeConfigMapName = "edge-info" EdgeBootstrapping = "edge-bootstrap" )
var ( EdgeConfigMapNS = DefaultEdgeConfigMapNS )
func BuildBootstrapSecret(token string) *v1.Secret
BuildBootstrapSecret create edge-info Secret
func BuildConfigMap(projectID, store, storeType, location, banner, fleet, foremanProjectID, bannerID, clusterEdgeID, edgeAPIEndpoint string) *v1.ConfigMap
BuildConfigMap creates an edge-info configmap
func ConfigMapToString(configMap *v1.ConfigMap) ([]byte, error)
ConfigMapToString converts the provided configmap to a string.
func FromSecret(secret *v1.Secret) (string, error)
FromSecret retrieves token from secret
func IsEdgeInfoConfigMap(name, namespace string) bool
IsEdgeInfoConfigMap util function to check if object is edge info config map
func OnConfigMapUpdate(ctx context.Context, cl client.WithWatch, logger logr.Logger, fn func(cfg *EdgeInfo), filters ...string) (kwatch.Interface, error)
OnConfigMapUpdate watches for configmap updates, execute function param if valid configmap and based on optional filters returns a watch ref that can be called to stop the watch `defer watch.Stop()`
func TokenFromClient(ctx context.Context, cl client.Client) (string, error)
TokenFromClient grabs the secret from the cluster
func ValidateConfigMap(cfg *v1.ConfigMap) error
ValidateConfigMap validates edge-info ConfigMap
func ValidateEdgeInfoSecret(secret *v1.Secret) error
ValidateEdgeInfoSecret validates edge-info Secret
type EdgeInfo struct { BannerName string ProjectID string Store string Fleet string ClusterType string Location string ForemanProjectID string BannerEdgeID string ClusterEdgeID string EdgeAPIEndpoint string }
func FromClient(ctx context.Context, cl client.Client) (*EdgeInfo, error)
FromClient grabs the configmap from the cluster
func FromConfigMap(cfg *v1.ConfigMap) *EdgeInfo
FromConfigMap util function to create EdgeInfo from config map
func New(cfg *v1.ConfigMap) (*EdgeInfo, error)
New creates a valid EdgeInfo ref
func (i *EdgeInfo) FromConfigMap(cfg *v1.ConfigMap) *EdgeInfo
FromConfigMap retrieves data from ConfigMap to EdgeInfo
func (i EdgeInfo) ToConfigMap() *v1.ConfigMap
ToConfigMap create edge-info ConfigMap