...

Source file src/github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture/contexts/compute_context.go

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture/contexts

     1  // Copyright 2022 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package contexts
    16  
    17  func init() {
    18  	resourceContextMap["regionalcomputeaddress"] = ResourceContext{
    19  		ResourceKind: "ComputeAddress",
    20  		SkipUpdate:   true,
    21  		// TestCreateNoChangeUpdateDelete/basic-regionalcomputeaddress: dynamic_controller_integration_test.go:239:
    22  		//    reconcile returned unexpected error: Update call failed: error applying desired state: Error creating
    23  		//   Address: googleapi: Error 400: Invalid value for field 'resource.networkTier': 'PREMIUM'. An address
    24  		//  with type INTERNAL cannot have a network tier., invalid
    25  		SkipDriftDetection: true,
    26  	}
    27  
    28  	resourceContextMap["globalcomputeaddress"] = ResourceContext{
    29  		ResourceKind: "ComputeAddress",
    30  		SkipUpdate:   true,
    31  	}
    32  
    33  	resourceContextMap["computeexternalvpngateway"] = ResourceContext{
    34  		ResourceKind: "ComputeExternalVPNGateway",
    35  		SkipUpdate:   true,
    36  	}
    37  
    38  	resourceContextMap["cloudfunctioncomputeregionnetworkendpointgroup"] = ResourceContext{
    39  		ResourceKind: "ComputeRegionNetworkEndpointGroup",
    40  		// The GCP resource for ComputeRegionNetworkEndpointGroup doesn't
    41  		// support update.
    42  		SkipUpdate: true,
    43  	}
    44  
    45  	resourceContextMap["cloudruncomputeregionnetworkendpointgroup"] = ResourceContext{
    46  		ResourceKind: "ComputeRegionNetworkEndpointGroup",
    47  		// The GCP resource for ComputeRegionNetworkEndpointGroup doesn't
    48  		// support update.
    49  		SkipUpdate: true,
    50  	}
    51  
    52  	resourceContextMap["privateserviceconnectioncomputeregionnetworkendpointgroup"] = ResourceContext{
    53  		ResourceKind: "ComputeRegionNetworkEndpointGroup",
    54  		// The GCP resource for ComputeRegionNetworkEndpointGroup doesn't
    55  		// support update.
    56  		SkipUpdate: true,
    57  	}
    58  
    59  	resourceContextMap["computenetworkendpointgroup"] = ResourceContext{
    60  		ResourceKind: "ComputeNetworkEndpointGroup",
    61  		SkipUpdate:   true,
    62  	}
    63  
    64  	resourceContextMap["computenetworkpeering"] = ResourceContext{
    65  		ResourceKind: "ComputeNetworkPeering",
    66  		SkipUpdate:   true,
    67  	}
    68  
    69  	resourceContextMap["computenodetemplate"] = ResourceContext{
    70  		ResourceKind: "ComputeNodeTemplate",
    71  		SkipUpdate:   true,
    72  	}
    73  
    74  	resourceContextMap["computenodegroup"] = ResourceContext{
    75  		ResourceKind: "ComputeNodeGroup",
    76  		SkipUpdate:   true, // The only field which supports update is nodeTemplateRef, which currently cannot be used for testing updates because of b/147506185
    77  	}
    78  
    79  	resourceContextMap["computesharedvpchostproject"] = ResourceContext{
    80  		ResourceKind: "ComputeSharedVPCHostProject",
    81  		SkipUpdate:   true,
    82  	}
    83  
    84  	resourceContextMap["computesharedvpcserviceproject"] = ResourceContext{
    85  		ResourceKind: "ComputeSharedVPCServiceProject",
    86  		SkipUpdate:   true,
    87  	}
    88  	resourceContextMap["computesslcertificate"] = ResourceContext{
    89  		ResourceKind: "ComputeSSLCertificate",
    90  		SkipUpdate:   true, // No input fields in this resource support update.
    91  	}
    92  
    93  	resourceContextMap["globalcomputesslcertificate"] = ResourceContext{
    94  		ResourceKind: "ComputeSSLCertificate",
    95  		SkipUpdate:   true, // No input fields in this resource support update.
    96  	}
    97  
    98  	resourceContextMap["regionalcomputesslcertificate"] = ResourceContext{
    99  		ResourceKind: "ComputeSSLCertificate",
   100  		SkipUpdate:   true, // No input fields in this resource support update.
   101  	}
   102  
   103  	resourceContextMap["computetargetgrpcproxy"] = ResourceContext{
   104  		ResourceKind: "ComputeTargetGRPCProxy",
   105  		SkipUpdate:   true, // No input fields in this resource support update.
   106  	}
   107  
   108  	resourceContextMap["computereservation"] = ResourceContext{
   109  		ResourceKind: "ComputeReservation",
   110  		SkipUpdate:   true, // No input fields in this resource support update.
   111  	}
   112  
   113  	resourceContextMap["computeresourcepolicy"] = ResourceContext{
   114  		ResourceKind: "ComputeResourcePolicy",
   115  		SkipUpdate:   true,
   116  	}
   117  
   118  	resourceContextMap["computerouterinterface"] = ResourceContext{
   119  		ResourceKind: "ComputeRouterInterface",
   120  		SkipUpdate:   true,
   121  	}
   122  
   123  	resourceContextMap["computerouternat"] = ResourceContext{
   124  		ResourceKind: "ComputeRouterNAT",
   125  		SkipUpdate:   true,
   126  	}
   127  
   128  	resourceContextMap["computerouterpeer"] = ResourceContext{
   129  		ResourceKind: "ComputeRouterPeer",
   130  		SkipUpdate:   true,
   131  	}
   132  
   133  	resourceContextMap["computeinstance"] = ResourceContext{
   134  		ResourceKind: "ComputeInstance",
   135  		// TestCreateNoChangeUpdateDelete/basic-computeinstance: dynamic_controller_integration_test.go:239: reconcile
   136  		//    returned unexpected error: Update call failed: error applying desired state: Error creating instance:
   137  		//    googleapi: Error 400: Invalid value for field 'resource.disks[0]': '{  "mode": "READ_WRITE",  "source":
   138  		//    "projects/cnrm-test-tgooo56g38yqbn3k/zones/us-west1-a/disks/comp...'. Cannot specify both 'source' and
   139  		//    'initializeParams'., invalid
   140  		SkipDriftDetection: true,
   141  	}
   142  
   143  	resourceContextMap["computeinstancewithencrypteddisk"] = ResourceContext{
   144  		ResourceKind: "ComputeInstance",
   145  		SkipNoChange: true, // Encryption key can't be retrieved so the live state will always be different from the intended state.
   146  		// TestCreateNoChangeUpdateDelete/basic-computeinstancewithencrypteddisk: dynamic_controller_integration_test.go:239:
   147  		//    reconcile returned unexpected error: Update call failed: error applying desired state: Error creating instance:
   148  		//    googleapi: Error 400: Invalid value for field 'resource.disks[0]': '{  "mode": "READ_WRITE",  "source":
   149  		//    "projects/cnrm-test-tgooo56g38yqbn3k/zones/us-west1-a/disks/comp...'. Cannot specify both 'source' and
   150  		//    'initializeParams'., invalid
   151  		SkipDriftDetection: true,
   152  	}
   153  
   154  	resourceContextMap["computeinstancefromtemplate"] = ResourceContext{
   155  		ResourceKind: "ComputeInstance",
   156  		// TestCreateNoChangeUpdateDelete/basic-computeinstancefromtemplate: dynamic_controller_integration_test.go:239:
   157  		//   reconcile returned unexpected error: Update call failed: error applying desired state: Error creating instance:
   158  		//   googleapi: Error 400: Invalid value for field 'resource.disks[0]': '{  "mode": "READ_WRITE",  "source":
   159  		//   "projects/cnrm-test-tgooo56g38yqbn3k/zones/us-west1-a/disks/comp...'. Cannot specify both 'source' and
   160  		//   'initializeParams'., invalid
   161  		SkipDriftDetection: true,
   162  	}
   163  
   164  	resourceContextMap["computeinstancetemplate"] = ResourceContext{
   165  		ResourceKind: "ComputeInstanceTemplate",
   166  		SkipUpdate:   true, // Update is not supported for Compute Instance Template in the GCP API and TF provider.
   167  	}
   168  
   169  	resourceContextMap["computetargetinstance"] = ResourceContext{
   170  		ResourceKind: "ComputeTargetInstance",
   171  		SkipUpdate:   true, // No input fields in this resource support update.
   172  	}
   173  
   174  	resourceContextMap["computetargetsslproxy"] = ResourceContext{
   175  		ResourceKind: "ComputeTargetSSLProxy",
   176  		SkipUpdate:   true,
   177  	}
   178  
   179  	resourceContextMap["computetargettcpproxy"] = ResourceContext{
   180  		ResourceKind: "ComputeTargetTCPProxy",
   181  	}
   182  
   183  	resourceContextMap["globalcomputeforwardingrule"] = ResourceContext{
   184  		ResourceKind: "ComputeForwardingRule",
   185  		SkipUpdate:   true, // The only field which supports update is targetRef, which currently cannot be used for testing updates because of b/147506185
   186  		// TestCreateNoChangeUpdateDelete/basic-globalcomputeforwardingrule: dynamic_controller_integration_test.go:239:
   187  		//   reconcile returned unexpected error: Update call failed: error applying desired state: Error creating
   188  		//   GlobalForwardingRule: googleapi: Error 400: Invalid value for field 'resource.IPAddress': '34.95.75.26'.
   189  		//   Invalid IP address specified., invalid
   190  		SkipDriftDetection: true,
   191  	}
   192  
   193  	resourceContextMap["regionalcomputeforwardingrule"] = ResourceContext{
   194  		ResourceKind: "ComputeForwardingRule",
   195  		SkipUpdate:   false,
   196  		// TestCreateNoChangeUpdateDelete/basic-regionalcomputeforwardingrule: dynamic_controller_integration_test.go:149:
   197  		//   value mismatch for label with key 'label-one': got 'value-two', want 'value-one'
   198  		SkipDriftDetection: true,
   199  	}
   200  
   201  	resourceContextMap["computevpngateway"] = ResourceContext{
   202  		ResourceKind: "ComputeVPNGateway",
   203  		SkipUpdate:   true,
   204  	}
   205  
   206  	resourceContextMap["computevpntunnel"] = ResourceContext{
   207  		ResourceKind: "ComputeVPNTunnel",
   208  		// TestCreateNoChangeUpdateDelete/basic-computevpntunnel: dynamic_controller_integration_test.go:149: value
   209  		//    mismatch for label with key 'label-one': got 'value-two', want 'value-one'
   210  		SkipDriftDetection: true,
   211  	}
   212  
   213  	resourceContextMap["computetargetvpngateway"] = ResourceContext{
   214  		ResourceKind: "ComputeTargetVPNGateway",
   215  		SkipUpdate:   true,
   216  	}
   217  
   218  	resourceContextMap["regionalcomputedisk"] = ResourceContext{
   219  		ResourceKind: "ComputeDisk",
   220  		SkipUpdate:   true,
   221  	}
   222  
   223  	resourceContextMap["zonalcomputedisk"] = ResourceContext{
   224  		ResourceKind: "ComputeDisk",
   225  		SkipUpdate:   true,
   226  	}
   227  
   228  	resourceContextMap["computediskfromsourcedisk"] = ResourceContext{
   229  		ResourceKind: "ComputeDisk",
   230  		SkipUpdate:   true,
   231  	}
   232  
   233  	resourceContextMap["computesnapshot"] = ResourceContext{
   234  		ResourceKind: "ComputeSnapshot",
   235  		SkipUpdate:   true,
   236  	}
   237  
   238  	resourceContextMap["computeroute"] = ResourceContext{
   239  		ResourceKind: "ComputeRoute",
   240  		SkipUpdate:   true,
   241  	}
   242  
   243  	resourceContextMap["externalwithpartialuri"] = resourceContextMap["computevpngateway"]
   244  
   245  	resourceContextMap["sensitivevaluesimple"] = resourceContextMap["computesslcertificate"]
   246  
   247  	resourceContextMap["sensitivevaluefromsecret"] = resourceContextMap["computesslcertificate"]
   248  
   249  	resourceContextMap["foldercomputefirewallpolicyassociation"] = ResourceContext{
   250  		ResourceKind: "ComputeFirewallPolicyAssociation",
   251  		SkipUpdate:   true, // No update method in DCL at the moment
   252  	}
   253  
   254  	resourceContextMap["organizationcomputefirewallpolicyassociation"] = ResourceContext{
   255  		ResourceKind: "ComputeFirewallPolicyAssociation",
   256  		SkipUpdate:   true, // No update method in DCL at the moment
   257  	}
   258  }
   259  

View as plain text