Merge pull request #52983 from kubermatic/use-notimplemented-error

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use custom error for "unimplemented"

**What this PR does / why we need it**:
This introduces a new error type `NotImplemented` which is used in cloud-providers to tell that this functionality is not implemented.

Needed for https://github.com/kubernetes/kubernetes/pull/52645 to avoid doing a string comparison.
This commit is contained in:
Kubernetes Submit Queue
2017-09-29 01:05:50 -07:00
committed by GitHub
9 changed files with 18 additions and 22 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package openstack
import (
"errors"
"fmt"
"regexp"
@@ -63,7 +62,7 @@ func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
}
func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {
return errors.New("unimplemented")
return cloudprovider.NotImplemented
}
func (i *Instances) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) {
@@ -117,7 +116,7 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) {
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) {
return false, errors.New("unimplemented")
return false, cloudprovider.NotImplemented
}
// InstanceID returns the kubelet's cloud provider ID.