Integer Type conversion in yaml











up vote
0
down vote

favorite












The below is my istio yaml for traffic shifting. I am getting the below error if I pass parameter in spinnaker. I am sending only integer values like 10, 20 etc.



"json: cannot unmarshal string into Go value of type int32"



Can I change the string to integer in yaml ?



- apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: webvs
namespace: default
spec:
gateways:
- xyz.default.svc.cluster.local
- mesh
hosts:
- web.xyz.com
http:
- route:
- destination:
host: web.default.svc.cluster.local
port:
number: 8080
subset: v1
weight: '${ parameters.Prodweightb }'
- destination:
host: web.default.svc.cluster.local
port:
number: 8080
subset: v2
weight: '${ parameters.Blineweightb }'
- destination:
host: web.default.svc.cluster.local
port:
number: 8080
subset: v3
weight: '${ parameters.Canaryweightb }'









share|improve this question




























    up vote
    0
    down vote

    favorite












    The below is my istio yaml for traffic shifting. I am getting the below error if I pass parameter in spinnaker. I am sending only integer values like 10, 20 etc.



    "json: cannot unmarshal string into Go value of type int32"



    Can I change the string to integer in yaml ?



    - apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    name: webvs
    namespace: default
    spec:
    gateways:
    - xyz.default.svc.cluster.local
    - mesh
    hosts:
    - web.xyz.com
    http:
    - route:
    - destination:
    host: web.default.svc.cluster.local
    port:
    number: 8080
    subset: v1
    weight: '${ parameters.Prodweightb }'
    - destination:
    host: web.default.svc.cluster.local
    port:
    number: 8080
    subset: v2
    weight: '${ parameters.Blineweightb }'
    - destination:
    host: web.default.svc.cluster.local
    port:
    number: 8080
    subset: v3
    weight: '${ parameters.Canaryweightb }'









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      The below is my istio yaml for traffic shifting. I am getting the below error if I pass parameter in spinnaker. I am sending only integer values like 10, 20 etc.



      "json: cannot unmarshal string into Go value of type int32"



      Can I change the string to integer in yaml ?



      - apiVersion: networking.istio.io/v1alpha3
      kind: VirtualService
      metadata:
      name: webvs
      namespace: default
      spec:
      gateways:
      - xyz.default.svc.cluster.local
      - mesh
      hosts:
      - web.xyz.com
      http:
      - route:
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v1
      weight: '${ parameters.Prodweightb }'
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v2
      weight: '${ parameters.Blineweightb }'
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v3
      weight: '${ parameters.Canaryweightb }'









      share|improve this question















      The below is my istio yaml for traffic shifting. I am getting the below error if I pass parameter in spinnaker. I am sending only integer values like 10, 20 etc.



      "json: cannot unmarshal string into Go value of type int32"



      Can I change the string to integer in yaml ?



      - apiVersion: networking.istio.io/v1alpha3
      kind: VirtualService
      metadata:
      name: webvs
      namespace: default
      spec:
      gateways:
      - xyz.default.svc.cluster.local
      - mesh
      hosts:
      - web.xyz.com
      http:
      - route:
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v1
      weight: '${ parameters.Prodweightb }'
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v2
      weight: '${ parameters.Blineweightb }'
      - destination:
      host: web.default.svc.cluster.local
      port:
      number: 8080
      subset: v3
      weight: '${ parameters.Canaryweightb }'






      types yaml istio spinnaker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 19:39









      Frank B

      36017




      36017










      asked Nov 21 at 14:22









      Subit Das

      63




      63
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The problem with your yaml is that there are single quotes around the int parameter value. Try to remove them, for example:



          weight: ${ parameters.Canaryweightb }





          share|improve this answer





















          • Spinnaker is assigning those single quotes automatically.
            – Subit Das
            Nov 21 at 17:37










          • Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
            – Frank B
            Nov 21 at 23:04










          • I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
            – Subit Das
            Nov 22 at 14:45













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414164%2finteger-type-conversion-in-yaml%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          The problem with your yaml is that there are single quotes around the int parameter value. Try to remove them, for example:



          weight: ${ parameters.Canaryweightb }





          share|improve this answer





















          • Spinnaker is assigning those single quotes automatically.
            – Subit Das
            Nov 21 at 17:37










          • Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
            – Frank B
            Nov 21 at 23:04










          • I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
            – Subit Das
            Nov 22 at 14:45

















          up vote
          0
          down vote













          The problem with your yaml is that there are single quotes around the int parameter value. Try to remove them, for example:



          weight: ${ parameters.Canaryweightb }





          share|improve this answer





















          • Spinnaker is assigning those single quotes automatically.
            – Subit Das
            Nov 21 at 17:37










          • Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
            – Frank B
            Nov 21 at 23:04










          • I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
            – Subit Das
            Nov 22 at 14:45















          up vote
          0
          down vote










          up vote
          0
          down vote









          The problem with your yaml is that there are single quotes around the int parameter value. Try to remove them, for example:



          weight: ${ parameters.Canaryweightb }





          share|improve this answer












          The problem with your yaml is that there are single quotes around the int parameter value. Try to remove them, for example:



          weight: ${ parameters.Canaryweightb }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 at 16:52









          Frank B

          36017




          36017












          • Spinnaker is assigning those single quotes automatically.
            – Subit Das
            Nov 21 at 17:37










          • Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
            – Frank B
            Nov 21 at 23:04










          • I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
            – Subit Das
            Nov 22 at 14:45




















          • Spinnaker is assigning those single quotes automatically.
            – Subit Das
            Nov 21 at 17:37










          • Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
            – Frank B
            Nov 21 at 23:04










          • I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
            – Subit Das
            Nov 22 at 14:45


















          Spinnaker is assigning those single quotes automatically.
          – Subit Das
          Nov 21 at 17:37




          Spinnaker is assigning those single quotes automatically.
          – Subit Das
          Nov 21 at 17:37












          Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
          – Frank B
          Nov 21 at 23:04




          Isn't there a way to tell spinnaker that the value is int (not string) so it doesn't add the quotes?
          – Frank B
          Nov 21 at 23:04












          I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
          – Subit Das
          Nov 22 at 14:45






          I could resolve it using the following notation in spinnaker. '${ #toInt( parameters.Prodweightb ) }' '${ #toInt( parameters.Blineweightb ) }' '${ #toInt( parameters.Canaryweightb ) }'
          – Subit Das
          Nov 22 at 14:45




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414164%2finteger-type-conversion-in-yaml%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)