diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-0.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-0.json similarity index 64% rename from docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-0.json rename to docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-0.json index 55fd384bf..5ffc63efc 100644 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-0.json +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-0.json @@ -2,21 +2,21 @@ "kind": "HostSubnet", "apiVersion": "network.openshift.io/v1", "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-master-0", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-master-0", - "uid": "ba02b433-fe1c-4558-bc30-47c1245cc7e8", - "resourceVersion": "3259", + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-master-0", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-master-0", + "uid": "66cb1cad-f8d8-4467-a19d-26462eb75c1f", + "resourceVersion": "3424", "generation": 1, - "creationTimestamp": "2020-12-02T13:47:00Z", + "creationTimestamp": "2021-01-12T07:57:08Z", "annotations": { - "pod.network.openshift.io/node-uid": "d392507b-5c7f-4332-8400-f0cb3ae2ea13" + "pod.network.openshift.io/node-uid": "3829f864-4ae3-4ed4-b3da-fc7be1c25ede" }, "managedFields": [ { "manager": "openshift-sdn-controller", "operation": "Update", "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:47:00Z", + "time": "2021-01-12T07:57:08Z", "fieldsType": "FieldsV1", "fieldsV1": { "f:host": {}, @@ -32,7 +32,7 @@ } ] }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-master-0", - "hostIP": "xxxxxxxx", - "subnet": "xxxxxxxxxxxxx" + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-master-0", + "hostIP": "10.0.0.4", + "subnet": "10.130.0.0/23" } \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-1.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-1.json similarity index 64% rename from docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-1.json rename to docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-1.json index 195ed7503..041121300 100644 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-1.json +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-1.json @@ -2,21 +2,21 @@ "kind": "HostSubnet", "apiVersion": "network.openshift.io/v1", "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-master-1", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-master-1", - "uid": "8fb03f7e-daee-4ee7-85ea-c9e593f1df45", - "resourceVersion": "3300", + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-master-1", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-master-1", + "uid": "32f1dd3a-f095-41dc-a898-92764a13d7ed", + "resourceVersion": "3390", "generation": 1, - "creationTimestamp": "2020-12-02T13:47:01Z", + "creationTimestamp": "2021-01-12T07:57:07Z", "annotations": { - "pod.network.openshift.io/node-uid": "ac4124f9-6413-43b7-874f-143d28d26515" + "pod.network.openshift.io/node-uid": "41c67588-d3ea-4613-a57b-fb2d481a0436" }, "managedFields": [ { "manager": "openshift-sdn-controller", "operation": "Update", "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:47:01Z", + "time": "2021-01-12T07:57:07Z", "fieldsType": "FieldsV1", "fieldsV1": { "f:host": {}, @@ -32,7 +32,7 @@ } ] }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-master-1", - "hostIP": "xxxxxxxx", - "subnet": "xxxxxxxxxxxxx" + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-master-1", + "hostIP": "10.0.0.5", + "subnet": "10.129.0.0/23" } \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-2.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-2.json similarity index 64% rename from docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-2.json rename to docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-2.json index cc7b002ba..80fa493e8 100644 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-master-2.json +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-master-2.json @@ -2,21 +2,21 @@ "kind": "HostSubnet", "apiVersion": "network.openshift.io/v1", "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-master-2", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-master-2", - "uid": "f4ee1029-f09c-42cf-a2ef-2a10361de269", - "resourceVersion": "3284", + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-master-2", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-master-2", + "uid": "d98cb801-bff4-440d-a8cb-366fbd05c52a", + "resourceVersion": "3366", "generation": 1, - "creationTimestamp": "2020-12-02T13:47:01Z", + "creationTimestamp": "2021-01-12T07:57:07Z", "annotations": { - "pod.network.openshift.io/node-uid": "c12a71e5-ec7e-4534-99b0-fdd027d74460" + "pod.network.openshift.io/node-uid": "ebe27b4e-8bca-4350-b3fa-f61c57e8df41" }, "managedFields": [ { "manager": "openshift-sdn-controller", "operation": "Update", "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:47:01Z", + "time": "2021-01-12T07:57:07Z", "fieldsType": "FieldsV1", "fieldsV1": { "f:host": {}, @@ -32,7 +32,7 @@ } ] }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-master-2", - "hostIP": "xxxxxxxx", - "subnet": "xxxxxxxxxxxxx" + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-master-2", + "hostIP": "10.0.0.3", + "subnet": "10.128.0.0/23" } \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn.json similarity index 63% rename from docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr.json rename to docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn.json index d1b3d2dae..1e6b6d528 100644 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr.json +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn.json @@ -2,21 +2,21 @@ "kind": "HostSubnet", "apiVersion": "network.openshift.io/v1", "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr", - "uid": "dd0abb76-6e1f-4e86-b8c1-4047d1d4da51", - "resourceVersion": "17494", + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn", + "uid": "fe6b6d51-bbea-4ab5-9f28-3f4e764e7082", + "resourceVersion": "18347", "generation": 1, - "creationTimestamp": "2020-12-02T13:55:23Z", + "creationTimestamp": "2021-01-12T08:05:03Z", "annotations": { - "pod.network.openshift.io/node-uid": "98b24621-4b5a-41fe-82a8-c5992f66662d" + "pod.network.openshift.io/node-uid": "75cdc5fb-5d09-4b73-9ac7-0adaffda5f94" }, "managedFields": [ { "manager": "openshift-sdn-controller", "operation": "Update", "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:55:23Z", + "time": "2021-01-12T08:05:03Z", "fieldsType": "FieldsV1", "fieldsV1": { "f:host": {}, @@ -32,7 +32,7 @@ } ] }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-worker-b-56nwr", - "hostIP": "xxxxxxxxx", - "subnet": "xxxxxxxxxxxxx" + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-b-q59xn", + "hostIP": "10.0.32.2", + "subnet": "10.129.2.0/23" } \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t.json new file mode 100644 index 000000000..53ae0bff0 --- /dev/null +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t.json @@ -0,0 +1,38 @@ +{ + "kind": "HostSubnet", + "apiVersion": "network.openshift.io/v1", + "metadata": { + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t", + "uid": "51000dc6-803d-4371-97a5-6b18f077ccbf", + "resourceVersion": "16216", + "generation": 1, + "creationTimestamp": "2021-01-12T08:03:43Z", + "annotations": { + "pod.network.openshift.io/node-uid": "69a66671-6526-4045-8e3f-910a51855c0a" + }, + "managedFields": [ + { + "manager": "openshift-sdn-controller", + "operation": "Update", + "apiVersion": "network.openshift.io/v1", + "time": "2021-01-12T08:03:43Z", + "fieldsType": "FieldsV1", + "fieldsV1": { + "f:host": {}, + "f:hostIP": {}, + "f:metadata": { + "f:annotations": { + ".": {}, + "f:pod.network.openshift.io/node-uid": {} + } + }, + "f:subnet": {} + } + } + ] + }, + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-c-7wf2t", + "hostIP": "10.0.32.3", + "subnet": "10.131.0.0/23" +} \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q.json new file mode 100644 index 000000000..b13d3b1b4 --- /dev/null +++ b/docs/insights-archive-sample/config/hostsubnet/ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q.json @@ -0,0 +1,38 @@ +{ + "kind": "HostSubnet", + "apiVersion": "network.openshift.io/v1", + "metadata": { + "name": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q", + "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q", + "uid": "d9dbd4aa-f4d3-4281-81dd-96d7e479ec6f", + "resourceVersion": "17300", + "generation": 1, + "creationTimestamp": "2021-01-12T08:04:31Z", + "annotations": { + "pod.network.openshift.io/node-uid": "de6cbeb6-1457-4074-8175-b0b9cc08d56b" + }, + "managedFields": [ + { + "manager": "openshift-sdn-controller", + "operation": "Update", + "apiVersion": "network.openshift.io/v1", + "time": "2021-01-12T08:04:31Z", + "fieldsType": "FieldsV1", + "fieldsV1": { + "f:host": {}, + "f:hostIP": {}, + "f:metadata": { + "f:annotations": { + ".": {}, + "f:pod.network.openshift.io/node-uid": {} + } + }, + "f:subnet": {} + } + } + ] + }, + "host": "ci-ln-h9vpcgk-f76d1-8zsf5-worker-d-7jz4q", + "hostIP": "10.0.32.4", + "subnet": "10.128.2.0/23" +} \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7.json deleted file mode 100644 index 7924578d9..000000000 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "kind": "HostSubnet", - "apiVersion": "network.openshift.io/v1", - "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7", - "uid": "de2d7ef0-b92f-4c6b-b28d-a21f4637eb93", - "resourceVersion": "17560", - "generation": 1, - "creationTimestamp": "2020-12-02T13:55:23Z", - "annotations": { - "pod.network.openshift.io/node-uid": "4e4b280b-2b08-4fe4-91cb-463deee0a8d6" - }, - "managedFields": [ - { - "manager": "openshift-sdn-controller", - "operation": "Update", - "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:55:23Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:host": {}, - "f:hostIP": {}, - "f:metadata": { - "f:annotations": { - ".": {}, - "f:pod.network.openshift.io/node-uid": {} - } - }, - "f:subnet": {} - } - } - ] - }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-worker-c-wkwh7", - "hostIP": "xxxxxxxxx", - "subnet": "xxxxxxxxxxxxx" -} \ No newline at end of file diff --git a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8.json b/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8.json deleted file mode 100644 index 6a21ed492..000000000 --- a/docs/insights-archive-sample/config/hostsubnet/ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "kind": "HostSubnet", - "apiVersion": "network.openshift.io/v1", - "metadata": { - "name": "ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8", - "selfLink": "/apis/network.openshift.io/v1/hostsubnets/ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8", - "uid": "f6ea2075-e132-4d7f-a2be-3d62fae85f85", - "resourceVersion": "17142", - "generation": 1, - "creationTimestamp": "2020-12-02T13:55:17Z", - "annotations": { - "pod.network.openshift.io/node-uid": "01cbed7d-ca7c-48df-86dd-ea140b8b4c94" - }, - "managedFields": [ - { - "manager": "openshift-sdn-controller", - "operation": "Update", - "apiVersion": "network.openshift.io/v1", - "time": "2020-12-02T13:55:17Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:host": {}, - "f:hostIP": {}, - "f:metadata": { - "f:annotations": { - ".": {}, - "f:pod.network.openshift.io/node-uid": {} - } - }, - "f:subnet": {} - } - } - ] - }, - "host": "ci-ln-iffptmb-f76d1-nhwgd-worker-d-mdwl8", - "hostIP": "xxxxxxxxx", - "subnet": "xxxxxxxxxxxxx" -} \ No newline at end of file diff --git a/pkg/gather/clusterconfig/host_subnets.go b/pkg/gather/clusterconfig/host_subnets.go index f3190244e..432c38b5d 100644 --- a/pkg/gather/clusterconfig/host_subnets.go +++ b/pkg/gather/clusterconfig/host_subnets.go @@ -48,20 +48,11 @@ func gatherHostSubnet(ctx context.Context, networkClient networkv1client.Network return records, nil } -// HostSubnetAnonymizer implements HostSubnet serialization wiht anonymization +// HostSubnetAnonymizer implements HostSubnet serialization type HostSubnetAnonymizer struct{ networkv1.HostSubnet } // Marshal implements HostSubnet serialization func (a HostSubnetAnonymizer) Marshal(_ context.Context) ([]byte, error) { - a.HostSubnet.HostIP = anonymizeString(a.HostSubnet.HostIP) - a.HostSubnet.Subnet = anonymizeString(a.HostSubnet.Subnet) - - for i, s := range a.HostSubnet.EgressIPs { - a.HostSubnet.EgressIPs[i] = networkv1.HostSubnetEgressIP(anonymizeString(string(s))) - } - for i, s := range a.HostSubnet.EgressCIDRs { - a.HostSubnet.EgressCIDRs[i] = networkv1.HostSubnetEgressCIDR(anonymizeString(string(s))) - } return runtime.Encode(networkSerializer.LegacyCodec(networkv1.SchemeGroupVersion), &a.HostSubnet) } diff --git a/pkg/gather/clusterconfig/host_subnets_test.go b/pkg/gather/clusterconfig/host_subnets_test.go index 1db0988a0..3902eb411 100644 --- a/pkg/gather/clusterconfig/host_subnets_test.go +++ b/pkg/gather/clusterconfig/host_subnets_test.go @@ -39,11 +39,11 @@ func TestGatherHostSubnet(t *testing.T) { if err != nil { t.Fatalf("failed to decode object: %v", err) } - if gatheredHostSubnet.HostIP != "xxxxxxxx" { - t.Fatalf("Host IP is not anonymized %s", gatheredHostSubnet.HostIP) + if gatheredHostSubnet.HostIP != testHostSubnet.HostIP { + t.Fatalf("Unexpected Host IP value %s", gatheredHostSubnet.HostIP) } - if gatheredHostSubnet.Subnet != "xxxxxxxxxxx" { - t.Fatalf("Host Subnet is not anonymized %s", gatheredHostSubnet.Subnet) + if gatheredHostSubnet.Subnet != testHostSubnet.Subnet { + t.Fatalf("Unexpected Subnet value %s", gatheredHostSubnet.Subnet) } if len(gatheredHostSubnet.EgressIPs) != len(testHostSubnet.EgressIPs) { t.Fatalf("unexpected number of egress IPs gathered %s", gatheredHostSubnet.EgressIPs) @@ -52,16 +52,4 @@ func TestGatherHostSubnet(t *testing.T) { if len(gatheredHostSubnet.EgressCIDRs) != len(testHostSubnet.EgressCIDRs) { t.Fatalf("unexpected number of egress CIDRs gathered %s", gatheredHostSubnet.EgressCIDRs) } - - for _, ip := range gatheredHostSubnet.EgressIPs { - if ip != "xxxxxxxx" { - t.Fatalf("Egress IP is not anonymized %s", ip) - } - } - - for _, cidr := range gatheredHostSubnet.EgressCIDRs { - if cidr != "xxxxxxxxxxx" { - t.Fatalf("Egress CIDR is not anonymized %s", cidr) - } - } }