Skip to content

Commit

Permalink
Merge pull request #129 from layer5io/bug/install
Browse files Browse the repository at this point in the history
fixes for namespace deployment
  • Loading branch information
leecalcote authored Oct 12, 2020
2 parents b7084c0 + 2b2f593 commit 3ea5e3f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions linkerd/linkerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ func (iClient *Client) applyConfigChange(ctx context.Context, deploymentYAML, na
data := &unstructured.Unstructured{}
data.SetUnstructuredContent(unstructuredObj)
logrus.Debug(unstructuredObj)
if len(data.GetNamespace()) > 2 {
namespace = data.GetNamespace()
}

if mapping.Scope.Name() == "root" {
if deleteOpts {
Expand Down Expand Up @@ -669,7 +672,8 @@ func (iClient *Client) applyConfigChange(ctx context.Context, deploymentYAML, na
}
err = iClient.k8sDynamicClient.Resource(mapping.Resource).Namespace(namespace).Delete(data.GetName(), deleteOptions)
if err != nil && !kubeerror.IsNotFound(err) {
logrus.Error(fmt.Sprintf("Delete the %s %s in namespace %s failed", data.GetObjectKind().GroupVersionKind().Kind, data.GetName(), namespace))
errors.Wrapf(err, fmt.Sprintf("Delete the %s %s in namespace %s failed", data.GetObjectKind().GroupVersionKind().Kind, data.GetName(), namespace))
logrus.Error(err)
return err
}

Expand All @@ -678,7 +682,8 @@ func (iClient *Client) applyConfigChange(ctx context.Context, deploymentYAML, na
} else {
_, err = iClient.k8sDynamicClient.Resource(mapping.Resource).Namespace(namespace).Create(data, metav1.CreateOptions{})
if err != nil && !kubeerror.IsAlreadyExists(err) {
logrus.Error(fmt.Sprintf("Create the %s %s in namespace %s failed", data.GetObjectKind().GroupVersionKind().Kind, data.GetName(), namespace))
err = errors.Wrapf(err, fmt.Sprintf("Create the %s %s in namespace %s failed", data.GetObjectKind().GroupVersionKind().Kind, data.GetName(), namespace))
logrus.Error(err)
return err
}
logrus.Info(fmt.Sprintf("Create the %s %s in namespace %s succeed", data.GetObjectKind().GroupVersionKind().Kind, data.GetName(), namespace))
Expand Down

0 comments on commit 3ea5e3f

Please sign in to comment.