-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14239 from marun/enable-federation
Merged by openshift-bot
- Loading branch information
Showing
10 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration | ||
"k8s.io/kubernetes/pkg/util/logs" | ||
_ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration | ||
|
||
"github.com/openshift/origin/pkg/federation/kubefed" | ||
) | ||
|
||
func main() { | ||
logs.InitLogs() | ||
defer logs.FlushLogs() | ||
|
||
cmd := kubefed.NewKubeFedCommand(os.Stdin, os.Stdout, os.Stderr) | ||
if err := cmd.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# This is the OpenShift Origin Federation image, used for running the | ||
# federation apiserver and controller manager components. | ||
# | ||
# The standard name for this image is openshift/origin-federation | ||
# | ||
FROM openshift/origin-base | ||
|
||
RUN INSTALL_PKGS="origin-federation-services" && \ | ||
yum install -y ${INSTALL_PKGS} && \ | ||
rpm -V ${INSTALL_PKGS} && \ | ||
yum clean all && \ | ||
ln -s /usr/bin/hyperkube /hyperkube | ||
|
||
LABEL io.k8s.display-name="OpenShift Origin Federation" \ | ||
io.k8s.description="This is a component of OpenShift Origin and contains the software for running federation servers." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package kubefed | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"k8s.io/apiserver/pkg/util/flag" | ||
"k8s.io/client-go/tools/clientcmd" | ||
"k8s.io/kubernetes/federation/pkg/kubefed" | ||
kubefedinit "k8s.io/kubernetes/federation/pkg/kubefed/init" | ||
"k8s.io/kubernetes/federation/pkg/kubefed/util" | ||
kubectl "k8s.io/kubernetes/pkg/kubectl/cmd" | ||
"k8s.io/kubernetes/pkg/kubectl/cmd/templates" | ||
|
||
"github.com/openshift/origin/pkg/cmd/cli/cmd" | ||
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" | ||
"github.com/openshift/origin/pkg/version" | ||
) | ||
|
||
// This file was copied from vendor/k8s.io/kubernetes/federation/pkg/kubefed and | ||
// modified to support the openshift version command as per the inline comments. | ||
|
||
var ( | ||
// serverImageName is the name of the default image (without version) | ||
// used for the federation services (api and controller manager). It | ||
// should be set during build via -ldflags. | ||
serverImageName string | ||
|
||
// defaultEtcImage is the default image (including version) used to run | ||
// etcd for the federation apiserver. It should be set during build via | ||
// -ldflags. | ||
defaultEtcdImage string | ||
) | ||
|
||
// NewKubeFedCommand creates the `kubefed` command and its nested children. | ||
func NewKubeFedCommand(in io.Reader, out, err io.Writer) *cobra.Command { | ||
defaultServerImage := fmt.Sprintf("%s:%s", serverImageName, version.Get()) | ||
|
||
// Parent command to which all subcommands are added. | ||
cmds := &cobra.Command{ | ||
Use: "kubefed", | ||
Short: "kubefed controls an OpenShift Cluster Federation", | ||
Long: templates.LongDesc(` | ||
kubefed controls an OpenShift Cluster Federation. | ||
Find more information at https://github.com/openshift/origin.`), | ||
Run: runHelp, | ||
} | ||
|
||
// Use an openshift command factory to ensure CmdNewVersion will work. | ||
// It is interface compatible with the kube equivalent, so any calls to | ||
// kube code will continue to work. | ||
f := osclientcmd.New(cmds.PersistentFlags()) | ||
|
||
// From this point and forward we get warnings on flags that contain "_" separators | ||
cmds.SetGlobalNormalizationFunc(flag.WarnWordSepNormalizeFunc) | ||
|
||
groups := templates.CommandGroups{ | ||
{ | ||
Message: "Basic Commands:", | ||
Commands: []*cobra.Command{ | ||
kubefedinit.NewCmdInit(out, util.NewAdminConfig(clientcmd.NewDefaultPathOptions()), defaultServerImage, defaultEtcdImage), | ||
kubefed.NewCmdJoin(f, out, util.NewAdminConfig(clientcmd.NewDefaultPathOptions())), | ||
kubefed.NewCmdUnjoin(f, out, err, util.NewAdminConfig(clientcmd.NewDefaultPathOptions())), | ||
}, | ||
}, | ||
} | ||
groups.Add(cmds) | ||
|
||
filters := []string{ | ||
"options", | ||
} | ||
templates.ActsAsRootCommand(cmds, filters, groups...) | ||
|
||
// Use the openshift-specific version command | ||
cmds.AddCommand(cmd.NewCmdVersion("kubefed", f, out, cmd.VersionOptions{PrintClientFeatures: true})) | ||
|
||
cmds.AddCommand(kubectl.NewCmdOptions(out)) | ||
|
||
return cmds | ||
} | ||
|
||
func runHelp(cmd *cobra.Command, args []string) { | ||
cmd.Help() | ||
} |
10 changes: 9 additions & 1 deletion
10
vendor/k8s.io/kubernetes/federation/cmd/kubefed/app/kubefed.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.