Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractStringValueFromMap(mapName map[string]string, key string) string
- func GetClusterUserNamespacesNames(clusterUserNamespaces map[string][]v1.Namespace) []*api.ClusterNamespaceList
- func GetTenant(namespace, clusterName string, clusterUserNamespaces map[string][]v1.Namespace) string
- func Hydrate(ctx context.Context, mux *runtime.ServeMux, cfg CoreServerConfig) error
- func NewCoreServer(cfg CoreServerConfig) (pb.CoreServer, error)
- func ResourceRefToUnstructured(id, version string) (unstructured.Unstructured, error)
- type CoreServerConfig
- type KnownTypes
- type ObjectWithChildren
- type PodLog
- type PrimaryKinds
Constants ¶
const (
DefaultCluster = "Default"
)
const DefaultValidationType = "Admission"
const (
FluxNamespacePartOf = "flux"
)
const SuspendedByAnnotation = "metadata.weave.works/suspended-by"
const SuspendedCommentAnnotation = "metadata.weave.works/suspended-comment"
Variables ¶
var ( KustomizeNameKey = fmt.Sprintf("%s/name", kustomizev1.GroupVersion.Group) KustomizeNamespaceKey = fmt.Sprintf("%s/namespace", kustomizev1.GroupVersion.Group) HelmNameKey = fmt.Sprintf("%s/name", helmv2.GroupVersion.Group) HelmNamespaceKey = fmt.Sprintf("%s/namespace", helmv2.GroupVersion.Group) // ErrFluxNamespaceNotFound no flux namespace found ErrFluxNamespaceNotFound = errors.New("could not find flux namespace in cluster") // ErrListingDeployments no deployments found ErrListingDeployments = errors.New("could not list deployments in namespace") DefaultFluxNamespace = lookupEnv("WEAVE_GITOPS_FALLBACK_NAMESPACE", "flux-system") )
var ( Version = "v0.0.0" GitCommit = "" Branch = "" Buildtime = "" )
Variables that we'll set @ build time
Functions ¶
func ExtractStringValueFromMap ¶ added in v0.25.0
ExtractValueFromMap gets string value from map or empty string if the value is empty
func GetClusterUserNamespacesNames ¶ added in v0.31.0
func GetClusterUserNamespacesNames(clusterUserNamespaces map[string][]v1.Namespace) []*api.ClusterNamespaceList
func NewCoreServer ¶
func NewCoreServer(cfg CoreServerConfig) (pb.CoreServer, error)
func ResourceRefToUnstructured ¶ added in v0.36.0
func ResourceRefToUnstructured(id, version string) (unstructured.Unstructured, error)
ResourceRefToUnstructured converts a flux like resource entry pair of (id, version) into a unstructured object
Types ¶
type CoreServerConfig ¶
type CoreServerConfig struct { RestCfg *rest.Config NSAccess nsaccess.Checker ClustersManager clustersmngr.ClustersManager PrimaryKinds *PrimaryKinds CRDService crd.Fetcher HealthChecker health.HealthChecker // contains filtered or unexported fields }
func NewCoreConfig ¶
func NewCoreConfig(log logr.Logger, cfg *rest.Config, clusterName string, clustersManager clustersmngr.ClustersManager, healthChecker health.HealthChecker) (CoreServerConfig, error)
type KnownTypes ¶ added in v0.29.0
type KnownTypes interface {
AllKnownTypes() map[schema.GroupVersionKind]reflect.Type
}
type ObjectWithChildren ¶ added in v0.36.0
type ObjectWithChildren struct { Object *unstructured.Unstructured Children []*ObjectWithChildren }
ObjectWithChildren is a recursive data structure containing a tree of Unstructured values.
func GetObjectsWithChildren ¶ added in v0.36.0
func GetObjectsWithChildren(ctx context.Context, objects []*unstructured.Unstructured, k8sClient client.Client, withChildren bool, logger logr.Logger) ([]*ObjectWithChildren, error)
GetObjectsWithChildren returns objects with their children populated if withChildren is true. Objects are retrieved in parallel. Children are retrieved recusively, e.g. Deployment -> ReplicaSet -> Pod
type PodLog ¶ added in v0.17.0
type PodLog struct { Date time.Time `json:"date"` Time time.Time `json:"time"` Log string `json:"log"` Msg string `json:"msg"` Level string `json:"level"` Kubernetes struct { PodName string `json:"pod_name"` NamespaceName string `json:"namespace_name"` PodID string `json:"pod_id"` Labels map[string]string `json:"labels"` Annotations map[string]string `json:"annotations"` Host string `json:"host"` ContainerName string `json:"container_name"` DockerID string `json:"docker_id"` ContainerHash string `json:"container_hash"` ContainerImage string `json:"container_image"` } `json:"kubernetes"` }
type PrimaryKinds ¶ added in v0.9.1
type PrimaryKinds struct {
// contains filtered or unexported fields
}
func DefaultPrimaryKinds ¶ added in v0.9.1
func DefaultPrimaryKinds() (*PrimaryKinds, error)
DefaultPrimaryKinds generates a new PrimaryKinds object which contains the highest version of each kind of known types from a Kubernetes scheme. It returns the PrimaryKinds object and any error that occurred.
func New ¶ added in v0.9.1
func New() *PrimaryKinds
func (*PrimaryKinds) Add ¶ added in v0.9.1
func (pk *PrimaryKinds) Add(kind string, gvk schema.GroupVersionKind) error
Add sets another kind name and gvk to resolve an object. This function returns an error if the kind is already set, as this likely indicates 2 different uses for the same kind string.
func (*PrimaryKinds) Lookup ¶ added in v0.9.1
func (pk *PrimaryKinds) Lookup(kind string) (*schema.GroupVersionKind, error)
Lookup ensures that a kind name is known, white-listed, and returns the full GVK for that kind