mirror of https://github.com/kubernetes/kops.git
Merge pull request #3291 from justinsb/baremetal_1
Automatic merge from submit-queue Skeleton bare-metal provider
This commit is contained in:
commit
9ebe302939
|
@ -103,6 +103,7 @@ k8s.io/kops/upup/pkg/fi/assettasks
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup
|
k8s.io/kops/upup/pkg/fi/cloudup
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup/awstasks
|
k8s.io/kops/upup/pkg/fi/cloudup/awstasks
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup/awsup
|
k8s.io/kops/upup/pkg/fi/cloudup/awsup
|
||||||
|
k8s.io/kops/upup/pkg/fi/cloudup/baremetal
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup/cloudformation
|
k8s.io/kops/upup/pkg/fi/cloudup/cloudformation
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup/dnstasks
|
k8s.io/kops/upup/pkg/fi/cloudup/dnstasks
|
||||||
k8s.io/kops/upup/pkg/fi/cloudup/do
|
k8s.io/kops/upup/pkg/fi/cloudup/do
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baremetal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
|
"k8s.io/kubernetes/federation/pkg/dnsprovider"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Cloud struct {
|
||||||
|
dns dnsprovider.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ fi.Cloud = &Cloud{}
|
||||||
|
|
||||||
|
func NewCloud(dns dnsprovider.Interface) (*Cloud, error) {
|
||||||
|
return &Cloud{dns: dns}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Cloud) ProviderID() kops.CloudProviderID {
|
||||||
|
return kops.CloudProviderBareMetal
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Cloud) DNS() (dnsprovider.Interface, error) {
|
||||||
|
return c.dns, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Cloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {
|
||||||
|
return nil, fmt.Errorf("baremetal FindVPCInfo not supported")
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baremetal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Target struct {
|
||||||
|
cloud *Cloud
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ fi.Target = &Target{}
|
||||||
|
|
||||||
|
func NewTarget(cloud *Cloud) *Target {
|
||||||
|
return &Target{cloud: cloud}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Target) Finish(taskMap map[string]fi.Task) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Target) ProcessDeletions() bool {
|
||||||
|
return true
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
|
"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
|
||||||
|
"k8s.io/kops/upup/pkg/fi/cloudup/baremetal"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/do"
|
"k8s.io/kops/upup/pkg/fi/cloudup/do"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/gce"
|
"k8s.io/kops/upup/pkg/fi/cloudup/gce"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/vsphere"
|
"k8s.io/kops/upup/pkg/fi/cloudup/vsphere"
|
||||||
|
@ -121,6 +122,21 @@ func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error) {
|
||||||
cloud = doCloud
|
cloud = doCloud
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case string(kops.CloudProviderBareMetal):
|
||||||
|
{
|
||||||
|
// TODO: Allow dns provider to be specified
|
||||||
|
dns, err := dnsprovider.GetDnsProvider(route53.ProviderName, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Error building (k8s) DNS provider: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
baremetalCloud, err := baremetal.NewCloud(dns)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
cloud = baremetalCloud
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown CloudProvider %q", cluster.Spec.CloudProvider)
|
return nil, fmt.Errorf("unknown CloudProvider %q", cluster.Spec.CloudProvider)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue