Last active
November 20, 2016 00:07
-
-
Save kozikow/e7952b9560c97454d5816ea94d470c09 to your computer and use it in GitHub Desktop.
Prototype generating config from go code
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
package main | |
import ( | |
"os" | |
"k8s.io/client-go/1.4/pkg/api" | |
"k8s.io/client-go/1.4/pkg/runtime/serializer/json" | |
"k8s.io/client-go/1.4/pkg/util/intstr" | |
) | |
func main() { | |
service := &api.Service{Spec: api.ServiceSpec{Ports: []api.ServicePort{{ | |
Protocol: "TCP", | |
Port: 12346, | |
TargetPort: intstr.FromInt(12346), | |
}}}} | |
e := json.NewYAMLSerializer(json.DefaultMetaFactory, nil, nil) | |
err := e.Encode(service, os.Stdout) | |
if err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment