Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The enableNetworkPolicy field getting wiped out when updating using REST API #23759

Closed
dnoland1 opened this issue Oct 29, 2019 · 3 comments
Closed
Assignees
Milestone

Comments

@dnoland1
Copy link
Contributor

What kind of request is this (question/bug/enhancement/feature request):
bug

Steps to reproduce (least amount of steps as possible):
Run the following script on an existing custom cluster w/ canal CNI:

#!/bin/bash
export CATTLE_ACCESS_KEY=xxx
export CATTLE_SECRET_KEY=yyy
export HOST=???.???.???
export CLUSTER_ID=c-?????

echo "Checking enableNetworkPolicy:"
curl -s -k -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
"https://${HOST}/v3/clusters/${CLUSTER_ID}" | jq '.enableNetworkPolicy'

echo "Setting enableNetworkPolicy to true"
curl -s -k -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
  "name": "custom",
  "enableNetworkPolicy": true,
  "rancherKubernetesEngineConfig": {
    "network": {
      "plugin": "canal"
    }
  }
}' \
"https://${HOST}/v3/clusters/${CLUSTER_ID}" > /dev/null

echo "Checking enableNetworkPolicy after first update:"
curl -s -k -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
"https://${HOST}/v3/clusters/${CLUSTER_ID}" | jq '.enableNetworkPolicy'

echo "Updating again:"
curl -s -k -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
  "name": "custom",
  "addJobTimeout": 55
}' \
"https://${HOST}/v3/clusters/${CLUSTER_ID}" > /dev/null

echo "Checking enableNetworkPolicy after second update:"
curl -s -k -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
"https://${HOST}/v3/clusters/${CLUSTER_ID}" | jq '.enableNetworkPolicy'

Result:

Checking enableNetworkPolicy:
false
Setting enableNetworkPolicy to true
Checking enableNetworkPolicy after first update:
true
Updating again:
Checking enableNetworkPolicy after second update:
false

Note, the second update wiped out the enableNetworkPolicy. It's resetting it to false. It should be true after the second update.;

Other details that may be helpful:

Environment information

  • Rancher version (rancher/rancher/rancher/server image tag or shown bottom left in the UI):
    v2.3.2
  • Installation option (single install/HA):
    single install

Cluster information

  • Cluster type (Hosted/Infrastructure Provider/Custom/Imported):
    custom
  • Machine type (cloud/VM/metal) and specifications (CPU/memory):
    t3a.mediun in AWS
  • Kubernetes version (use kubectl version):
 kubectl version    
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.1", GitCommit:"d647ddbd755faf07169599a625faf302ffc34458", GitTreeState:"clean", BuildDate:"2019-10-02T17:01:15Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:07:57Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
  • Docker version (use docker version):
$ docker version
Client: Docker Engine - Community
 Version:           18.09.8
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        0dd43dd87f
 Built:             Wed Jul 17 17:38:58 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.8
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       0dd43dd87f
  Built:            Wed Jul 17 17:48:49 2019
  OS/Arch:          linux/amd64
  Experimental:     false
@sowmyav27
Copy link
Contributor

reopening the issue, waiting for PR in 2.3 branch

@sowmyav27
Copy link
Contributor

PR: #25257

@sowmyav27
Copy link
Contributor

Reproduced the issue on 2.3.2

Checking enableNetworkPolicy:
false
Setting enableNetworkPolicy to true
Checking enableNetworkPolicy after first update:
true
Updating again:
Checking enableNetworkPolicy after second update:
false

Verified with master-head - commit id: ca01ddff2 and on 2.3-head commit id: 6eecc2c8b

Deploy a cluster, and run the test.sh from the issue -- #23759 (comment)

Checking enableNetworkPolicy:
false
Setting enableNetworkPolicy to true
Checking enableNetworkPolicy after first update:
true
Updating again:
Checking enableNetworkPolicy after second update:
true

@zube zube bot removed the [zube]: To Test label Feb 5, 2020
@zube zube bot added the [zube]: Done label Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants