'Creates OperationContract for upsertLoadBalancer.
Calls Spinnaker\'s upsertLoadBalancer with a configuration, then verifies
that the expected resources and configurations are visible on Kubernetes.
See the contract builder for more info on what the expectations are.'

def upsert_load_balancer(self):

    bindings = self.bindings
    payload = self.agent.make_json_payload_from_kwargs(job=[{'cloudProvider': 'kubernetes', 'availabilityZones': {self.TEST_NAMESPACE: [self.TEST_NAMESPACE]}, 'provider': 'kubernetes', 'stack': bindings['TEST_STACK'], 'detail': self.__lb_detail, 'serviceType': 'ClusterIP', 'account': bindings['SPINNAKER_KUBERNETES_ACCOUNT'], 'namespace': self.TEST_NAMESPACE, 'ports': [{'protocol': 'TCP', 'port': 80, 'name': 'http'}], 'externalIps': [], 'sessionAffinity': 'None', 'clusterIp': '', 'loadBalancerIp': '', 'name': self.__lb_name, 'healthCheck': ':undefined', 'type': 'upsertLoadBalancer', 'securityGroups': None, 'user': '[anonymous]'}], description=('Create    Load    Balancer:    ' + self.__lb_name), application=self.TEST_APP)
    builder = kube.KubeContractBuilder(self.kube_observer)
    builder.new_clause_builder('Service    Added', retryable_for_secs=15).get_resources('svc', extra_args=['--namespace', self.TEST_NAMESPACE]).contains_path_value('items/metadata/name', self.__lb_name)
    return st.OperationContract(self.new_post_operation(title='upsert_load_balancer', data=payload, path='tasks'), contract=builder.build())
