Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nakamasato/5befe621053a29e67ad713686d7b9e12 to your computer and use it in GitHub Desktop.
Save nakamasato/5befe621053a29e67ad713686d7b9e12 to your computer and use it in GitHub Desktop.
func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("memcached", req.NamespacedName)
// 1. Fetch the Memcached instance
memcached := &cachev1alpha1.Memcached{}
err := r.Get(ctx, req.NamespacedName, memcached)
if err != nil {
if errors.IsNotFound(err) {
log.Info("1. Fetch the Memcached instance. Memcached resource not found. Ignoring since object must be deleted")
return ctrl.Result{}, nil
}
// Error reading the object - requeue the request.
log.Error(err, "1. Fetch the Memcached instance. Failed to get Mmecached")
return ctrl.Result{}, err
}
log.Info("1. Fetch the Memcached instance. Memchached resource found", "memcached.Name", memcached.Name, "memcached.Namespace", memcached.Namespace)
return ctrl.Result{}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment