Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

federation: Adding dnsprovider flags to federation-controller-manager #27158

Merged
merged 1 commit into from
Jun 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions federation/cluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ function create-federation-api-objects {
export FEDERATION_CONTROLLER_MANAGER_IMAGE_REPO="${FEDERATION_PUSH_REPO_BASE}/federation-controller-manager"
export FEDERATION_CONTROLLER_MANAGER_IMAGE_TAG="${FEDERATION_IMAGE_TAG:-$(cat ${KUBE_ROOT}/_output/${KUBE_BUILD_STAGE}/server/${KUBE_PLATFORM}-${KUBE_ARCH}/kubernetes/server/bin/federation-controller-manager.docker_tag)}"

if [[ -z "${FEDERATION_DNS_PROVIDER:-}" ]]; then
# Set the appropriate value based on cloud provider.
if [[ "$KUBERNETES_PROVIDER" == "gce" || "${KUBERNETES_PROVIDER}" == "gke" ]]; then
echo "setting dns provider to google-clouddns"
export FEDERATION_DNS_PROVIDER="google-clouddns"
elif [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
echo "setting dns provider to aws-route53"
export FEDERATION_DNS_PROVIDER="aws-route53"
else
echo "Must set FEDERATION_DNS_PROVIDER env var"
exit 1
fi
fi

export FEDERATION_SERVICE_CIDR=${FEDERATION_SERVICE_CIDR:-"10.10.0.0/24"}

#Only used for providers that require a nodeport service (vagrant for now)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ limitations under the License.
package options

import (
"fmt"
"time"

"github.com/spf13/pflag"

"k8s.io/kubernetes/federation/pkg/dnsprovider"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/client/leaderelection"
Expand All @@ -35,7 +38,7 @@ type ControllerManagerConfiguration struct {
// dnsProvider is the provider for dns services.
DnsProvider string `json:"dnsProvider"`
// dnsConfigFile is the path to the dns provider configuration file.
DnsConfigFile string `json:"ndsConfigFile"`
DnsConfigFile string `json:"dnsConfigFile"`
// concurrentServiceSyncs is the number of services that are
// allowed to sync concurrently. Larger number = more responsive service
// management, but more CPU (and network) load.
Expand Down Expand Up @@ -95,5 +98,7 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "ContentType of requests sent to apiserver. Passing application/vnd.kubernetes.protobuf is an experimental feature now.")
fs.Float32Var(&s.APIServerQPS, "federated-api-qps", s.APIServerQPS, "QPS to use while talking with federation apiserver")
fs.IntVar(&s.APIServerBurst, "federated-api-burst", s.APIServerBurst, "Burst to use while talking with federation apiserver")
fs.StringVar(&s.DnsProvider, "dns-provider", s.DnsProvider, "DNS provider. Valid values are: "+fmt.Sprintf("%q", dnsprovider.RegisteredDnsProviders()))
fs.StringVar(&s.DnsConfigFile, "dns-provider-config", s.DnsConfigFile, "Path to config file for configuring DNS provider.")
leaderelection.BindFlags(&s.LeaderElection, fs)
}
26 changes: 26 additions & 0 deletions federation/cmd/federation-controller-manager/app/plugins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.

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 app

// This file exists to force the desired plugin implementations to be linked.
// This should probably be part of some configuration fed into the build for a
// given binary target.
import (
// DNS providers
_ "k8s.io/kubernetes/federation/pkg/dnsprovider/providers/aws/route53"
_ "k8s.io/kubernetes/federation/pkg/dnsprovider/providers/google/clouddns"
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
command:
- /usr/local/bin/federation-controller-manager
- --master=https://{{.FEDERATION_APISERVER_DEPLOYMENT_NAME}}:443
- --dns-provider={{.FEDERATION_DNS_PROVIDER}}
- --dns-provider-config={{.FEDERATION_DNS_PROVIDER_CONFIG}}
ports:
- containerPort: 443
name: https
Expand Down
11 changes: 11 additions & 0 deletions federation/pkg/dnsprovider/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ func GetDnsProvider(name string, config io.Reader) (Interface, error) {
return f(config)
}

// Returns a list of registered dns providers.
func RegisteredDnsProviders() []string {
registeredProviders := make([]string, len(providers))
i := 0
for provider := range providers {
registeredProviders[i] = provider
i = i + 1
}
return registeredProviders
}

// InitDnsProvider creates an instance of the named DNS provider.
func InitDnsProvider(name string, configFilePath string) (Interface, error) {
var dns Interface
Expand Down
2 changes: 2 additions & 0 deletions hack/verify-flags/known-flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ deserialization-cache-size
dest-file
disable-filter
dns-port
dns-provider
dns-provider-config
docker-email
docker-endpoint
docker-exec-handler
Expand Down