in internal/handler/cache.go [143:169]
func (c *CacheHandler) initOperationFromCache(operationName string) *v1alpha1.Operation {
op := &v1alpha1.Operation{}
annotations := op.GetAnnotations()
if annotations == nil {
annotations = map[string]string{}
}
annotations[ctrlutils.AnnotationNameCacheMode] = ctrlutils.AnnotationValueTrue
labels := op.GetLabels()
if labels == nil {
labels = map[string]string{}
}
// TODO: set up requirement label instead
cacheKeyLabelValue := c.cache.Status.CacheKey
if len(c.cache.Status.CacheKey) > 63 {
cacheKeyLabelValue = cacheKeyLabelValue[:63]
}
labels[ctrlutils.LabelNameCacheKey] = cacheKeyLabelValue
op.SetAnnotations(annotations)
op.SetNamespace(c.cache.Namespace)
op.SetName(operationName)
op.SetLabels(labels)
op.Spec = c.cache.Spec.OperationTemplate
return op
}