@ -339,7 +339,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) {
err = perform ( tinfos , func ( info * resource . Info ) error {
err = perform ( tinfos , func ( info * resource . Info ) error {
mux . Lock ( )
mux . Lock ( )
defer mux . Unlock ( )
defer mux . Unlock ( )
c . Log ( "Doing get for %s: %q ", info . Mapping . GroupVersionKind . Kind , info . Nam e)
c . Log ( "Doing get for %s: %q in %q ", info . Mapping . GroupVersionKind . Kind , info . Nam e, info . Namespac e)
if err := info . Get ( ) ; err != nil {
if err := info . Get ( ) ; err != nil {
c . Log ( "WARNING: Failed Get for resource %q: %s" , info . Name , err )
c . Log ( "WARNING: Failed Get for resource %q: %s" , info . Name , err )
missing = append ( missing , fmt . Sprintf ( "%v\t\t%s" , info . Mapping . Resource , info . Name ) )
missing = append ( missing , fmt . Sprintf ( "%v\t\t%s" , info . Mapping . Resource , info . Name ) )
@ -515,7 +515,7 @@ func (c *Client) UpdateWithOptions(namespace string, originalReader, targetReade
newlyCreatedResources = append ( newlyCreatedResources , info )
newlyCreatedResources = append ( newlyCreatedResources , info )
kind := info . Mapping . GroupVersionKind . Kind
kind := info . Mapping . GroupVersionKind . Kind
c . Log ( "Created a new %s called %q \n", kind , info . Nam e)
c . Log ( "Created a new %s called %q in %s \n", kind , info . Nam e, info . Namespac e)
return nil
return nil
}
}
@ -528,9 +528,10 @@ func (c *Client) UpdateWithOptions(namespace string, originalReader, targetReade
// See https://github.com/helm/helm/issues/1193 for more info.
// See https://github.com/helm/helm/issues/1193 for more info.
if originalInfo == nil {
if originalInfo == nil {
return fmt . Errorf (
return fmt . Errorf (
"kind %s with the name %q already exists in the cluster and wasn't defined in the previous release. Before upgrading, please either delete the resource from the cluster or remove it from the chart",
"kind %s with the name %q in %q already exists in the cluster and wasn't defined in the previous release. Before upgrading, please either delete the resource from the cluster or remove it from the chart",
info . Mapping . GroupVersionKind . Kind ,
info . Mapping . GroupVersionKind . Kind ,
info . Name ,
info . Name ,
info . Namespace ,
)
)
}
}
@ -846,7 +847,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
return fmt . Errorf ( "failed to create patch: %s" , err )
return fmt . Errorf ( "failed to create patch: %s" , err )
}
}
if patch == nil {
if patch == nil {
c . Log ( "Looks like there are no changes for %s %q ", target . Mapping . GroupVersionKind . Kind , target . Nam e)
c . Log ( "Looks like there are no changes for %s %q in %q ", target . Mapping . GroupVersionKind . Kind , target . Nam e, target . Namespac e)
// This needs to happen to make sure that tiller has the latest info from the API
// This needs to happen to make sure that tiller has the latest info from the API
// Otherwise there will be no labels and other functions that use labels will panic
// Otherwise there will be no labels and other functions that use labels will panic
if err := target . Get ( ) ; err != nil {
if err := target . Get ( ) ; err != nil {
@ -859,20 +860,20 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
obj , err := helper . Patch ( target . Namespace , target . Name , patchType , patch , nil )
obj , err := helper . Patch ( target . Namespace , target . Name , patchType , patch , nil )
if err != nil {
if err != nil {
kind := target . Mapping . GroupVersionKind . Kind
kind := target . Mapping . GroupVersionKind . Kind
log . Printf ( "Cannot patch %s: %q (%v)", kind , target . Nam e, err )
log . Printf ( "Cannot patch %s: %q in %q (%v)", kind , target . Nam e, target . Namespac e, err )
if force {
if force {
// Attempt to delete...
// Attempt to delete...
if err := deleteResource ( target ) ; err != nil {
if err := deleteResource ( target ) ; err != nil {
return err
return err
}
}
log . Printf ( "Deleted %s: %q ", kind , target . Nam e)
log . Printf ( "Deleted %s: %q in %q ", kind , target . Nam e, target . Namespac e)
// ... and recreate
// ... and recreate
if err := createResource ( target ) ; err != nil {
if err := createResource ( target ) ; err != nil {
return fmt . Errorf ( "Failed to recreate resource: %s" , err )
return fmt . Errorf ( "Failed to recreate resource: %s" , err )
}
}
log . Printf ( "Created a new %s called %q \n", kind , target . Nam e)
log . Printf ( "Created a new %s called %q in %s \n", kind , target . Nam e, target . Namespac e)
// No need to refresh the target, as we recreated the resource based
// No need to refresh the target, as we recreated the resource based
// on it. In addition, it might not exist yet and a call to `Refresh`
// on it. In addition, it might not exist yet and a call to `Refresh`
@ -973,7 +974,7 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err
lw := cachetools . NewListWatchFromClient ( info . Client , info . Mapping . Resource . Resource , info . Namespace , selector )
lw := cachetools . NewListWatchFromClient ( info . Client , info . Mapping . Resource . Resource , info . Namespace , selector )
kind := info . Mapping . GroupVersionKind . Kind
kind := info . Mapping . GroupVersionKind . Kind
c . Log ( "Watching for changes to %s %s with timeout of %v", kind , info . Nam e, timeout )
c . Log ( "Watching for changes to %s %s in %s with timeout of %v", kind , info . Nam e, info . Namespac e, timeout )
// What we watch for depends on the Kind.
// What we watch for depends on the Kind.
// - For a Job, we watch for completion.
// - For a Job, we watch for completion.