Last active
September 25, 2020 16:14
-
-
Save nmathew/7f5a357b2f387aab317ec04869f8925c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import projectcontour "github.com/projectcontour/contour/apis/projectcontour/v1" | |
| func getHTTPProxyRule(host string) projectcontour.HTTPProxy { | |
| KubeApiIngressRule := projectcontour.HTTPProxy{ | |
| TypeMeta: metav1.TypeMeta{ | |
| Kind: "HTTPProxy", | |
| APIVersion: "projectcontour.io/v1", | |
| }, | |
| ObjectMeta: metav1.ObjectMeta{ | |
| Name: "kubernetes-api", | |
| Namespace: "kube-system", | |
| }, | |
| Spec: contourapi.HTTPProxySpec{ | |
| VirtualHost: &projectcontour.VirtualHost{ | |
| Fqdn: host, | |
| TLS: &projectcontour.TLS{ | |
| Passthrough: true, | |
| }, | |
| }, | |
| TCPProxy: &projectcontour.TCPProxy{ | |
| Services: []projectcontour.Service{ | |
| { | |
| Name: "kube-api", | |
| Port: 6443, | |
| }, | |
| }, | |
| }, | |
| }, | |
| Status: projectcontour.HTTPProxyStatus{}, | |
| } | |
| return KubeApiIngressRule | |
| } | |
| func (c *Cluster) addKubeAPIService(client client.Client) error { | |
| rule := getHTTPProxyRule(host) | |
| log.Debug("Dump rule %v", rule) | |
| err := client.Create(context.Background(), &rule) | |
| .... | |
| } | |
| this gives an error | |
| Unable to deploy {{HTTPProxy projectcontour.io/v1} {kubernetes-api kube-system 0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []} {0xc000a7d040 [] 0xc000a2b480 []} { {[]} []}}. | |
| Got error: no kind is registered for the type v1.HTTPProxy in scheme "pkg/runtime/scheme.go:101" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment