4545 encoder = runtimejson .NewYAMLSerializer (runtimejson .DefaultMetaFactory , scheme .Scheme , scheme .Scheme )
4646)
4747
48- func onboardingPath (clusterName , mirror , image string ) string {
48+ func onboardingPath (clusterName , mirror , image , version string ) string {
4949 path := "/v1/onboarding/k8s.yaml"
5050 params := url.Values {}
5151 if clusterName != "" {
@@ -57,19 +57,22 @@ func onboardingPath(clusterName, mirror, image string) string {
5757 if image != "" {
5858 params .Set ("image" , image )
5959 }
60+ if version != "" {
61+ params .Set ("version" , version )
62+ }
6063 if len (params ) == 0 {
6164 return path
6265 }
6366 return path + "?" + params .Encode ()
6467}
6568
66- func getYAML (clusterName , mirror , image string ) ([]byte , error ) {
69+ func getYAML (clusterName , mirror , image , version string ) ([]byte , error ) {
6770 c , err := config .DefaultAPIClient ()
6871 if err != nil {
6972 return nil , err
7073 }
7174
72- resp , err := c .SendRequest (http .MethodGet , onboardingPath (clusterName , mirror , image ), nil )
75+ resp , err := c .SendRequest (http .MethodGet , onboardingPath (clusterName , mirror , image , version ), nil )
7376 if err != nil {
7477 return nil , err
7578 }
@@ -1030,6 +1033,10 @@ will automatically connect to the Apoxy API and begin managing your in-cluster A
10301033 if err != nil {
10311034 return err
10321035 }
1036+ version , err := cmd .Flags ().GetString ("version" )
1037+ if err != nil {
1038+ return err
1039+ }
10331040 yes , err := cmd .Flags ().GetBool ("yes" )
10341041 if err != nil {
10351042 return err
@@ -1064,7 +1071,7 @@ will automatically connect to the Apoxy API and begin managing your in-cluster A
10641071 }
10651072 }
10661073
1067- yamlz , err := getYAML (clusterName , mirror , image )
1074+ yamlz , err := getYAML (clusterName , mirror , image , version )
10681075 if err != nil {
10691076 return fmt .Errorf ("failed to get YAML: %w" , err )
10701077 }
@@ -1092,6 +1099,7 @@ func init() {
10921099 installK8sCmd .Flags ().String ("cluster-name" , "" , "Cluster name identifier (defaults to kube context name)" )
10931100 installK8sCmd .Flags ().String ("mirror" , "" , "Mirror mode (gateway, ingress, all)" )
10941101 installK8sCmd .Flags ().String ("image" , "" , "Controller image override to pass to the onboarding manifest generator" )
1102+ installK8sCmd .Flags ().String ("version" , "" , "Controller version override (e.g. v0.3.0)" )
10951103 installK8sCmd .Flags ().BoolP ("yes" , "y" , false , "Skip confirmation and apply changes immediately" )
10961104 k8sCmd .AddCommand (installK8sCmd )
10971105
0 commit comments