Merge pull request #28239 from ApsOps/kubectl-expose-headless-svc

Automatic merge from submit-queue

Add a flag for `kubectl expose`to set ClusterIP and allow headless services

- Use `--cluster-ip=None` to create a headless service
- Fixes #10294
This commit is contained in:
k8s-merge-robot
2016-08-02 01:18:19 -07:00
committed by GitHub
5 changed files with 134 additions and 0 deletions

View File

@@ -120,6 +120,7 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {
cmd.Flags().String("overrides", "", "An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.")
cmd.Flags().String("name", "", "The name for the newly created object.")
cmd.Flags().String("session-affinity", "", "If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'")
cmd.Flags().String("cluster-ip", "", "ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.")
usage := "Filename, directory, or URL to a file identifying the resource to expose a service"
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)